Jump to content

exit scriptmaker from applescript?


This topic is 6864 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I need to make a test in finder within applescript as a step in a filemaker script. If it is false I'd like the filemaker script to exit as well. Is this possible?

Basically I have a finder dialog that has Cancel button in it. I'd rather it wasnt there but I dont think I can stop that. If a user hits the cancel it messes with the script

Edited by Guest
Link to comment
Share on other sites

One thing before advising further, why can't Filemakers own Show message be used??

However if you put the embedded applescript in the very end of the script, can you set the applescript to call/start the same script again to make the looping if thats what required almost as a recursive definition.

--sd

Link to comment
Share on other sites

I also don't know exactly when/where this is. But since you say a Finder script, it seems you need to capture the error in AppleScript. There is a mechanism for suppressing the default error dialog. It's the "try" block. -128 is the "user cancelled" error. You can fork the AppleScript to deal with it, or do nothing. Example, run in Script Editor (you wouldn't show a message, this is just an example to see that you can do something):o

try

set theFile to choose file

on error errmsg number errnum

if errnum = -128 then

display dialog errmsg & " " & errnum buttons {"OK"} default button 1

end if

end try

(P.S. Set Error Capture [On] will block display of an AppleScript error in a short Perform AppleScript step. I'm not sure if it will if you have multiple commands in your AppleScript that could generate an AppleScript error message.)

Edited by Guest
Additional vague info
Link to comment
Share on other sites

Thanks guys but Im not sure I have made my self as clear as I should of.

In applescript I am setting a folder to save a generated PDF file. I am using "set new_folder to choose folder" etc to create the path. Soren I dont think the "show custom dialog" is any use to me.

I need to be in Applescript becasue I am moving and deleting files.

Fenton

I dont see how the try will help as once i break out of the applescript filemaker continues on.

Trouble is the user is presented with and OK and a Cancel. They might select Cancel in which case I dont want the remainder of the filmaker script to run.

The applescript is in the middle of the filemaker script

Edited by Guest
Link to comment
Share on other sites

hmm i just had an idea. On a applescript error i could make an entry into a global field then when it is back into scriptmaker then add an if statement in scriptmaker to exit if true.

Link to comment
Share on other sites

Trouble is the user is presented with and OK and a Cancel. They might select Cancel in which case I dont want the remainder of the filmaker script to run.

A slight variation over my suggestion, if you put the embedded script to the very end of the script, by duping the script in two and let the AS call the second half conditionally ...it should be obvious that each half should be trimmed either pre or post the AS.

All in all get two native filemaker scripts where the second is called if the user in the have chosen to create a new folder - why should it all be done in one script???

--sd

Link to comment
Share on other sites

in the end I used Fentons try statement and on error added a value to a global field, then an exit command. Back into scriptmaker I used 'If global field =xxx then exit script"

Seems to work fine- thanks for the help guys

Link to comment
Share on other sites

This topic is 6864 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.