Sign in to follow this  
Followers 0
Bigginer

Changing script during the LOOP?

13 posts in this topic

Hi.

I'm wondering if there is anyway to be able to change a value while the script is running. Eg. Press Ctrl + 1

$Variable = InPutBox("Blah blah", "Blah Blah Blah")
; Then press something to temporally pause the script and change the value of $Variable.

Also, If it's possible does it have to be with a GUI?

Thanks :)

Share this post


Link to post
Share on other sites



Why not just $Variable=Something new

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Something like this? Displays the value, when pressing ctrl-t the value is increased...

#include <GUIConstants.au3>
HotKeySet("^t", "Change")

$value=1

SplashTextOn("Test",$value)
While 1
    ControlSetText("Test", "", "Static1", $value)
    Sleep(100)
WEnd
SplashOff()


Func Change()
    $value = $value + 1
EndFunc
Edited by Marc

It's my job to comfort the disturbed and to disturb the comfortable.

Share this post


Link to post
Share on other sites

Something like this? Displays the value, when pressing ctrl-t the value is increased...

#include <GUIConstants.au3>
HotKeySet("^t", "Change")

$value=1

SplashTextOn("Test",$value)
While 1
    ControlSetText("Test", "", "Static1", $value)
    Sleep(100)
WEnd
SplashOff()
Func Change()
    $value = $value + 1
EndFunc
Is it possible to have it so that the user can change it completely, not just increase the value?

Share this post


Link to post
Share on other sites

Is it possible to have it so that the user can change it completely, not just increase the value?

This is lame..what are you trying to do anyways..

;$value=haha this is where you place the value example
$value=1 ;as numeric number
$value="haha" ;string

Share this post


Link to post
Share on other sites

I want to make it so that at the start when the script runs, its asks you to set the values for 3 variables Eg. Hello, Hello1, Hello2 (I have already done that)

But, I also want to make it so if you press a hotkey during the running of the script you can edit those variables. Eg, HelloEdit, HelloEdit2, HelloEdit3

Share this post


Link to post
Share on other sites

Ah..I c...so just use the hotkey set method and whenever you press the hotkey it assign a new value to the variable.

Ex.

When you press hotkey 1 $value="Hello1"

When you press hotkey 2 $value="Hello 2"

When you press hotkey 3 $value="Hello 3"

Etc

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

...But, I also want to make it so if you press a hotkey during the running of the script you can edit those variables. Eg, HelloEdit, HelloEdit2, HelloEdit3

HotKeySet("{PAUSE}", "_Change_It")
Global $hello, $hello1, $hello2

_Change_It()

While 1
    Sleep(99)
    ;main body of the script
    TrayTip("", "$hello = " & $hello & @CR & _
            "$hello1 = " & $hello1 & @CR & _
            "$hello2 = " & $hello2, 100)
WEnd

Func _Change_It()
    $hello = InputBox("hello", "Enter value")
    $hello1 = InputBox("hello1", "Enter value")
    $hello2 = InputBox("hello2", "Enter value")
EndFunc   ;==>_Change_It
Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

Well, I tried all of that. Didn't help =\

herewasplato, Your code just declared more variables at the start and increased the boxes that came up, I pressed the hotkey and couldn't edit them.

Generator, I tried HotKeySet("{LCTRL}"=$Line1) That didn't help either.

Any more ideas?

Share this post


Link to post
Share on other sites

Well, I tried all of that. Didn't help =\

herewasplato, Your code just declared more variables at the start and increased the boxes that came up, I pressed the hotkey and couldn't edit them.

Generator, I tried HotKeySet("{LCTRL}"=$Line1) That didn't help either.

Any more ideas?

?????

Share this post


Link to post
Share on other sites

I tried HotKeySet("{LCTRL}"=$Line1) That didn't help either.

Any more ideas?

I have an idea... Open the help file up... look at hotkeyset and tell me why your function did not work...


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

...herewasplato, Your code just declared more variables at the start and increased the boxes that came up, I pressed the hotkey and couldn't edit them...

You are welcome.

Sorry, I must not understand what you want.

-MSP-


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

HotKeySet("^1", "Edit1")
;=====> everything before while 1 here

While 1
[...]
WEnd

Func Edit1()
$Yourvalue = Inputbox("W/e", "Change your value to this")
EndFunc

Edited by Delta01

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