PDA

View Full Version : Shortcut Problem


Antagony
11-26-2007, 05:53 AM
Greetings,

Please excuse me if there is an obvious answer to this problem, I am new to Setup Factory and still learning the ropes.

The problem is this: I have an important PDF document which must be available for the end user as a shortcut on the desktop. Now, I can't guarantee that the end-user will have a default Acrobat reader installed so, rather than include the Adobe bloat-ware package, I decided to include Foxit as a small standalone reader.

I have utilised the sample function "ir_GetAcrobatVersion" (provided with SF7) to determine whether Acrobat reader is installed and, if not, to create a shortcut to Foxit with the PDF document's full path as a command line parameter.

This is the code I'm using:

sTrainingManPath = _ProgramFilesFolder .. "\\BIT\\Training Manual.pdf";
sFoxitReaderPath = _ProgramFilesFolder .. "\\BIT\\Foxit Reader.exe";
PDFVerNo = ir_GetAcrobatVersion();
if PDFVerNo ~= "0.0.0.0" then -- An Acrobat reader is installed
Shell.CreateShortcut(_DesktopFolder, "Training Manual", sTrainingManPath, "", "", "", 0, SW_SHOWNORMAL, nil, "");
else -- Use Foxit
Shell.CreateShortcut(_DesktopFolder, "Training Manual", sFoxitReaderPath, sTrainingManPath, "", "", 0, SW_SHOWNORMAL, nil, "");
end

Unfortunately, it doesn't work properly. It creates the shortcut alright, but the command line parameter isn't in quotes, so Foxit objects. How do I create the command line parameter with quotes?

Any help would be greatly appreciated.

pww
11-26-2007, 06:08 AM
this way it should put quotes around path to reader & path to file


Shell.CreateShortcut(_DesktopFolder, "Training Manual", "\"" .. sFoxitReaderPath .. "\"", "\"" .. sTrainingManPath .."\"" , "", "", 0, SW_SHOWNORMAL, nil, "");


as quotes have to be escaped in strings, add \"

Antagony
11-26-2007, 06:16 AM
Thanks pww, that's done the trick. :yes