2

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
New contributor
Londres is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • What prevents a user without the secret code from running the second script directly? – Wowfunhappy Feb 11 at 23:46
0

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... – Wowfunhappy Feb 11 at 23:49
  • I mean I wanna open the script that I'm running – Londres Feb 12 at 1:16
2

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 at 1:32
  • @Londres Was a permissions error? That's as far as I could get. – haykam Feb 12 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 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 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! – user3439894 Feb 12 at 2:28

Your Answer

Londres is a new contributor. Be nice, and check out our Code of Conduct.

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.