Sign in to follow this  
Followers 0
lordicast

Multiple GuiCtrlRead send

14 posts in this topic

i got problem with multiple Guictrlread's

i have some inputs $rate,$store,$weath and i have a button

$Load to send all inputs then begin a function when i press the button load it just sits i need help please

here is a example script

while 1

$Msg = GUIGetMsg()

If $msg = $Load Then

GUICtrlRead($rate)

GuiCtrlRead($store)

GuiCtrlRead($weath)

Call("justdoit")

EndIf

WEnd

Func justdoit()

Local $count = 0

While 1

WinActivate("Untitled - Notepad")

WinWaitActive("Untitled - Notepad")

send("Hello i type at "&$rate&" per seconds")

send("I like shopping at "&$store&"")

send("the weather is "&$weath&"")

$count +=1

Wend

EndFunc


[Cheeky]Comment[/Cheeky]

Share this post


Link to post
Share on other sites

Pass the variables into your function, like so:

While 1
    $Msg = GUIGetMsg()
    If $Msg = $Load Then
        justdoit(GUICtrlRead($rate), GUICtrlRead($store), GUICtrlRead($weath))
    EndIf
WEnd
Func justdoit($intRate, $strStore, $strWeath)
    Local $intCount = 0
    While 1
        WinActivate("Untitled - Notepad")
        WinWaitActive("Untitled - Notepad")
        Send("Hello i type at " & $intRate & " per seconds")
        Send("I like shopping at " & $strStore & "")
        Send("the weather is " & $strWeath & "")
        $intCount += 1
    WEnd
EndFunc   ;==>justdoit

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

Wow Blue thank you for your speedy help man cheers


[Cheeky]Comment[/Cheeky]

Share this post


Link to post
Share on other sites

Another problem im running into is lets say i want $rate is currently is being used in minutes and i want to translate it to milliseconds example

i want the user to input how many minutes lets say 2

the value of $rate = 2

but i want it to translate 120000 in milliseconds for the script to understand.

this is what i came up with\

if $rate = '2' then

$rate2 = '120000'


[Cheeky]Comment[/Cheeky]

Share this post


Link to post
Share on other sites

Another problem im running into is lets say i want $rate is currently is being used in minutes and i want to translate it to milliseconds example

i want the user to input how many minutes lets say 2

the value of $rate = 2

but i want it to translate 120000 in milliseconds for the script to understand for sleep mode.

this is what i came up with\

if $rate = '2' then

$rate2 = '120000'

elseif

$rate = '5' then

$rate2 = '300000'

elseif

$rate = '10' then

$rate2 = '600000'

endif

it wont work though


[Cheeky]Comment[/Cheeky]

Share this post


Link to post
Share on other sites

sorry i didnt relize i posted that first one i wasnt finished.

will that work alone or must i add somthing like

$rate2 = ("$rate * 60 * 1000")


[Cheeky]Comment[/Cheeky]

Share this post


Link to post
Share on other sites

sorry i didnt relize i posted that first one i wasnt finished.

will that work alone or must i add somthing like

$rate2 = ("$rate * 60 * 1000")

No that will not work ... did you try the line as I post it ?

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

no, im afraid not do think it might have somthing to do with the way $rate is read

$rate = GUICtrlCreateCombo("2", 312, 80, 145, 25)

GUICtrlSetData(-1,"5|10","2")

$rate2 = $rate * 60 * 1000


[Cheeky]Comment[/Cheeky]

Share this post


Link to post
Share on other sites

no, im afraid not do think it might have somthing to do with the way $rate is read

$rate = GUICtrlCreateCombo("2", 312, 80, 145, 25)

GUICtrlSetData(-1,"5|10","2")

$rate2 = $rate * 60 * 1000

You need to do a GUICtrlRead($rate) to retrieve its value ...

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Another one? here's some example of what i got going

$rate = GUICtrlCreateCombo("2", 312, 80, 145, 25)

GUICtrlSetData(-1,"5|10","2")

$rate2 = $rate * 60 * 1000

While 1

$Msg = GUIGetMsg()

If $Msg = $Load Then

justdoit(GUICtrlRead($rate2))

EndIf

WEnd

Func justdoit($rate2)

Local $intCount = 0

While 1

WinActivate("Untitled - Notepad")

WinWaitActive("Untitled - Notepad")

Send("Hello nice to meet you!")

sleep("" & $rate2 & "")

Send("I need help on this script")

Sleep("" & $rate2 &"")

$intCount += 1

WEnd

EndFunc


[Cheeky]Comment[/Cheeky]

Share this post


Link to post
Share on other sites

$rate is the HAndle to the ComboControl ... WHen you need to retrieve the selected value you do GuiCtrlRead().

I have no idea what this line is supposed to do at the spot its placed:

$rate2 = $rate * 60 * 1000

And I also have no idea what this is supposed to do:

justdoit(GUICtrlRead($rate2))


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

i figured out what i was doing wrong

$rate = GUICtrlCreateCombo("2", 312, 80, 145, 25)

GUICtrlSetData(-1,"5|10","2")

While 1

$Msg = GUIGetMsg()

If $Msg = $Load Then

justdoit(GUICtrlRead($rate))

EndIf

WEnd

Func justdoit($rate)

Local $intCount = 0

While 1

WinActivate("Untitled - Notepad")

WinWaitActive("Untitled - Notepad")

$rate2 = $rate * 60 * 1000

Send("Hello nice to meet you!")

sleep("" & $rate2 & "")

Send("I need help on this script")

Sleep("" & $rate2 &"")

$intCount += 1

WEnd

EndFunc

AND SUCESS thanks for everyones help on this project


[Cheeky]Comment[/Cheeky]

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