Jump to content

A basic problem in AutoIt3


Guest
 Share

Recommended Posts

Not much to say ..

To save words simply try to run this code:

call("test")

Func test()
$test = "working"
Call("func1")
EndFunc

Func func1()
MsgBox(4096,"test",$test)
EndFunc

The variable $test is not saved if it is in the function.

This basic problem prevents me from continuing to program what I want.

I have the variable will remain even after the exit from the function ..

I do not understand why the system works that way ..

Link to comment
Share on other sites

Yes. But with call you are limited. You can't use ByRef which for me personally is a deal breaker.

I would learn to call functions the way everyone else does though. it will make getting help on the forums much easier.

I've never seen anyone use the Call before.

Link to comment
Share on other sites

$a = test() ;$a will equal the first thing test returns

$v1 = 5
$v2 = 10

for $i = 1 to $v1 step 1
test()
Next

Func test()
for $o = 1 to $v2 step 1
$a = $o
Return $a ;the function returns the value $a is currently set to in this case the loop is pointless and will always return the number 1
test2() ;this never executes
Next
EndFunc

func test2()
for $q = 1 to 20 step 1
msgbox(4096,"working",$a)
Next

Edited by Deltron0
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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