Adson Posted December 21, 2006 Posted December 21, 2006 (edited) Hello, I try to write my first scripts with autoIt and wonder what is the best way to open a pdf file. I used: #include <Process.au3> $rc = _RunDos("start bestellformular.pdf") and this works but I'm not shure if this is the right way and that this will work on every Win 98 to Win Vista PC. By searching in the forum I also found the shellexecute function. Unfortunately this does not work. It seems that this function is not included in my version of autoIt. What is the best method to open a pdf file? Thanks in advance for your help. A. Edited December 21, 2006 by Adson
Helge Posted December 21, 2006 Posted December 21, 2006 ShellExecute requires one of the latest betas/RCs. Get them here.ShellExecute(@MyDocumentsDir & "\AP192_UG_EN.pdf")oÝ÷ Øò¢ìÛh²Ø*.Ë«éí½êìí¯+(ëax%G+ºÚ"µÍÌÍÜXYH ÌÎNÉ][ÝÉÌÎNÈ [ÈÙÜ[Q[Ñ [È ÌÎNÉÌLÐYØIÌLÐXÜØ] Ë ÌLÔXYÌLÐXÜÔÌ^I][ÝÈ ÌÎNÂÌÍÜH ÌÎNÉ][ÝÉÌÎNÈ [È^QØÝ[Y[Ñ [È ÌÎNÉÌLÐTNLÕQ×ÑS][ÝÉÌÎNÂ[ ÌÍÜXY [È ÌÍÜ
MHz Posted December 21, 2006 Posted December 21, 2006 or use a ShellExecute UDF _ShellExecute('C:\document.pdf') Func _ShellExecute($filename, $parameters = '', $workingdir = '', $verb = 'open', $showflag = @SW_SHOWNORMAL) $aRet = DllCall("shell32.dll", "long", "ShellExecute", _ "hwnd", 0, _ "string", $verb, _ "string", $filename, _ "string", $parameters, _ "string", $workingdir, _ "int", $showflag) Return SetError(@error, 0, '') EndFunc
Adson Posted December 21, 2006 Author Posted December 21, 2006 Helge, thanks for your reply. Unfortunately I do not know which version of acrobat reader is installed on the machines where the autoIt.exe should run. The only thing I can do ist to run the pdf file so that it starts with the associated application (acrobat reader). Since this seems to work with the _RunDos function, I will try it with CODERun("mypdf.pdf") Do you know if the shellexecute function has advantages in comparision with the run function? A.
herewasplato Posted December 21, 2006 Posted December 21, 2006 ...I do not know which version of acrobat reader is installed...You won't even know if the user has an Adobe product for the PDF reader: http://www.foxitsoftware.com/pdf/rd_intro.phpSorry, I cannot comment on your RUNDOS vs. ShellExecute question. [size="1"][font="Arial"].[u].[/u][/font][/size]
Stumpii Posted December 21, 2006 Posted December 21, 2006 Use ShellExecute and make sure you are using the latest beta. ShellExecute is basically the same as right clicking a pdf in Explorer and clicking Open, or Edit or Print. ShellExecute allows you to specify a verb that determines what action you want to perform. I would suggest not using Run or RunDOS. Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity.
Adson Posted December 21, 2006 Author Posted December 21, 2006 Thank you very much for your help I will use ShellExecute as suggested. Does the current beta version include a description how to use ShellExecute? A.
Stumpii Posted December 21, 2006 Posted December 21, 2006 Thank you very much for your help I will use ShellExecute as suggested. Does the current beta version include a description how to use ShellExecute? A.Of course. You can also Google ShellExecute for more info. The AutoIt function is a wrapper for the API of the same name. Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now