Basic Applescript open command... help!

Hi
I'm completely new to AppleScript (and need to use it for an assignment)
Im being asked to create a script that could be used on any mac that will ask the user to open a file, describe what the file is about, then have that selected file open automatically. As of right now I cant seem to find any script that will allow the user to open the variable/selected file... heres what I have so far:
set variable to choose file with prompt "Please select a file to be opened"
set variable to display dialog "Please enter a short description of this file" default answer ""
tell application "Finder" to open..................
I dont know if Im doing this right, can anyone help?
Another problem Im having is getting the computer to speak to the user telling them that their file which they selected is now opened (once it is).... I understand the say command, but I dont know how string the information from when the user enters the description of the file into the command for the computer to say it. For example, "The file described as (description entered previously by user) is now opened".
Help please!

Try using:
set variable1 to choose file with prompt "Please select a file to be opened"
set variable2 to text returned of (display dialog "Please enter a short description of this file" default answer "")
tell application "Finder" to open variable1
say "The file described as " & variable2 &" is now opened."
(56982)

Similar Messages

  • Illustrator Applescript open command is broken

    Hi, Scripters have been doing many different things with Illustrator over the years. One of the things that allows that is the ability to open the files we need to process. Many things could prevent a file from opening, so the open command has a nifty dialogs parameter, that allows a scripture to ask Illustrator to open a file but regardless of any issues, prevent a dialog from opening. On top of that, Illustrator can be asked to not display any dialogs at all with the user interaction property.
    Alas, the new Illustrator has a missing fonts dialog box that will not go away. It has the TypeKit logo at the top, so many folks, me included, got annoyed with TypeKit, but that was misplaced.
    Adobe: If we can't confidently ask AppleScript to open a file without it, well, not opening, we are kind of screwed.
    Please put someone on this task: When the open command is invoked with the dialogs parameter set to false, do not show the Missing Fonts dialog.
    It has to happen and it has to happen quickly.
    Thanks! Happy-scripters everywhere.

    Aloha Hanaan, me old partner in crime...
    Alas, ill-mannered dialogs have always been a problem with AI. Super annoying, but then I read about all the other horrors Adobe perpetrate on their scripting users and am personally quite glad they leave AI's Apple event support largely alone.
    I'm not familiar with this particular dialog (I'm currently still slumming it on CS6 for development purposes), but I have had the exact same problem in the past with Universal Type Server's "missing font" dialogs, which don't respect any of AI's user interaction settings either. I've even had problems with AI itself throwing up "swatch conflict" dialogs when duplicating content between documents.
    To what extent these missing font dialogs are AI's fault versus the font manager's fault I couldn't say offhand. I'd have to spelunk the AI SDK to see if it provides any hooks for plugins to determine AI's current user interaction settings prior to throwing up dialogs and/or instructs plugin developers to respect those settings, and frankly if I wanted to deal with AI's C* APIs I wouldn't be using its scripting interface in the first place.
    Either way, as W_J_T says, you need to submit a bug report directly to Adobe if you even want them to be aware of the issue. Whether they'll bother to fix it, who can say... the entire AppleScript world ain't exactly blooming with health these days, so I doubt a fix will be high priority assuming it's even practical.
    In the meantime...
    The workaround I used was to create a separate 'dialog monitor' service that my AI scripting code would activate before performing a command known to trigger badly-behaved dialogs, then deactivate again once the troublesome operation was done. While running, the service would use GUI Scripting to poll the state of AI's GUI every second or so, and if it detected the appearance of a dialog would figure out what type of dialog it was and click the appropriate button to dismiss it.
    Obviously, this logic had to be individually coded for each type of dialog encountered, could be a tad fragile (though I did my best to make it cope with stuff like window order changing), and tended to require updating when new versions of software were installed. But it worked well enough
    As this was all running on a headless Mac, I also wrapped the problem command in a try statement that'd catch any "timeout" errors, take a screenshot of AI's UI so I could see what (if any) dialogs were displayed at the time, then kill -9 the AI process and email me a full error report before restarting AI and proceeding onto the next job as normal. That way, any time the system got stuck on a dialog I'd not seen before, I had lots of troubleshooting info available to diagnose the problem and start working on the solution for that.
    Being a Python weenie I just used a background thread to run all this stuff, but as an AppleScripter it shouldn't be any harder for you to write a stay-open 'dialog monitor' applet that does the UI polling from its `idle` handler. Just have your main script run and quit the monitor applet when needed, and mind and have it deal with any timeout errors as appropriate should your dialog monitor be unsuccessful in dismissing a dialog before the command gives up.
    HTH
    has

  • Applescript SAY command help needed

    AS newbie ...
    Currently I don't have a way to stop this speaking in the middle - CMD
    period does not help.
    Is there a way that applescript can maybe loop and break this into
    smaller chunks and check every 5 or 10 words if a key like CMD-period
    is pressed and if so stop the speaking loop?
    EX.
    set thisstuff to "a very large paragraph of text - bigger then this
    example. a very large paragraph of text - bigger then this example. a
    very large paragraph of text - bigger then this example. a very large
    paragraph of text - bigger then this example. a very large paragraph
    of text - bigger then this example."
    say thisstuff

    Hi,
    This script allows you to press (Command + period) keys
    set thisstuff to "a very large paragraph of text - bigger then this
    example. a very large paragraph of text - bigger then this example. a
    very large paragraph of text - bigger then this example. a very large
    paragraph of text - bigger then this example. a very large paragraph
    of text - bigger then this example."
    set pID to do shell script "say " & (quoted form of thisstuff) & " >/dev/null 2>&1 & echo $!"
    try
        repeat while ((do shell script "/bin/ps -p " & pID & " | wc -l") as integer) = 2
            delay 1
        end repeat
    on error -- user press CMD-period
        do shell script "/bin/kill " & pID & " >/dev/null 2>&1 &" -- stop the speech
    end try

  • Error message HKEY_LOCAL_MACHINES\software\classes\quicktime\qt\shell\open\command

    hi all
    been given as a birthday prezzy an i pod touch, i tunes and quicktime refuses to install but can download , keeps coming up wth the following error msg.
    HKEY_LOCAL_MACHINES\software\classes\quicktime\qt\shell\open\command
    help!!
    alan

    Hello, I am having a similar problem as described here. Except there are a series of other registry keys with restricted access. In an attempt to completely uninstall quicktimes to reinstall with itunes 7, I tried deleting these registry keys and was unable. I found this post and tried to change permisions and was still unable. the error messages I recieve when I try to install quicktimes stand-alone or itunes
    iTunes + QuickTime
    Error 1905.Module C:\Program Files\QuickTime\QTOCONTROL.dll failed to unregister
    HRESULT -2147220472. Contact your support
    personnel.
    plus a few others like this one with slightly varrying keys, then the installation continues before a final error message appears and closes the installation
    Could not open key:HKEYLOCALMACHINE\Software\Classes\QuickTimePlayerLib.QuickTimePlayerApp\CLSID. Verify that you have sufficient access to that key, or contact your
    suppoer persoannel.
      Windows XP  

  • Applescript Summarize Command - how to process PDF files?

    I'm stuck in applescript...I'm putting together an applescript that reads a set of PDF files in a folder and returns each PDf file summarized using the applescript summarize command.
    Can't ssem to wrap my head around the logic needed....Any help is much appreciated!

    I come close but need more help
    on run
        choose folder with prompt "Which file would you like  size calculated?"
        open {result}
    end run
    on open user_Choice
        tell application "Finder" to set xx to every file in item 1 of user_Choice
        repeat with a_File in xx
            set tot_size to size of (info for user_Choice)
        end repeat
        display dialog "file size" & size of (info for user_Choice)
    end open
    --size of (info for the_file)

  • Hyperlinks from my MSWord files suddenly don't work because "/FirefoxHTML\Shell\Open\Command" has somehow been added to the end of each URL.

    When I click to open the hyperlink in my Word file, the message I get in Firefox is "The requested URL /submissions.htmlFirefoxHTML\Shell\Open\Command was not found on this server." When I delete that portion of the URL, the website opens fine. What can I do to make the hyperlinks work properly?

    Thanks for the suggestion. I tried it, but it didn't work. The link information is written correctly on the MSWord page. But when I click on it and the Firefox tab opens, the page can't be found because "FirefoxHTML\Shell\Open\Command" has been added to the end of each URL. Might it help if I reset Firefox?

  • I updated my pages app on my ipad and when I tried to open a document it says the file format is invalid. None of my documents are opening pleaser help!

    I updated my pages app on my ipad and when I tried to open a document it says the file format is invalid. None of my documents are opening pleaser help!!!!

    Try this. It worked for me.
    I discovered the same problem.  I had an older version of Pages on my iPad. After updating it to the latest version all my previous documents created in pages for the iPad were rendered unreadable and a message stated that they were an invalid format.  Why for the life of me would a program that was created by Apple and sense updated not be able to read previous versions...well that's a whole other sad story.  Any way I discovered how to fix it but it would require that you had backup your iPad on a computer and not emptied your trash. If this sounds good than here is how you fix it... And it worked for me.
    These steps will enable you to reinstall a previous version of the Pages app so you can be able to read and edit older documents.
    FIRST: if you did backup your iPad using your computer and did not empty your trash, GOTO the trash and look for PAGES 1.4 (or other number) ipa ( that's the file extension) ie PAGES 1.4 ipa.
    SECOND: move that file out of the trash and onto your desktop.  Once you do this, double click on it and a box will come up stating a newer version has been found and do you want to revert back to older version. ANSWER YES. It will than automatically place and overwrite the older version back into the file on iTunes that contains the rest of your backed up apps.
    THIRD: and this is where it is important that your backup would have to have been on your computer. I'm not sure if backup on the cloud will work.  iCloud backup at your own risk And here's why. Before you restore you will need to remove the latest version of Pages off your iPad by doing the usual : holding down the home button until the apps wiggle and remove by pressing on X on app.  Removing off your iPad will also delete all your documents but if you have a previous backup on your computer those documents will be stored safely on itunes and will return.
    FORTH: plug your iPad into your computer and allow it to sync so iTunes will recognize it. Once iTunes is up and you can see that it recognizes your iPad, GOTO "FILE/DEVICES/RESTORE FROM BACKUP."  ******* DO NOT CLICK ON BACKUP***** click on RESTORE FROM BACKUP. This will reinstall all previous settings and documents that were their when you backuped PLUS the older version of Pages that you placed back from the above steps. Let it run through all the setups ( this could take up to 20 minutes...depending on amount of data and photos and apps).
    FIFTH: Once everything is reinstalled a message will popup on your computer stating "to leave iPad plugged in until iTunes recognizes it again" ( it's basically rebooting itself).  Once done (leave iPad plugged in still) GOTO iPad and follow the steps. IMPORTANT:  iPad will ask you if you want to SET IT UP AS A NEW IPAD, BACK UP FROM THE CLOUD or BACK UP FROM ITUNES.....press SET UP AS NEW IPAD. Follow all of the steps required. Once complete GOTO iTunes on computer, look for "IPAD" plus a little arrow ( should be on upper right corner of iTunes window, click on it ( this will safely disconnect your iPad from iTunes) . Now unplug iPad from computer and go to your iPad and look for the older version of Pages. It should be there along with all your old documents ( readable and editable too).
    Hope this helps. Good luck.

  • Open a command window and send some keystroke to the opened command window

    Hi All,
    I am trying to open command prompt and send some key stroke to that command prompt. Here I am using Robot to send keystroke. But the problem is, the keystrokes are not sent to the prompt. I guess I need to activate progamitically the command prompt to accept the keystrokes . Please find the code below ( as I did).
    try
    String command = "cmd.exe /c start";
    Process child = Runtime.getRuntime().exec(command);
    Robot robot = new Robot();
    Thread.sleep(5000);
    String lol = "indranil";
    for(int i=0;i<lol.length();i++)
    robot.keyPress(lol.charAt(i));
    int g = lol.length() - 1;
    robot.keyRelease(lol.charAt(g));
    catch (Exception e) {}
    I guess I am doing some mistake here while sending the keystroke/openning the command prompt. Can anyone please help me how can I open a command window and send some keystroke to the opened command window. I am in fix.
    Thanks,
    Indranil

    The first thing to do is read the API and examples for the Robot class.
    Also check out this thread with a similar discussion: [http://forums.sun.com/thread.jspa?threadID=5385677]
    The short spoonfed answer - keyPress() and keyReleaseI() do not take chars. Read up on KeyEvent

  • Where are the settings for the "open" command, located at /usr/bin/open?

    I have Windows XP installed on a partition on my Macbook and I use Parallels to access some of the Windows applications.
    When I am in Mac OS X, and I don't even have a virtual machine running, if I enter the following command in the terminal, I get some really strange behavior:
    /usr/bin/open -a firefox http://localhost/~myname/somewebpage.html
    The open command will launch firefox within Mac OS X and display the page, but, it WILL ALSO TRY TO LAUNCH FIREFOX VIA PARALLELS. So, it starts a Parallels session and tries to launch Firefox. I see the Firefox icon in my dock twice, once normally, and once with the Parallels version of the Firefox icon. But, I cannot view the Parallels instance of Firefox.
    In order to debug this, I removed Firefox from Mac OS X (deleted Firefox.app from my applications folder) and I un-installed it from the windows partition using Add/Remove programs in windows.
    Now, running the open command as stated above launches Safari in Mac OS X and it still launches parrallels.
    Where is the list of application associations that the "open" command uses? I assume there is some incorrect associate that is causing this but, I have no idea how to find it.
    Thanks in advance for any advice you can give.

    Thank you for your reply.
    I actually checked out the man page for "open" but, I was unable to find LaunchServices in the finder. I was hoping there would be some sort of manifest, or application map, within LaunchServices that might be the source of my problem.
    Regarding using the full path: Good suggestion. That will clear it up when I use the command line, or if I were writing my own app, etc...unfortunately, I became aware of this problem because Netbeans is using the command in the abbreviated form I posted above (to launch web applications I am debugging), and I can't edit it.
    I removed Firefox from both Windows and Mac OS X on my machine, and tested the Netbeans functionality, it launched my application in Safari with no errors. I reinstalled Firefox on my Mac OS X partition and selected it in Netbeans preferences as the browser to use when debugging an app. When I tried to debug an application in Netbeans again, I got the same behavior...parallels launched. Ugh.
    There was a folder, on the Windows side of things, called something like Parallels\Shared Applications. It had a shortcut to Firefox in it but, I removed that before doing my testing. I was hoping there would be something similar on the Mac OS X side but, I haven't been able to find anything.
    Thank you both for your help. I think I might need to visit the Parallels forums for this one.

  • Cmd+M open online help instead of minimize in dock

    Hi,
    At work we just change computers and now, for and unknown reason, when I do "command+M" in Acrobat 9 Pro with an open document, it opens the online help instead of minimizing the document in the dock. I don’t know if it changes something, but we have french acrobat (we had english one on our old computers).
    This is actually pretty annoying and I hope one of you will be able to help me with that.
    Thanks!

    No, there is no override and, actually, I forgot to mention something pretty weird. In the Acrobat's menu we can see shortcuts, and it is written that shortcut for help is F1 and shortcut for minimize is cmd+m... and as I said, when I do cmd+m or F1, it opens online help, and I didn't find a shortcut that minimize yet.
    I just try it at home on my iMac. I also have Acrobat Pro french, and it does exactly the same thing. Cmd+m and F1 open online help, and no way to minmize with a shortcut.
    Lol, maybe I'm just crazy? or my computers are.
    Sooo weird...

  • How to pass command-line options to app using the "open" command?

    I am using jedit, and since I'm doing a lot of stuff in a shell, I'd really like to launch it from the command line as though I'd opened from finder, so I wrote a script that contains this:
    open -a /Applications/Jedit.app "$@" &
    This works well for everything except NEW files, where I get this error:
    2007-02-16 19:29:48.072 open[1032] No such file: /Users/millerti/projects/ateon/new_file
    Is there a way I can override this?
    So, it occurred to me that I might try running jedit directly this way:
    /Applications/Jedit.app/Contents/MacOS/jedit -- "$@" &
    The trouble is that this suffers all sorts of weird problems. For instance, if there's already a jedit running, it launches another one (despite the fact that -server is default). Moreover, the file it opens, existing or not, is not the one I specify. If I'm in ~/mydir and I open ./myfile, jedit opens instead /Applications/myfile.
    Obviously, I'm doing something wrong. Can someone help me figure out what open is doing internally so that I can launch jedit compatible with how open does it so that I can both open existing files and create new ones the same way from the command line?
    BTW, I can make more complex script.
    Also, if this isn't the right forum for this, can someone tell me where would be a better place to get the question answered?
    And I'm not expecting to get jedit support here. This isn't a jedit problem because it's behaving correctly.
    Thanks.

    Applications rarely take command line arguments. I don't know anything about Jedit, whether that is an exception, but you are not sending an argument to Jedit with the open command. The file name on your command line is an argument to the open command. The open command says "open this file with the specified application". The application doesn't see the argument. It sees the file exactly as if it were opened from the Finder. That's why naming a non-existent file doesn't work.
    What if you open Jedit with no file, create a new document in the application. (Again, I am not familiar with Jedit.)

  • PSE 5 Error "could not complete the open command because of a program error"

    I have been using PSE 5 for years but all of a sudden when I try to open multiple files "could not complete the open command because of a program error" appears.  I have reformatted my computer and reinstalled all programs & updates but still get the error.  I am trying to access photo files in a specific, user created, directory on my computer; the funny thing is that if I access files in the My Documents\My pictures\ Sample pictures folder I am able to open all the files.  Any and all help or suggestions are welcome.  Thanks

    When you choose liquify command it says "Could not complete the Liquify command because of a disk error." so nothing at all happens other than the error message
    There is plenty of room on my scratch disks --lots of it
    Tried using a smaller selection using Marquee Tool to outline a smaller area near where I want to Liquify.  makes no difference.  tried a small file as well.  no ability to use liquify.
    This is really weird.
    keep probing the depths of your mac ideas, as I am going a bit nuts with this, friends

  • Odd trackpad behavior, opens Command+ F in any program.

    I have an odd behavior on my Mac that's starting to get pretty annoying.
    I have a late 2009 model. If I am in say Safari, and I wiggle my finger near the bottom of the track pad, (wiggling up and down on the bottom center edge of the trackpad) it opens up the search bar for Safari.
    Basically Command+F.
    If I am on the desktop (Finder) and do the same action it opens Command+ F once again, this time just in Finder.
    In iTunes, the same motion on the trackpad puts me in full screen, which is, you guess it. Command+ F.
    I have tried to get rid of this behavior by terminal commands killall Finder, killall Dock, and also by moving the user/library/preferences folder contents to the desktop, so that programs rewrite their preferences, but everything still has the same behavior.
    Any ideas?
    - Pixel -

    Never heard of anything like it, frankly. Run the Apple Hardware Test you'll find on one of the DVDs that came with your MBP, and make an exact note of any errors it reports. Then make a Genius Bar appointment at an Apple Store and demonstrate the problem to the Genius. Also show the Genius the text of the error report (if there was one).

  • I Lost my BASIC tool bar command. I Need to get it back, please !!!

    Hi ! Good Morning ! Last week I Had a problem and you guys helped to fixed it. Today, one again I have the same problem and I don´t remember how to fix it.  I Lost my BASIC tool bar command. I Need to get it back, please !!!

    Missing Panels/Modules - Lightroom Forums

  • Help! iWeb won't open properly after I updated to Yosemite. No old websites, no workspace- nothing is displayed even when the app is open. HELP!

    Help! iWeb won't open properly after I updated to Yosemite. No old websites, no workspace- nothing is displayed even when the app is open. HELP!

    To open your domain file in Lion, Mountain Lion or Mavericks or to switch between multiple domain files Cyclosaurus has provided us with the following script that you can make into an Applescript application with AppleScript Editor. Open Script Editor, copy and paste the script below into Script Editor's window and save as an application.
    do shell script"/usr/bin/defaults write com.apple.iWeb iWebDefaultsDocumentPath -boolean no"
    delay 1
    tell application "iWeb" to activate
    You can download an already compiled version with this link: iWeb Switch Domain. Note:  you may have to Control (right) - click on the app after uncompressing and select Open due to the Sandboxing feature of OS X.  If you have problems with the app create your own with AppleScript Editor.
    Just launch the application, find and select the domain file in your Home/Library/Application Support/iWeb folder that you want to open and it will open with iWeb. It modifies the iWeb preference file each time it's launched so one can switch between domain files.
    WARNING: iWeb Switch Domain will overwrite an existing Domain.sites2 file if you select to create a new domain in the same folder.  So rename your domain files once they've been created to something other than the default name.
    NOTE: In Lion and Mountain Lion the Home/Library folder is now invisible. To make it permanently visible in Lion or Mt. Lion enter the following in the Terminal application window: chflags nohidden ~/Library and press the Return key - 10.7: Un-hide the User Library folder.
    For Mavericks and Yosemite go to your Home folder and use the View ➙ Show View Options menu to bring the this window:

Maybe you are looking for

  • Jumpstart across 2 subnets

    I have an E220R as a jumpstart server with 2 lan cards in it. Firstly I installed the machine and setup Jumpstart on solaris 8 and all was fine I could jumpstart all my machines with no problem. I then added a second lan card and put it on a seperate

  • Loading external data

    This question was posted in response to the following article: http://help.adobe.com/en_US/air/html/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7cfd.html

  • How to create search help for Maintanence View

    Hi, I want to create a Search Help for a Maintanence View and bring Conditions in this Search Help. Condition can be as e.q. Show me only the Records with Status 2. How can I achieve this? Thanks. Best Regards Beserithan Malabakan

  • Error during the WebLogic 6.0 SP2 installation

    Hi all, It occurs a error during the installation of the WebLogic SP2 to HP-UX. Can someone help me. Many thanks Create System Password Invocation of this Java Application has caused an InvocationTargetException. This application will now exit. (LAX)

  • MI Client 7.1 on Laptop throws error

    Dear Team, I am trying to install MI client on my laptop and get an error, Connection closed. Server returned exception: java.net.ConnectException: Connection refused: connect When I check the technical details, I get the details as below. java.net.C