I am using a script and I have a secret code to input within the script (If that makes sense) after I input the code, it is supposed to open the script within the application, the main.scpt. I don't know how to do that considering that I am an amateur so I thought I should ask the pros. How do I open a script that's inside the application's packaged contents using applescript

here is the script im tryna use. I feel like Im being stupid. It may help to know that I am trying to open the same script in the application Im running. I made a secret message to use in a textbox to open the script to edit it, but it says Apple Event Timed out. Can I run an application and open the script at the same time? Swipe to the left of the code to see the whole thing. Here it is-

if mainReturned = "∆" then -- Special keyword that opens the script
    display dialog "Keyword '" & mainReturned & "' is being executed." buttons {"OK"} default button 1 with title "Maccist Auto-Web" with icon file "Macintosh HD:Users:<Insert User>:Documents:robot-icon.png" giving up after 1
    open file "Macintosh HD:Users:<Insert User>:Desktop:<Insert Name of Application>:Contents:Resources:Scripts:main.scpt"
    with timeout of 600 seconds
    end timeout
end if
  • What prevents a user without the secret code from running the second script directly? Feb 11, 2019 at 23:46

2 Answers 2


From within an Applescript, the command:

run script "SecondAppleScript.scpt"

will run SecondAppleScript.scpt

  • Fun fact: I literally guessed the syntax for this, and got it right on my first try. Applescript code can be amazingly close to normal English, at times. Shame it tends to fall apart as scripts become more complicated... Feb 11, 2019 at 23:49
  • I mean I wanna open the script that I'm running
    – Londres
    Feb 12, 2019 at 1:16

You said you needed to open the script in AppleScript:

tell application "Script Editor" to open file (POSIX path of (path to me))
  • I did that already... sorry it didn't work. But thank you for your input and your determination to help me!
    – Londres
    Feb 12, 2019 at 1:32
  • @Londres Was a permissions error? That's as far as I could get. Feb 12, 2019 at 1:34
  • 1
    actually you know what... THAT WAS COMPLETELY MY FAULT. I read that wrong. You're the best man you solved my problem, thank you so much!!! It was because my application can't open the file but script editor can. I am very wrong.
    – Londres
    Feb 12, 2019 at 1:45
  • Be sure to +1 anyone that helps with an answer - even if it’s not right - it can be useful. Also, use the check to indicate a solved - that really helps pay it forward since people know what actually worked. Thanks @Londres - you’re off to a good start here already
    – bmike
    Feb 12, 2019 at 2:04
  • 1
    @bmike, You said "Be sure to +1 anyone that helps with an answer - even if it’s not right ...", sorry but I have to vehemently disagree with that, if an answer is not right it doesn't deserve an up vote! This is not supposed to be every kid gets a trophy! Feb 12, 2019 at 2:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .