PDA

View Full Version : Using 'extitscript' script



mangomel
11-21-2006, 11:45 AM
I want to know how Application.Exitscript works.

For example File.Find("C:", "*.txt") was fired by some button (OnClick). And I want to stop it by clicking on another button. So I tried to to use Application.Exitscript on 'OnClick' action but it didn't stop 'find' action. What is more, during that action is performed Aplication.Exit script doesn't work till it ends. So then if I want to close my application I have to terminate it (kill process).
So how should I use works Application.Exitscript ?

TristanD
11-22-2006, 07:27 AM
have you tried the help file yet>?

mangomel
11-22-2006, 02:14 PM
Ofcourse I did. But there is simply written that 'exitscript' ends currently performed action. Nothink more...
Any other suggestions?

Worm
11-22-2006, 02:35 PM
Application.ExitScript() is used to break out the current function or action. You can't use it to break out of another objects actions. For your scenario, in your callback function, check a variable to see if the cancel button was pressed, if so, then break out.

Adam
11-22-2006, 02:36 PM
Exit script will exit out of the event that it was fired from. You cannot exit one script from another. Your best bet would be to use the Callback (http://www.indigorose.com/webhelp/ams60/Program_Reference/Actions/File.Find.htm) function to cancel out of that action.

In that case you could set up a callback function in "Global Functions" that checks a variable and decides to continue searching based on that value. Then you could have another button that sets that variable.

Adam Kapilik

Worm
11-22-2006, 02:41 PM
Neener, neener, neener... I was faster than you :p



Exit script will exit out of the event that it was fired from. You cannot exit one script from another. Your best bet would be to use the Callback (http://www.indigorose.com/webhelp/ams60/Program_Reference/Actions/File.Find.htm) function to cancel out of that action.

In that case you could set up a callback function in "Global Functions" that checks a variable and decides to continue searching based on that value. Then you could have another button that sets that variable.

Adam Kapilik

Intrigued
11-22-2006, 05:41 PM
I'm feeling some "ownt" love.

:p

mangomel
11-23-2006, 03:45 PM
Generally I don't understand an idea of this solution at all. Maybe because of my ignorance...
What should I write in 'global'?
Could you show me any example?
I'm newbie in AMS...

Adam Kapilik? Your name sounds like you'd come from middle europe. Do you?

Adam
11-23-2006, 04:43 PM
Neener, neener, neener... I was faster than you

Great minds think alike :lol

Global Functions:


keepgoing = true;

-- A function that accepts two values and returns one value
function caller(CurrentPath)
-- Put function script here
local path = CurrentPath;

if keepgoing then
return true;
else
return false;
end
end


File.Find():


result = File.Find("C:\\", "*.pdf", true, false, caller, nil);

Button to stop the file.find():


keepgoing = false;



Adam Kapilik? Your name sounds like you'd come from middle europe. Do you?

Third generation Canadian. The name originates in Czech/Poland

Adam Kapilik

Intrigued
11-23-2006, 06:47 PM
Third generation Canadian.

Also known as 3rd Gen iCanadian.


:p

Adam
11-23-2006, 11:43 PM
Also known as 3rd Gen iCanadian.

Sounds like the latest console system. You should see the controller..

Adam Kapilik

Intrigued
11-24-2006, 12:00 AM
Sounds like the latest console system. You should see the controller..

Adam Kapilik

lol........

mangomel
11-27-2006, 01:34 PM
...because I come from Poland :).
Actually I wrote a proper script with myself before I saw your help (thank you very much) and now I see it's very easy. Now I see that it was a stupid question too.

M@ngomel