How do you force a file to be opened by a particular application?

I have come across a brick wall - I have either missed something important, or maybe it is just something in Applescript not working as it should.
In our school, we have both Preview and Adobe Reader installed on the student computers, which are being managed with Workgroup Manager. There is a particular PDF file which is opened through an Applescript which gives a list of files to choose from (the easiest solution for the situation, which does involve a few variables). Sometimes the file opens in Preview instead of in Adobe Reader. The PDF contains sounds, which Preview doesn't handle, hence the need to open it in Adobe Reader. Rather than going round to many dozens of computers and setting the "open with" info on each computer individually, I thought I would try an Applescript solution. In the example below I have moved the file to the desktop to minimize clutter, but the behavior is the same regardless of where the file is (with the appropriate pathway for its location, of course).
This first script works with no problems, except that it may default to Preview instead of Reader, depending on the setup on the individual computer.
tell application "Finder"
activate
select item "SampleFileName.pdf" of desktop
open selection
end tell
When I consulted the library for Finder, I changed it to the following version which, as far as I can tell, has the correct syntax, etc. However, it comes up with the error message - "Finder got an error: Handler can't handle objects of this class"
tell application "Finder"
activate
select item "SampleFileName.pdf" of desktop
open selection using application "Adobe Reader 7.0.8"
end tell
I have tried the same thing with a generic text file (file name ending in .txt) hoping to use Microsoft Word or Excel, and also using 'open "SampleFileName.pdf" ' directly rather than selecting it first, but I still get the same error message.
Does anyone know what is going on and hopefully know how to fix or work around the problem?

Thank you, Niel.
I tried the script with the file in its final location (to test it out under the actual conditions, as sometimes things on the desktop seem to need different treatment - but that's for another post). It worked like a charm!
I had tried viewing Adobe Reader's dictionary, but it is not scriptable. Your suggestion got around that limitation.
The final script, as per your info, is:
tell application "Adobe Reader 7.0.8"
open file "Users:SampleFile.pdf"
end tell

Similar Messages

  • How do you force a client to refresh and use the latest application revision?

    I've tried the action 'Application deployment evaluation cycle' but this doesn't seem to do the job in a timely manner.
     The AppEnforce.log still references a revision that has been deleted on the server...
    Thanks
    David

    If it's a machine targeted deployment you should use the Machine Policy Retrieval & Evaluation Cycle
    and if it is a user targeted deployment you should use the User Policy Retrieval & Evaluation Cycle.
    My Blog: http://www.petervanderwoude.nl/
    Follow me on twitter: pvanderwoude

  • How do you force itunes comments to ID3 tags in MP3 files?

    I have comments all throughout itunes. The mp3 files do not have those comments in the ID3 info.
    How do you force itunes comments to write out to ID3 tags in MP3 files?
    The folder and files all have write permission.

    Yeah, don't do that, you probably also degrade the sound quality... If you've confirmed it is something odd with multiple tags try this.
    Select a group of mp3 files (You might want to start with a smart playlist so you don't mess with any other format)
    Right-click and use Convert ID3 Tags > None (may need to repeat this step if multiple tags)
    Then right-click and use Convert ID3 Tags > v2.3 (v2.4 support still patchy from various accounts)
    Downside is that it will lose any embedded artwork, but it should preserve all other meta-data, both tag-based and stored within the library itself.
    In fact, if you use my CreateFolderArt script before and after updating the tags it should archive any artwork as a local Folder.jpg image for each album and then reinsert that image on the subsequent run... Check it out on a single album first. If it doesn't work as expected let me know and I'll tweak the script to achieve this end.
    tt2

  • How do you delete .pdf files?

    How do you delete pdf files from android Adobe Reader?  I  can delete the files, how do I
    delete the file name from the Adobe Reader file list, especially duplicate file names.
    someone  please help me. this will have to be done from  within the Reader, I  think. ?

    The full instructions are here: http://learn.adobe.com/wiki/display/readermobile/Android+FAQ.
    Ben

  • How do you delete a file from an iPad?

    How do you delete a file from an iPad?
    There are 2 versions of a document file on my iPad.
    I want to get rid of the obsolete one.
    The iPad Users Guide does not describe how to delete a document file.
    This is very frustrating!

    The iPad Guide is for the iPad itself, not other apps you may install.
    If you use Pages then read the online help here: http://help.apple.com/pages/ipad/2.2/ - specifically this: http://help.apple.com/pages/ipad/2.2/#/tancfc4d5c02
    Delete a document from your iOS device
    In the document manager, tap Edit.
    When the documents begin to jiggle, tap the ones you want to delete.
    Tap , then tap Delete Documents.To cancel, tap anywhere in the document manager background, or tap Done.

  • How do you select multiple files to drag

    How do you select multiple files to drag from one folder to another? Is there a command?

    Open the folder which has the contents you want to transfer.  Press COMMAND 'A' and then all of the data should be highlited in blue.  Drag it to the new folder.
    If only certain files are to be transferred, then you have to select them (COMMAND 'A')  individually and the drag them as a group to the new location.
    Ciao.

  • How do you select multiple files at one time

    How do you select multiple files at one time

    Select one, and then either command-click another, or in list/column view, Shift-click the item at the other end of the range you want to select. Alternatively, click on a spot in the screen and drag the cursor until all the files are selected.
    (114308)

  • How do you share Aperture file across multiple users on same Mac?

    How do you share Aperture file across multiple users on same Mac? Seems this should be a preferences choice.

    When you share your library between users, you may run into permission and ownership problems, if both users are editing the Aperture library and not only reading it. To avoid that, it helps to put the Aperture library onto a separate disk or a separate partion of your hard drive. For s separate partition or disk you can enable the "ignore ownership on this volume" flag. Then all users can access the library as owners of this library.
    You might try to put the aperture library into a shared folder on your mac, but that has caused problems recently, i.e. when the library also contains video files.
    Regards
    Léonie

  • Not sure if Mavericks is worth the effort of downloading and I prefer mountain lion.  How do you make a file in Finder.

    I am not sure if Mavericks is much better than Mountain Lion as an OS.  The maps part was okay but I could not view the map as shown on the apple website, there was no 3D.  How do you create a file in Finder on the MacBook Pro.?

    Duuuuuuuuuuuuuuuuuuuuuuuude!!!!!!!!!!!!  YOU DID IT!  I cannot believe it!
    I changed "Move To Trash" to "Move to Trash" and selected a file.  I had lost all hope, so I took a minute to prepare myself for yet another moment of deep frustration.  Then I pressed F10, and bang! the file was trashed!!!  It took me a couple minutes to actually believe what just happened.  Thank you so much!  If I could, I would "like" you as many times as I can physically hit the "Liked" button!
    PS: what the heck is wrong with Apple though???  Wrong instructions, incorrect help instructions on their own site.  The chances of figuring this out before having a nervous breakdown were like one in a million (approximately, I did not actually do the math).  Last week, the keyboard and the trackpad stopped responding on my brand new macbook pro for a couple hours. I was not the only one with this problem.  Apparently, this was from a design flaw, which means it could happen again at any time.  iMovie doesn't work.  TextEdit keeps crashing all the time.  Emptying the trash can take hours. 
    Since 2000, I bought a PMac G4 Quicksilver, a used PMac G3 Blue, a used iBook G4, a used Pismo PBook G3, a used Graphite iMac G4, a used iMac G3 (green, 233MHz I think) and I already had more problems with this brand new macbook pro than will all the other macs combined...  For such an expensive machine, with 16GB of RAM, that's a little dissapointing, especially from Apple.  Maybe I'm just not lucky.
    Anyways, thanks again!  Best moment of 2014!

  • How do you separate corrupt files from good files on a external hard drive importing them to my macbook pro

    how do you separate corrupt files from good files on a external hard drive importing them to your macbook pro

    You open them one at a time into thier respective programs and see if they are good or not and then send the bad ones to the Trash and the good ones to the appropriate folder.

  • HT3847 how do you determine a file is "empty"?

    I have somehow duplicated all my iTunes files... thereby taking up valuable space on my harddrive. This was caused by moving my iTunes "music, etc" back to the harddrive after using an external HD for a long time.
    I have read the article saying something about files being in "ITunes Media", rather than just "iTunes". So, it seems that I should just be able to remove all duplicates that have the path without "iTunes Media".  HOWEVER, I am not able to find the FOLDER called "iTunes Media" on my harddrive... which seems it should be in the "Music" folder. 
    Any guidance would be appreciated.
    Thanks.

    deb from sd wrote:
    HOWEVER, I am not able to find the FOLDER called "iTunes Media" on my harddrive... which seems it should be in the "Music" folder. 
    The iTunes Media folder is located in the /Music/iTunes/ folder.
    Everything in iTunes is in /Music/iTunes/ folder.
    deb from sd wrote:
    I have somehow duplicated all my iTunes files... thereby taking up valuable space on my harddrive. This was caused by moving my iTunes "music, etc" back to the harddrive after using an external HD for a long time.
    How did you "move" the files?

  • How do you have a file automatically open in mail, like a Constant Contact email?

    How do you have a file automatically open in mail, like a Constant Contact email?
    Thanks,
    Lauren

    If there is a way to automatically open an attached file in a Mail item, it is not one that I would use, because I want to stay in control of my Mac!  Who is it from, whats in it and so on... To me bad idea but then the choice is yours.

  • How do you consolidate audio files in Premiere? (Make multiple audio files on a track one file)

    How do you consolidate audio files in Premiere? (Make multiple audio files on a track one file). Also, my client is having a hard time making an omf that Pro Tools can read. The files can not be found by Pro Tools. How do you make an omf that Pro Tools can read?

    Multichannel export;
    http://strypesinpost.com/2012/11/exporting-multichannel-quicktimes-in-premiere-pro/
    When you export the OMF, select Encapulate Files in the Settings window

  • How do you force LR to start in 64 bit?

    How do you force LR to start in 64 bit?
    I have Windows 7 64-bit and also downloaded LR 64 bit. But I don't see "x64" in the LR title bar. http://helpx.adobe.com/lightroom/kb/optimize-performance-lightroom.html
    Can you force LR to start in 64 bit mode?

    The Lightroom Installer has both 64bit and 32bit included and should automatically install the correct version. I can think of two ways to see which one is installed on your system. a. Click on the Start button and look under All Programs and it should show what version is installed. b. From the Lightroom main menu bar click Help > System Info and the dialog box that pops will display the details of your system and the software running i.e Lightroom.

  • How can you back up files that are on an external drive?

    How can you back up files that are on an external drive?

    hw999 wrote:
    How can you back up files that are on an external drive?
    Easy way, CLONE IT to another HD
    HD cloning software options:
    1. SuperDuper HD cloning software APP (free)
    2. Carbon Copy Cloner APP (will copy the recovery partition as well)
    3. Disk utility HD bootable clone.
    Methodology to protect your data. Backups vs. Archives. Long-term data protection
    https://discussions.apple.com/docs/DOC-6031
    hw999 wrote:But all I want to do is include the data that I store on an (second) external drive (internal drive getting too full) part of the auto back up process using timemachine.
    BAD IDEA
    You want one backup (ie Time machine) and one (or more) data archive of just all your raw files (drag and drop, or cloned etc.)

Maybe you are looking for

  • Help needed to do port forwarding in ipfw...

    For the last weeks I have been working to get the new open-source content management system Alfresco working. It is a pure Java web application that runs under Tomcat. There is official support for Mac OS X but only Windows and Linux gets true instal

  • Best way to create a GUI questionaire

    Hello everyone What is the best way to go about building a GUI based questionnaire? with questions and line for the answers.? Thanks for the answers.

  • Nokia N73-HELP -RESOLVE PROBLEMS

    Hi, I have the nokia N73 first version (128 Sd card). 1.The phone hangs occasionally.I would need to remove the battery and put it back to get the phone to normal. 2.I get the message memory full.So i would like to know if i could get a new 2gb SD ca

  • Weird invisable indent/tab

    Dear anyone, Does anyone else have a problem with a weird "space" that makes your text indent to the right? Like, no matter how much you move your text box around, the "space" stays in the same spot and your words just flow around it (like text wrap)

  • Need Help With Something In ICloud Program

    I am trying to figure out if there is anyway possible I can save all my photos into ICloud? I keep looking on the Apple homepage and all it talks about is photo storage in ICloud.  I can't even find anything in my ICloud about photo storage. If anybo