Jump to content

Changing script during the LOOP?


Recommended Posts

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 :)

Link to comment
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
Edited by Marc

Any of my own codes posted on the forum are free for use by others without any restriction of any kind. (WTFPL)

Link to comment
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?
Link to comment
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
Link to comment
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

Link to comment
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

Link to comment
Share on other sites

...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]

Link to comment
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?

Link to comment
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?

?????
Link to comment
Share on other sites

  • Moderators

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.

Link to comment
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]

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...