By Londres

2019-02-11 18:24:50 8 Comments

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


@haykam 2019-02-12 01:22:59

You said you needed to open the script in AppleScript:

tell application "Script Editor" to open file (POSIX path of (path to me))

@Londres 2019-02-12 01:32:32

I did that already... sorry it didn't work. But thank you for your input and your determination to help me!

@haykam 2019-02-12 01:34:13

@Londres Was a permissions error? That's as far as I could get.

@Londres 2019-02-12 01:45:05

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.

@bmike 2019-02-12 02:04:39

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

@user3439894 2019-02-12 02:28:38

@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!

@bmike 2019-02-12 03:18:59

I did say “helpful answer” since often questions struggle with clarity and someone puts up an answer that gets closer. This site suffers from far too many questions with no upvotes and three answers. Same with answers - if there are two or three answers and most people won’t suffer -1 point to down vote - we need more up votes when something is either right or helpful IMO. I agree we don’t want trophy votes, but think more votes will help that greatly.

@Wowfunhappy 2019-02-12 16:58:45

Why are you grabbing the POSIX path? Shouldn't apple apps be able to use native Apple-formatted paths?

@Wowfunhappy 2019-02-11 23:44:06

From within an Applescript, the command:

run script "SecondAppleScript.scpt"

will run SecondAppleScript.scpt

@Wowfunhappy 2019-02-11 23:49:48

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...

@Londres 2019-02-12 01:16:38

I mean I wanna open the script that I'm running

Related Questions

Sponsored Content

2 Answered Questions

[SOLVED] Opening a local .mp3 file with AppleScript Editor

  • 2018-08-14 07:27:31
  • John Smith
  • 192 View
  • 1 Score
  • 2 Answer
  • Tags:   applescript mp3

1 Answered Questions

2 Answered Questions

1 Answered Questions

[SOLVED] A complicated script to automate functions in Safari

1 Answered Questions

[SOLVED] How might I save a variable between Applescript runs?

  • 2017-07-25 23:28:12
  • DonielF
  • 1092 View
  • 0 Score
  • 1 Answer
  • Tags:   applescript

2 Answered Questions

2 Answered Questions

[SOLVED] How to use AppleScript application with "open file -a AppleScriptApp"?

  • 2015-01-23 10:46:11
  • d12frosted
  • 2021 View
  • 1 Score
  • 2 Answer
  • Tags:   applescript

1 Answered Questions

[SOLVED] Toggling screensaver password with script

Sponsored Content