How to make applescript open a program

I am new to Applescript. How can I use it to open a program

Simple:
<pre class=command>tell application "Name of application" to activate</pre>
This will bring it to the front, launching it if it isn't already running.
If you just want it to launch without coming frontmost, change 'activate' to 'launch'.

Similar Messages

  • How to make applescript open more than one program at once?

    Hi! I made the code below to use together with another 2 codes. One that mounts a samba share and another that runs rsync with specific parameters. The script below runs after rsync complete its task.
    The 3 codes help me to test my HTML/CSS/PHP/Javascript code changes.
    This code works but I have to repeat it to each browser/app I want and a 10 lines script becomes 40 lines (Google
    Chrome, Firefox, Opera and Safari). Is there a more elegant way to do that? I've tried to use an array/list but didn't work.
    if application "Safari" is running then
        tell application "Safari"
            activate
        end tell
        tell application "System Events"
            tell process "Safari"
                keystroke "r" using {command down}
            end tell
        end tell
    end if

    Nathan Greenstein already answered in AskDifferent: http://apple.stackexchange.com/questions/54595/applescript-array-of-applications /54598#54598
    Quoting him:
    set browsers to {"Google Chrome", "Firefox", "Opera", "Safari"}
    repeat with browser in browsers
        if application browser is running then
            tell application browser
                activate
            end tell
            tell application "System Events"
                tell process browser
                    keystroke "r" using {command down}
                end tell
            end tell
        end if
    end repeat

  • How to make Applescript open AI then open file then run ExtendScript then close?

    Here's the sample Applescript code I came up with using the scripting guide/reference for CS6 and also doing some online searches:
    tell application "Adobe Illustrator"
        activate
        delay 10
        set pfilepath to "/Users/username/Documents/Temp/someFile.ai"
        set pfile to POSIX file pfilepath
        open pfile as alias without options
        delay 10
        do javascript "#include '/Users/username/Documents/Temp/someScript.jsx'"
        delay 1
        quit
    end tell
    I just want to open the app (sample here for AI but also nice to do same for Photoshop), open a file, then run ExtendScript file against it, then close after processing. With this sample script, all that works is the app launches. No file opened, no script ran, app doesn't close at end. I see no errors pop up nor anything show up in command prompt.
    The sample ExtendScript just triggers an alert popup message for testing
    Also to note, the Applescript snippet is executed from Python but I believe where/how it's executed shouldn't matter (except maybe where the error messages might show up). Although in worse case, I'll debug/run through the AppleScript editor.
    Any tips on what's wrong here? Or does it look technically correct?

    No, I don't have specific documentation, but you can put together such for Python from bits & pieces here & there. And yes, I made it cross-platform to anticipate Adobe users on both Mac & PC, for which there currently are, though for what we're doing skews towards Windows for now.
    For the COM API, follow the VBScript reference and code samples. Just convert the method calls to Python COM. There will be slight syntax differences sometimes (e.g. add "()" to method call for VBScritp subroutines that don't need them, etc.). The scripting guide link below should have code samples for VBScript.
    http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/illustrator/sdk/CC2014/Illustrator% 20Scripting%20Reference%20-%20…
    http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/illustrator/sdk/CC2014/Illustrator% 20Scripting%20Guide.pdf
    For example of Python COM, you can search online, or look at AutoItDriverServer/server.py at master · daluu/AutoItDriverServer · GitHub, which may be bit much/complex for you? For Python COM, you either need ActivePython or regular Python plus Python for Windows Extensions (e.g. pywin32).
    For Applescript and Python, this post might be useful: osx - Calling AppleScript from Python without using osascript or appscript? - Stack Overflow
    for the rest of the the cross-platform support, it's just generic python to parse command line arguments, etc. You may want to query what platform the script is running under using some standard Python modules (os, system). An example can be found in AutoPyDriverServer/server.py at master · daluu/AutoPyDriverServer · GitHub
    Hope that helps.

  • How to make applescript open a new safari window with a specific name?

    tell application "Safari"
      activate
      make new document at end of every document with properties {name:"MY-NAME", URL:"http://www.google.com"}
    end tell
    Run this script and see if you can figure out why the NAME of the window is still "Google".
    The dictionary  shows several different NAMEs for windows, documents and tabs and only tabs are R/O.
    This doesn't do anything either:
    tell application "Safari"
      activate
      make new document at end of every document with properties {name:"MY-NAME", URL:"http://www.google.com"}
      set the name of window 1 to "TEST"
    end tell

    The title of the window is provided by the page source.
    You can override it (once loaded) with, e.g,
         do javascript "document.title='MY-NAME'" in document 1
    If you had a blank Safari page (i.e. not Top Sites which does contain source data), you should be able to change the window title with
         set name of document 1 to "MY-NAME"

  • How to make changes in another program?

    Hi evrybody,
    how  to make changes from one program  to another program ?
    Changes should be reflecting in other program.
    thanx in advance n wud be surely Rewarded if answer is helpful.

    Hi Bharat,
    Thanx for the info.
    But what my requirement is , I'm scanning & reading another report into an Internal table. I want to change the Hyphen's
    '-' used in variable declarations of another program into Underscore '_' .
    My sample code is like this..
    Report Zmain.
    PARAMETERS:
      p_prog LIKE sy-repid,
      p_key LIKE stokex-str.
    Internal Table t_itab                                                *
    DATA:
      BEGIN OF t_itab OCCURS 0,
        line(256) TYPE c,
      END OF t_itab.
    *" Data declarations...................................................
    DATA:
      t_statements LIKE sstmnt OCCURS 0 WITH HEADER LINE,
      t_levels LIKE slevel     OCCURS 0 WITH HEADER LINE,
      t_tokens TYPE stokesx    OCCURS 0 WITH HEADER LINE,
      t_keywords LIKE t_itab   OCCURS 0 WITH HEADER LINE,
      w_i TYPE i,
      w_j TYPE i.
                            START-OF-SELECTION                           *
    START-OF-SELECTION.
      APPEND p_key TO t_keywords.
      READ REPORT p_prog INTO t_itab.
      SCAN ABAP-SOURCE t_itab
      STATEMENTS INTO t_statements
      LEVELS INTO t_levels
      TOKENS INTO t_tokens
      KEYWORDS FROM t_keywords
      WITH INCLUDES
      WITH ANALYSIS
      WITH COMMENTS.
                            END-OF-SELECTION                             *
    END-OF-SELECTION.
      LOOP AT t_statements.
        READ TABLE t_levels INDEX t_statements-level.
        w_i = t_statements-from.
        w_j = t_statements-to.
       IF t_statements-level > 0.
        WHILE w_i < w_j.
          READ TABLE t_tokens INDEX w_i.
          REPLACE '-' WITH '_' INTO t_tokens-str.
          w_i = w_i + 1.
        ENDWHILE.
       ENDIF.
      ENDLOOP.
    My called program is like this....
    Report Zcalled.
    DATA:
      w-var1 TYPE c,
      w-var2 TYPE c.
    DATA:
      fs_flight1 TYPE sflight,
      t_flight1 LIKE STANDARD TABLE OF sflight.
    START-OF-SELECTION.
      INCLUDE zinclude3.
      SELECT * FROM sflight
        INTO TABLE t_flight1
        WHERE carrid = 'AA'.
      SELECT * FROM sflight
       INTO TABLE t_flight1
       WHERE carrid = 'LH'.
    END-OF-SELECTION.
      LOOP AT t_flight1 INTO fs_flight1.
        WRITE: / fs_flight1-carrid,
                 fs_flight1-connid,
                 fs_flight1-fldate,
                 fs_flight1-price.
      ENDLOOP.
    Thanx very much.

  • How to make movies open in the center of my screen.

    Does anyone know how to make Quicktime open up videos in the center of a screen? When I double click any movie file it pops open in the uppermost far left corner, and I have to drag it down into a more comfortable area. It's annoying with a large monitor.
    Thanks
    noodle--head

    The script writing lobe of my brain was damaged by years of drug abuse, years ago. Try as I might, I can't seem to get it right.
    The most common error I get is:
    Expected end of line, etc. but found “end tell”.
    I tried modeling one of any number of existing scripts but still no dice.
    I tried this:
    tell application "QuickTime Player"
    activate
    set the bounds of window 1 to {235, 58, 944, 590}
    end tell
    And got this error message: QuickTime Player got an error: NSReceiverEvaluationScriptError: 4
    I know this is simple but, like I said...
    nnooo-dlehead ssslowto catchon

  • How to make Forms6i Application Install Program?????

    How to make Forms6i Application Install Program?????
    We have finished a Forms6i Application , and need a installer to install software.
    Can I use Oracle installer or must use MS visual C++ to make a installer? I need wirte a register.
    Anything inclued in Form6i Production (IDS) to introduce installer???
    Thank you.

    How to make Forms6i Application Install Program?????
    We have finished a Forms6i Application , and need a installer to install software.
    Can I use Oracle installer or must use MS visual C++ to make a installer? I need wirte a register.
    Anything inclued in Form6i Production (IDS) to introduce installer???
    Thank you.

  • How to make Firefox open automatically a new, empty tab in each start, but keep last sessions?

    How to make Firefox open automatically a new, empty tab in each start? (keep last sessions as well) It will be good, because Firefox wont load the previous sessions last watched tab after start straight away, but keep my previous sessions tab as well in the browser.

    Hello,
    You can change your home page settings to open a blank tab:
    * Tools (or [[Image: New Fx Menu]]) > Options > General
    * Beside "Startup", change to "Show a blank tab"
    * See the article [[Startup, home page and download settings]] for more information
    To retrieve your previous browsing session, first make sure that you are not running in [[Private Browsing - Browse the web without saving information about the sites you visit|Private Browsing mode]]. When you start Firefox, to recover your previous session, you can go to:
    * History (or [[Image: New Fx Menu]] > History) > Restore Previous Session
    * Please see [[Restore previous session - Configure when Firefox shows your most recent tabs and windows]] for more information

  • How to make Finder open automatically...?

    How to make Finder open automatically when I insert external drive?

    Make sure the Finder preferences are set to display hard drives:
    OT

  • How to make links open in new window

    Is it Javascript? How do you make links open in a new
    window.. what's the code and where do you put it, how do you end
    it?

    Target box (below link box0) to "_blank"
    "BenMan 88" <[email protected]> wrote in
    message
    news:e7v4it$jfj$[email protected]..
    > Sorry, this is totally unnecessary and I hope it doesn't
    irritate anyone
    > but thank-you this posting helped me very much.
    >
    >

  • How to make 'always open in ... view' check box actually work?

    What I need is a "Make 'Always open in ... view' check box work" check box.
    Specifically:
    I double click on my hard drive icon to open its window. I press command 3 to make it display in column view. I press command J and check "Always open in column view" and check the further check box, "Browse in column view". Then later on having viewed various windows I double click on the hard drive icon and it opens in some other view than column view. So, how to make the check box do what it actually says it will do?
    Thanks.
    edit: In fact in Panther, and probably other older OS X's, all folders would generally remember (I think) how it was last viewed and use that again. How to make that happen? Thanks.

    Hi,
    For Question #1,
    refer this link.
    Hope it helps!
    Thanks,
    Avni Bhatt
    If this helped you resolve your issue, please mark it Answered

  • How to make PDFs open fullscreen in Adobe Acrobat DS on iPad?

    Hi,
    I'm putting together a corporate interactive PDF, and am struggling to make it open in fullscreen and single page by default on the iPad, despite setting it to do this when exporting. any ideas how to fix this? Thanks.

    That is not possible on iOS (and I presume Android) devices.

  • How to make a simple C program universal from the command line???

    Hi all,
    I've developed widgets that use a simple C program. I had no clue how to make it universal. Apple documentation is all about big projects to be developed inside Xcode and so on, but I don't understand even the introductory remarks...
    As far as I've read, I have to make a binary for PPC and a binary for i386, and then merge it with lipo. Fine. I get my PPC binary from:
    gcc-4.0 prog.c -o prog_ppc -lm -arch ppc -arch ppc64
    Now, it seems that I have to use:
    gcc-4.0 prog.c -o prog_i386 -lm -arch i386
    The latter command didn't work until I added -L/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/ at the end. With this, it creates a binary file, but with the following message:
    /usr/bin/ld: warning fat file: /usr/lib/system/libmathCommon.A.dylib does not contain an architecture that matches the specified -arch flag: i386 (file ignored)
    and I guess this is quite an issue if I don't have the common math functions, no?...
    Can somebody help me? I googled a lot on this, and found nothing helpful.
    Cédric

    Thanks, it helped me. I googled a bit to build up my Makefile, and this is what I got.
    CC= gcc-4.0
    CFLAGS= -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386
    LDFLAGS= -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -lm
    TARGETS= skycalc.fixed.c
    all: $(TARGETS)
    $(CC) $(TARGETS) $(CFLAGS) $(LDFLAGS) -o skycalc_universal
    Thanks again.

  • How to make a trace to program ?

    Hi
    Does somebody can tell me how can i make a trace to program in order to find in wich code point the process is getting 'stand-by' (does not finish) ; that is, in wich DB access, LOOP, etc. the program is making the work wich takes a lot of time.
    I need to discover where are the performance problems and how much the program access the DB with SELECTS.
    Regards
    Frank

    Hi,
    make use of the transaction code ST05 for the trace of database selects, Just press the Trace on button and run your program, and inthe ST05, press the Trace off button and look at the list, you will understand.
    Even you can use the transaction ST04 -> Database performance analyzer
    ST03 -->Workload on the System
    Regards
    Sudheer

  • My Preview icon is locked in the dock; when I click on the Preview icon in the Applications folder, it tells me Preview is no longer open. How do I re-open the program?.

    Preview has sudden;y quit working on my 13" Macbook with OSX Yosemite 10.10.2. It is stuck in the dock with a black dot below the icon suggesting it is open but it is not active. When I try to re-open Preview from the Applications folder on my hard drive it tells me Preview is no longer open. How do I re-open it?

    Log out or restart the computer.

Maybe you are looking for

  • Lost Microsoft Account

    Hi, I disconnected my microsoft account with "live:myLogin" login. My account is gone. How can I recover my old account?  When I log in, it creates a new one with login "live:myLogin_1.

  • Late 2008 Macbook Freezes 5 Minutes into use with newly upgraded Mavericks, works on safe mode; help troubleshooting?

    Hi, I have a late 2008 Macbook - I upgraded it from Leopard to Snow Leopard a year ago and things ran relatively smoothly. A friend suggested I try Mavericks after I have been getting a few error messages with snow leopard and was forced to hard rest

  • Re: "Very Slow Internet On OSX 10.5.5"

    Hello all, I am creating my own thread in response to ones like rogerjth's July 2008, the subject of which was "Slow Browsing with safari 3.1.2 - Any issues to watch out for?" and Roippeli's from Sep. 21, 2008, the subject of which was "Very Slow Int

  • LBS Sample Error

    Hi, Have someone tried 'Sample Demonstrating Location and Customization Features in Wireless Application' at http://otn.oracle.com/sample_code/tech/java/wireless/9iwireless/location/LocationSample.jar? I've got 'service error' in screen of mobile sim

  • How to model subtypes in HR??

    Hi Gurus, In 0HRPOSITION, I would like to add subtypes and resources from the table HRP1010. but when I load the data, its giving me "overlapping time intervals" error. Its bcoz the data is like Position      Validfrom     ValidTo     Subtype     Res