Jump to content

Very Simple Task - Open a PDF File - How?


Go to solution Solved by BrewManNH,

Recommended Posts

Good afternoon,

I have a valid AutoIt support question and kindly provide the details of my system:

AutoIt Version: V3.3.10.2 [X32]
Windows Version: WIN_2012 [X64]
Language: 0409

##################################################################

I'm a new user with this software, I downloaded it literally hours before the server died for several days, so I wasn't able to ask for help or read forums during that time. 

I'm trying to use AIS to automate a few simple tasks.  Step one is to open a PDF file, and I can't even make it do that.  I've searched the forums.  I watched an hour's worth of 403Forbidden's tutorials and learned a ton of other stuff, but not this.  Everything I'm reading seems to be from very advanced users, and so nobody's addressing the basics that I can find. 

I have made little actions work, and compiled them to EXEs, and most of it's going well.  I can launch programs, do other things, but I cannot open a PDF file. 

I feel like I'm following the documentation, but it's not working.  Can somebody please help me see what I'm doing wrong?  Here is my script.  It launches Acrobat and then nothing.  No errors, no response, nothing. 

Run("C:Program Files (x86)AdobeAcrobat 11.0AcrobatAcrobat.exe")
FileOpen("C:_PODWorkOCTConsolidationScript_DailyAuto1SideCombo.pdf")

 

 

I apologize in advance for the newbie question, I'm not unfamiliar with this type of work, I've dones this and more with similar systems, but they lack functionality that I need in AutoIT so I want to migrate everything over. 

Thanks,

Farns

 

 

AutoIt Version: V3.3.10.2 [X32]
Windows Version: WIN_2012 [X64]
Language: 0409
Link to comment
Share on other sites

Ahh.  Well that would make sense why the open command wasn't working :)  I did just try the Run command, to the path of my PDF, and again, no response.  No errors, no result.  I see Exit Code = 0 at the bottome of SciTE, so maybe I am getting some feedback, I just need to figure out how to interpret that.  I hadn't noticed it before. 

I found a post where the application was defined as a variable, and the file was too, and then a run command to put the two together and make it launch and open the file in the same stroke, but that didn't seem to want to work either. 

If NONE of the commands were working, I'd assume an installation problem or something like that.  But since I can launch apps, that all must be fine, and I'm just to dumb to figure this out :-)  I will keep studying. 

Farns

AutoIt Version: V3.3.10.2 [X32]
Windows Version: WIN_2012 [X64]
Language: 0409
Link to comment
Share on other sites

  • Solution

Don't use Run to open a PDF unless you're using the PDF reader program to open it.

Use ShellExecute to open a file that has an associated executable set to open that type of file. For example if you don't have adobe reader on the PC using acrord32.exe to open it won't work, but ShellExecute will open it with whatever PDF program the computer has associated with it.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Ahhh!  Ok ShellExecute seems to be doing the trick.  I'll dive deeper into my project later this afternoon, but I think this puts me on the right track, BrewMan, thank you! 

I can see this is extremely powerful and flexible software.  99% of it I will probably never use.  All I need it for at this point in my life is to open a file, map some mouse coordinates and clicks, and that's it.  Super simple.  But I will study it's other features and see else I can learn how to make it do!  Thanks so much!

Farns

AutoIt Version: V3.3.10.2 [X32]
Windows Version: WIN_2012 [X64]
Language: 0409
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...