Jump to content

Recommended Posts

Posted

Hi

I have a script running (all functions called by hot keys) and if a condition is true (call it a flag)

I need to exit the function before it finishes and keep the script running.

I am really drawing a blank on this one.

Here is an example of what I want to do.

$test = ""

test()

Func Test()

if $test = "" then EndFunc ; (If I use exit it closes the script but I need to keep the script running)

MsgBox(0,"","this is a test")

EndFunc

Thanks for your help.

REB

MEASURE TWICE - CUT ONCE

Posted

Try Return.

Here is what I tried.

test()

global $test, $x

$test = "dick"

Func Test()

if $test = "" then Return $x; If I use exit it closes the script

MsgBox(0,$test,"this is a test")

EndFunc

error (6) : ==> Variable used without being declared.:

if $test = "" then Return $x

if ^ ERROR

What am I doing wrong?

REB

MEASURE TWICE - CUT ONCE

Posted

Didn't you read the error? You used the variable before declaring it!

You probably want your script to start more like:

global $test, $x
$test = "dick"
test()

I sure did. Works now

THANK YOU

REB

MEASURE TWICE - CUT ONCE

Posted

Perhaps because you're calling test() before you've declared $test.

Thank you.

You are right on.

REB

MEASURE TWICE - CUT ONCE

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...