Sign in to follow this  
Followers 0
superboi

Varibale trouble

6 posts in this topic

I think this is somewhat of a tricky request. I have a script with a few variables.

$b - this is a constant

$a - This is part of a loop, and ends at $b

$x - this is the one giving me trouble

I need $x = 1 when $b - $a = 9. I also need $x to increase by $a's step.

I hope this can be done, because as of right now, the only variable I have to change before using the script is $b. I didn't really need $x before because $b was well... constant, and it was actually 12 for a while, but now its 15, and I don't know what it'll be in the future.

Share this post


Link to post
Share on other sites



Actually I think I may have thought of a better solution to this problem.

If there is some way to send("$a"), and have a numerical value come out on the other end, then my problem is solved.

Share this post


Link to post
Share on other sites

I'm not sure what your trying to do since you haven't posted any code however it sounds like your having problems with basic math. You should start by learning how to use for next loops.

; example
for $i = 0 to 10 step 2
 consolewrite($i&@CRLF) 
next

[size="1"]Please stop confusing "how to" with "how do"[/size]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

If you just want to send the value of $a, that can be done by removing the quotes from around it

Run('notepad.exe')
WinWait('[CLASS:Notepad]')
For $a = 1 to 20
    ControlSend('[CLASS:Notepad]', '', 'Edit1', $a)
    ControlSend('[CLASS:Notepad]', '', 'Edit1', '{ENTER}')
Next
Edited by Varian

Share this post


Link to post
Share on other sites

It wasn't a problem with my math. It was a problem of making a variable appear when something occurred. I knew when it occurred, I just didn't know how to let the computer know.

Anyway I found out how to send what I wanted to.

At first I was thinking of having 20 different "if" clauses:

If $a = 1 then send("1")

If $a = 2 then send("2")

If $a = 3 then send("3")...

Apparently though you can say:

Send("{&$a&}")

and it'll send the numerical value for your variable. This way I don't need to click the link, and I can just change the URL.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

To send {1}

Send("{" & $a)
Send("}")
To send 1
Send($a)
To send {NUMPAD1}
Send("{NUMPAD" & $a & "}")

Edited by Varian

Share this post


Link to post
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
Sign in to follow this  
Followers 0