PDA

View Full Version : Halting Actions


pjborg
10-19-2004, 11:54 PM
I must admit I'm having difficulty wrapping my brain around the scripting in AMS5... More practice will hopefully solve that.

Meanwhile, this: Version 4 has a handy "RETURN" command that halts any further actions, as in

IF (whatever)
RETURN
END IF

After having read the manuals and viewed most of the topics in the training CDs, I think this action in AMS5 needs to be accomplished with IF script, but no RETURN command? My example:
I have a Dialog.Folder Browse action, and if the user clicks the CANCEL button naturally the ensuing actions should not take place. I've tried various permutations of this script, to no avail:

If My_Variable ~= CANCEL then
-- a bunch of actions here
End

Thanks in advance for helping out a (once again) newbie.
Pete

JimS
10-20-2004, 12:25 AM
pjborg,
AMS5 comes with a pretty handy help file, complete with examples of each action. In the script editor, pick the action Dialog.Folder Browse. Near the top of the window you will see a blue underlined link that says, “Click here to learn more about this action”. Click it.

When the Help file opens, you see an overview and description of the action. Near the top you will see an “Examples” tab, click it. You will find 3 separate examples for this action. If I understand your question correctly, then at least one of those examples will give you what you are after.

If that doesn’t get it for you, post back and we’ll go from there. Good luck.

pjborg
10-20-2004, 12:45 AM
Thanks, JimS, believe it or not, you have pointed me to an area of the help file I completely overlooked: the EXAMPLES! Yikes! How helpful is that!?!? I'm feeling a little sheepish now... :)

JimS
10-20-2004, 01:52 AM
Pete,
That’s sort of what I figured. It took me a while to notice the EXAMPLES also. No need to feel sheepish, we’ve all been where you are. Here soon, you’ll be over the hump, and able to help the next newbie along.

I’m glad it helped.

sside
10-20-2004, 06:34 AM
I must admit I'm having difficulty wrapping my brain around the scripting in AMS5... More practice will hopefully solve that.

Meanwhile, this: Version 4 has a handy "RETURN" command that halts any further actions, as in

IF (whatever)
RETURN
END IF

After having read the manuals and viewed most of the topics in the training CDs, I think this action in AMS5 needs to be accomplished with IF script, but no RETURN command? My example:
I have a Dialog.Folder Browse action, and if the user clicks the CANCEL button naturally the ensuing actions should not take place. I've tried various permutations of this script, to no avail:

If My_Variable ~= CANCEL then
-- a bunch of actions here
End

Thanks in advance for helping out a (once again) newbie.
Pete

I'm not sure what you are trying to do but your code should get the job done. Here you have one example;
--------------------------------------------------------------------------
strPath = Dialog.FolderBrowse("Please select a folder:", "AutoPlay\\Docs");

if (strPath == "CANCEL") then
result = Dialog.Message("Notice", "You clicked CANCEL", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
elseif (strPath == "") then
result = Dialog.Message("Notice", "Error", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
elseif (strPath ~= "CANCEL") and (strPath ~= "") then
result = Dialog.Message("Notice", "Here we GO", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
end
--------------------------------------------------------------------------


Sside