View Full Version : Shell.Execute
Farewell
09-17-2009, 08:03 AM
Hey guys,
why is:
Shell.Execute(SessionVar.Expand("C:\\Program Files\\Adobe\Reader 9.0\\Reader\\AcroRd32.exe"), "open", "/A page=15 bla.Pdf", "", SW_SHOWNORMAL);
not working?!
the Adobe Reader is in this path...
thanks for help
ShadowUK
09-17-2009, 09:25 AM
Hey guys,
why is:
Shell.Execute(SessionVar.Expand("C:\\Program Files\\Adobe\Reader 9.0\\Reader\\AcroRd32.exe"), "open", "/A page=15 bla.Pdf", "", SW_SHOWNORMAL);
not working?!
the Adobe Reader is in this path...
thanks for help
Well.
You gave a full path instead of a SessionVar.
The \ after Adobe should be \\.
Farewell
09-17-2009, 03:36 PM
hm ok,
what would be the correct Sessionvar?
thanks
Ulrich
09-17-2009, 04:03 PM
You should retrieve the correct handler for PDF files from the registry. This way, you would have the proper syntax, as well as the path to the application, which depends on the version and language of the operating system.
Ulrich
jassing
09-17-2009, 08:53 PM
hm ok,
what would be the correct Sessionvar?
thanks
ShadowUK pointed out the main flaw with the exact code:
Adobe\Reader should be Adobe\\Reader
as ulrich pointed out; you have an underlaying problem with portability of your code. you should use the system to fetch the pdf handler (not everyone may have that exact version of acrobat installed, indeed, not everyone even has acrobat...)
lcPDF = File.GetDefaultViewer("PDF");
if lcPDF and File.DoesExist( lcPDF ) then
File.Run( lcPDF, "/A page=15 bla.Pdf");
else
Dialog.Message("Error","No handler for PDF's")
end
vBulletin® v3.8.4, Copyright ©2000-2010, Jelsoft Enterprises Ltd.