BALA Posted January 1, 2007 Posted January 1, 2007 (edited) expandcollapse popup#include <Misc.au3> #include <GUIConstants.au3> Opt("GUIOnEventMode", 1) $mainwindow = GUICreate("BA-TYPER", 300, 160) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") GUISetState() $position1 = GUICtrlCreateButton("Position", 70, 20, 120) GUICtrlSetOnEvent($position1, "Position") $on = GUICtrlCreateRadio ("On", 40, 60, 40, 20) $off = GUICtrlCreateRadio ("Off", 40, 80, 40, 20) GUICtrlSetState ($off, $GUI_CHECKED) $input = GuiCtrlCreateInput("", 80, 70, 180, 20) $input2 = GUICtrlRead($input) $time = GuiCtrlCreateInput("5", 180, 107, 40, 20) $time2 = GUICtrlRead($time) GUICtrlCreateLabel ("Time between Posts (in seconds)", 10, 110) Dim $Position, $i = 0, $Record[1][2] Global $check = 0 Global $time2 = $time2 * 1000 Func CLOSEClicked() Exit EndFunc Func Position() While 1 If _IsPressed("01") Then $Position = MouseGetPos() ReDim $Record[$i + 1][2] $Record[$i][0] = $Position[0] $Record[$i][1] = $position[1] consoleWrite($Record[$i][0] & @LF & $Record[$i][ 1] & @LF) GUICtrlCreateLabel ("x = "&$Record[$i][0] & @LF & "y = "& $Record[$i][1] & @LF, 200, 20) $i += 1 ExitLoop EndIf sleep(10) WEnd EndFunc While 1 If GUICtrlRead($on) = $GUI_CHECKED Then $check = 1 EndIf If GUICtrlRead($off) = $GUI_CHECKED Then $check = 0 EndIf If $check = 1 Then MouseClick("left", $Position[0], $position[1], 1) Send (""&$input2) sleep($time2) EndIf sleep(10) WEnd I am trying to create a program that will automatically type a phrase you tell it, over and over until you tell it to stop. For some reason I can't get the input and use that in the Send and Sleep commands near the bottom of the code. Anyone know what I'm doing wrong? Edited January 1, 2007 by BALA [font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
GaryFrost Posted January 1, 2007 Posted January 1, 2007 Change: Send (""&$input2)oÝ÷ Ù:ºÚ"µÍÙ[ ][ÝÉ][ÝÉ[ÑÝZPÝXY ÌÍÚ[] J SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
BALA Posted January 1, 2007 Author Posted January 1, 2007 (edited) Okay, I'll try... Same thing for Sleep()? Edited January 1, 2007 by BALA [font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
martin Posted January 1, 2007 Posted January 1, 2007 expandcollapse popup#include <Misc.au3> #include <GUIConstants.au3> Opt("GUIOnEventMode", 1) $mainwindow = GUICreate("BA-TYPER", 300, 160) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") GUISetState() $position1 = GUICtrlCreateButton("Position", 70, 20, 120) GUICtrlSetOnEvent($position1, "Position") $on = GUICtrlCreateRadio ("On", 40, 60, 40, 20) $off = GUICtrlCreateRadio ("Off", 40, 80, 40, 20) GUICtrlSetState ($off, $GUI_CHECKED) $input = GuiCtrlCreateInput("", 80, 70, 180, 20) $input2 = GUICtrlRead($input) $time = GuiCtrlCreateInput("5", 180, 107, 40, 20) $time2 = GUICtrlRead($time) GUICtrlCreateLabel ("Time between Posts (in seconds)", 10, 110) Dim $Position, $i = 0, $Record[1][2] Global $check = 0 Global $time2 = $time2 * 1000 Func CLOSEClicked() Exit EndFunc Func Position() While 1 If _IsPressed("01") Then $Position = MouseGetPos() ReDim $Record[$i + 1][2] $Record[$i][0] = $Position[0] $Record[$i][1] = $position[1] consoleWrite($Record[$i][0] & @LF & $Record[$i][ 1] & @LF) GUICtrlCreateLabel ("x = "&$Record[$i][0] & @LF & "y = "& $Record[$i][1] & @LF, 200, 20) $i += 1 ExitLoop EndIf sleep(10) WEnd EndFunc While 1 If GUICtrlRead($on) = $GUI_CHECKED Then $check = 1 EndIf If GUICtrlRead($off) = $GUI_CHECKED Then $check = 0 EndIf If $check = 1 Then MouseClick("left", $Position[0], $position[1], 1) Send (""&$input2) sleep($time2) EndIf sleep(10) WEnd I am trying to create a program that will automatically type a phrase you tell it, over and over until you tell it to stop. For some reason I can't get the input and use that in the Send and Sleep commands near the bottom of the code. Anyone know what I'm doing wrong? You are using GUICtrlRead to find the checked state of $on but you should use If GUICtrlGetState($on) = $GUI_CHECKED Then Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
BALA Posted January 1, 2007 Author Posted January 1, 2007 (edited) Oh, thanks. By the way, sleep(GUICtrlRead($time)) does seem to work for the time, but it does for the input. What's wrong with the time? That is, time keeps returning a value of 0. expandcollapse popup#include <Misc.au3> #include <GUIConstants.au3> Opt("GUIOnEventMode", 1) $mainwindow = GUICreate("BA-TYPER", 300, 160) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") GUISetState() $position1 = GUICtrlCreateButton("Position", 70, 20, 120) GUICtrlSetOnEvent($position1, "Position") $on = GUICtrlCreateRadio ("On", 40, 60, 40, 20) $off = GUICtrlCreateRadio ("Off", 40, 80, 40, 20) GUICtrlSetState ($off, $GUI_CHECKED) $input = GuiCtrlCreateInput("", 80, 70, 180, 20) $time = GuiCtrlCreateInput("5", 180, 107, 40, 20) GUICtrlCreateLabel ("Time between Posts (in seconds)", 10, 110) Dim $Position, $i = 0, $Record[1][2] Global $check = 0 Global $time = $time * 1000 Func CLOSEClicked() Exit EndFunc Func Position() While 1 If _IsPressed("01") Then $Position = MouseGetPos() ReDim $Record[$i + 1][2] $Record[$i][0] = $Position[0] $Record[$i][1] = $position[1] consoleWrite($Record[$i][0] & @LF & $Record[$i][ 1] & @LF) GUICtrlCreateLabel ("x = "&$Record[$i][0] & @LF & "y = "& $Record[$i][1] & @LF, 200, 20) $i += 1 ExitLoop EndIf sleep(10) WEnd EndFunc While 1 GUICtrlCreateLabel ("Time"&GUICtrlRead($time), 10, 130) If GUICtrlGetState($on) = $GUI_CHECKED Then $check = 1 EndIf If GUICtrlGetState($off) = $GUI_CHECKED Then $check = 0 EndIf If $check = 1 Then MouseClick("left", $Position[0], $position[1], 1) Send (""&GuiCtrlRead($input)) sleep(GuiCtrlRead($time)) EndIf sleep(10) WEnd I added a label to show the value of $time, and as you can see when your run the program, it keeps showing a value of 0. Edited January 1, 2007 by BALA [font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
martin Posted January 1, 2007 Posted January 1, 2007 Oh, thanks. By the way, sleep(GUICtrlRead($time)) does seem to work for the time, but it does for the input. What's wrong with the time? That is, time keeps returning a value of 0. expandcollapse popup#include <Misc.au3> #include <GUIConstants.au3> Opt("GUIOnEventMode", 1) $mainwindow = GUICreate("BA-TYPER", 300, 160) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") GUISetState() $position1 = GUICtrlCreateButton("Position", 70, 20, 120) GUICtrlSetOnEvent($position1, "Position") $on = GUICtrlCreateRadio ("On", 40, 60, 40, 20) $off = GUICtrlCreateRadio ("Off", 40, 80, 40, 20) GUICtrlSetState ($off, $GUI_CHECKED) $input = GuiCtrlCreateInput("", 80, 70, 180, 20) $time = GuiCtrlCreateInput("5", 180, 107, 40, 20) GUICtrlCreateLabel ("Time between Posts (in seconds)", 10, 110) Dim $Position, $i = 0, $Record[1][2] Global $check = 0 Global $time = $time * 1000 Func CLOSEClicked() Exit EndFunc Func Position() While 1 If _IsPressed("01") Then $Position = MouseGetPos() ReDim $Record[$i + 1][2] $Record[$i][0] = $Position[0] $Record[$i][1] = $position[1] consoleWrite($Record[$i][0] & @LF & $Record[$i][ 1] & @LF) GUICtrlCreateLabel ("x = "&$Record[$i][0] & @LF & "y = "& $Record[$i][1] & @LF, 200, 20) $i += 1 ExitLoop EndIf sleep(10) WEnd EndFunc While 1 GUICtrlCreateLabel ("Time"&GUICtrlRead($time), 10, 130) If GUICtrlGetState($on) = $GUI_CHECKED Then $check = 1 EndIf If GUICtrlGetState($off) = $GUI_CHECKED Then $check = 0 EndIf If $check = 1 Then MouseClick("left", $Position[0], $position[1], 1) Send (""&GuiCtrlRead($input)) sleep(GuiCtrlRead($time)) EndIf sleep(10) WEnd I added a label to show the value of $time, and as you can see when your run the program, it keeps showing a value of 0. You have got $time as the input, and then you have Global $time = $time * 1000. ;<---- I think you should delete this line. Maybe what you want is sleep(1000 * GUICtrlRead($time)) Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
BALA Posted January 1, 2007 Author Posted January 1, 2007 (edited) Thanks! I think my program's finished now Oh and the early post spammer! made seems to be incorrect, but I fixed the problem. Edited January 1, 2007 by BALA [font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now