MikeK6MKF Posted March 3, 2015 Posted March 3, 2015 Hi Gang, I am the newest of AutoIt scripting newbies. I just downloaded AutoIt yesterday and am building a prototype of an application. I have my GUI working pretty well with placeholder statements in each Case statement. What I am seeking advice on is how to translate the following Windows command line instruction into AutoIt Run syntax: start AcroRd32.exe /A "page=7" "C:UsersMike-K6MKFDesktopK6TU Predictions_K6MKF MAR 2015UTC_17.pdf" In Windows this starts AcroRd32.exe with the "page=7" parameter and reads the specified .pdf file. Works great, opens page #7. Now I want to do this in an AutoIt script. I've read the Run function description and had a lot of trials and errors - mostly errors. This part works, and starts up Acrobat, but I can't figure out how to pass Acrobat the /A "page=7" open parameter or point it to my .pdf file. Dim $AcrobatPath = "C:Program Files (x86)AdobeReader 11.0ReaderAcroRd32.exe /n" Case $iMsg = $idM80 Run ($AcrobatPath) Any suggestions and assistance will be greatly appreciated. Thanks!
Developers Jos Posted March 3, 2015 Developers Posted March 3, 2015 This should be close: Run('"C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe" /A page=7 "C:\Users\Mike-K6MKF\Desktop\K6TU Predictions\_K6MKF MAR 2015\UTC_17.pdf"') Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
TheSaint Posted March 3, 2015 Posted March 3, 2015 You are probably falling foul of spaces in a parameter, which you overcome using quotes. You could have $AcrobatPath = "C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe" $parameter = ' /A "page=7" "C:\Users\Mike-K6MKF\Desktop\K6TU Predictions\_K6MKF MAR 2015\UTC_17.pdf"' Run($AcrobatPath & $parameter) Note the leading space at the beginning of $parameter Also the use of single and double quotes. To enclose double quotes, you use single quotes or vice-a-versa. You may also need to provide the working directory. But, perhaps using ShellExecute would work better. Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)
TheSaint Posted March 3, 2015 Posted March 3, 2015 Ha, Jos beat me to it. Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)
MikeK6MKF Posted March 3, 2015 Author Posted March 3, 2015 Not just close, but exactly correct, Jos! Thank you very much! Now I can keep working with my prototype until my next obstacle.
MikeK6MKF Posted March 3, 2015 Author Posted March 3, 2015 My thanks to TheSaint for additional information about the Run command. This will certainly come in handy as I continue to learn AutoIt!
MikeK6MKF Posted March 3, 2015 Author Posted March 3, 2015 This statement works great: Case $iMsg = $idM80 Run('"C:Program Files (x86)AdobeReader 11.0ReaderAcroRd32.exe" /A page=16 "C:PredictionsUTC_80.pdf"') My next question is how do I substitute a $page variable for the value 16 in the page=16 parameter expression? Thanks in advance for your suggestions!
TheSaint Posted March 3, 2015 Posted March 3, 2015 (edited) You really should be asking these questions in General Help & Support. There are two main methods, either do StringReplace on 16 Or using something like my earlier code. $AcrobatPath = "C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe" $page = "8" $parameter = ' /A "page=' & $page & '" "C:\Users\Mike-K6MKF\Desktop\K6TU Predictions\_K6MKF MAR 2015\UTC_17.pdf"' Run($AcrobatPath & $parameter) Edited March 3, 2015 by TheSaint Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)
MikeK6MKF Posted March 3, 2015 Author Posted March 3, 2015 OK - I'll head on over there! Thanks for your support!
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