misstake

31 views
Skip to first unread message

Kalman Tarr

unread,
Feb 1, 2023, 6:29:31 AM2/1/23
to QLab
Hello guys,

I would like to run this script in a job.

'set destinationFolder to (path to documents folder as text) & "myFile.scpt"
set thePOSIXtxt to (the POSIX path of destinationFolder) as text 

(As a result I get: /Users/me/Documents/myFile.scpt
It looks the same I use in a different job.)

After getting the above result I try to run:
'run script quote & (thePOSIXtxt as text) & quote'

I've tried to check it with try - error - end try cycle, but it doesn't give any error.

I am using the 'quote' word because it is corresponds to a different job  word order, that script is working well.

'run script "/Users/me/Documents/myFile.scpt" '

I think the error is too simple. But not for me.
Please help me, where is my misstake.
(Every little helps.)

THX a lot
Best,

Rich Walsh

unread,
Feb 1, 2023, 8:13:56 AM2/1/23
to ql...@googlegroups.com
If you want to see an error don’t use a try block unless you are trapping the error with an "on error errText number errNum” followed by a dialog to display errText and errNum.

Best way to see what errors are is to use Script Editor (Replies tab of the Result section). Only escape errors with a try if you want the script to not break completely when it hits an error…

There is no error because by enclosing your text /Users/me/Documents/myFile.scpt in quotes you are passing a piece of TEXT to the run script handler, not a FILE to run. It’s subtle but these result in different text being presented to the run script handler:

run script thePOSIXtxt -- Passes /Users/me/Documents/myFile.scpt for interpretation (as a POSIX file specifier)


run script quote & (thePOSIXtxt as text) & quote -- Passes "Users/me/Documents/myFile.scpt" for interpretation, ie: an actual piece of text not a command or a file specifier, which runs without doing anything or throwing an error


Both of these versions work:

run script POSIX path of (path to documents folder) & "myFile.scpt"


run script alias ((path to documents folder as text) & "myFile.scpt")


This also works:

set destinationFolder to (path to documents folder as text) & "myFile.scpt"

set thePOSIXtxt to POSIX path of destinationFolder -- No coercion needed; POSIX path already has class text

run script thePOSIXtxt


I don’t recall ever encountering the quote text constant before…

Rich
Reply all
Reply to author
Forward
0 new messages