trol4ever Posted February 5, 2007 Share Posted February 5, 2007 So ... the problem is i don't know how to bind up the buttons to what they do .... for ex : Button1 = Start/Pause ... to bind it to the hotkey ... the result shoud be Button1 = Send("F1") expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.1.1.0 Author: DaiKa7aNa/Trol4ever Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here Sleep(2000) Global $Paused [i][b]#include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("2Moons Fishing Bot BETA v0.1", 252, 178, 201, 115) $Button1 = GUICtrlCreateButton("Start/Pause", 16, 16, 97, 73, 0) $Button2 = GUICtrlCreateButton("Hide Window", 128, 16, 89, 33, 0) $Button3 = GUICtrlCreateButton("Show Window", 128, 56, 89, 33, 0) $Input1 = GUICtrlCreateInput(" Created By DaiKa7aNa@Trol4ever", 16, 96, 201, 21) $Input2 = GUICtrlCreateInput("F1 = Start/Pause", 16, 120, 97, 21) $Input3 = GUICtrlCreateInput("F2 = Hide Window", 120, 120, 97, 21) $Input4 = GUICtrlCreateInput("F3 = Show Window", 64, 144, 113, 21) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ###[/b][/i] [b]While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Case $Button2 EndSwitch WEnd[/b] HotKeySet("{F1}", "Pause") HotKeySet("{F2}", "Hide") HotKeySet("{F3}", "Show") Func Pause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Func Hide() GUISetState(@SW_HIDE) EndFunc Func Show() GUISetState(@SW_SHOW) EndFunc Func Escape() Exit EndFunc Send("l") Sleep(1000) MouseDown("left") MouseUp("left") Sleep(500) MouseDown("left") Sleep(6500) MouseUp("left") Sleep(100) hope some1 can help me binding them .. Link to comment Share on other sites More sharing options...
MrCreatoR Posted February 5, 2007 Share Posted February 5, 2007 trol4ever1. The HotkeySet function must go before the main loop, otherwise the script is not reach these funcs, it always in loop.2. The functions usually placed in the end of script.3. Just put the functions into "Case"expandcollapse popupGlobal $Paused #include <GUIConstants.au3> HotKeySet("{F1}", "Pause") HotKeySet("{F2}", "Hide") HotKeySet("{F3}", "Show") $Form1 = GUICreate("2Moons Fishing Bot BETA v0.1", 252, 178, 201, 115) $Button1 = GUICtrlCreateButton("Start/Pause", 16, 16, 97, 73, 0) $Button2 = GUICtrlCreateButton("Hide Window", 128, 16, 89, 33, 0) $Button3 = GUICtrlCreateButton("Show Window", 128, 56, 89, 33, 0) $Input1 = GUICtrlCreateInput(" Created By DaiKa7aNa@Trol4ever", 16, 96, 201, 21) $Input2 = GUICtrlCreateInput("F1 = Start/Pause", 16, 120, 97, 21) $Input3 = GUICtrlCreateInput("F2 = Hide Window", 120, 120, 97, 21) $Input4 = GUICtrlCreateInput("F3 = Show Window", 64, 144, 113, 21) GUISetState(@SW_SHOW) Send("l") Sleep(1000) MouseDown("left") MouseUp("left") Sleep(500) MouseDown("left") Sleep(6500) MouseUp("left") Sleep(100) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Pause() Case $Button2 Hide() Case $Button3 Show() EndSwitch WEnd Func Pause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Func Hide() GUISetState(@SW_HIDE) EndFunc Func Show() GUISetState(@SW_SHOW) EndFunc Func Escape() Exit EndFunc Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
trol4ever Posted February 5, 2007 Author Share Posted February 5, 2007 ty for help ... but still [ u fixed my hotkeys ... ] but now the problem is another ... when i open the script everything is ok ... the script starts paused ... if u push the start button it doesnt start ... if u push the hotkey the program starts but in 2 seconds its paused again ... why ? Link to comment Share on other sites More sharing options...
MrCreatoR Posted February 6, 2007 Share Posted February 6, 2007 (edited) trol4everIn autoIt there is a usefull Option that work with events - Opt("GuiOnEventMode", 1), in that case, is what i think we need:expandcollapse popup#include <GUIConstants.au3> Opt("GuiOnEventMode", 1) Global $Paused = 0, $IsHotkey = 0 HotKeySet("{F1}", "PauseByHotKey") HotKeySet("{F2}", "Hide") HotKeySet("{F3}", "Show") $Form1 = GUICreate("2Moons Fishing Bot BETA v0.1", 252, 178, 201, 115) $Button1 = GUICtrlCreateButton("Pause", 16, 16, 97, 73, 0) $Button2 = GUICtrlCreateButton("Hide Window", 128, 16, 89, 33, 0) $Button3 = GUICtrlCreateButton("Show Window", 128, 56, 89, 33, 0) $Input1 = GUICtrlCreateInput(" Created By DaiKa7aNa@Trol4ever", 16, 96, 201, 21) $Input2 = GUICtrlCreateInput("F1 = Start/Pause", 16, 120, 97, 21) $Input3 = GUICtrlCreateInput("F2 = Hide Window", 120, 120, 97, 21) $Input4 = GUICtrlCreateInput("F3 = Show Window", 64, 144, 113, 21) GUISetOnEvent($GUI_EVENT_CLOSE, "Escape") GUICtrlSetOnEvent($Button1, "Pause") GUICtrlSetOnEvent($Button2, "Hide") GUICtrlSetOnEvent($Button3, "Show") GUISetState(@SW_SHOW) Pause() Send("l") Sleep(1000) MouseDown("left") MouseUp("left") Sleep(500) MouseDown("left") Sleep(6500) MouseUp("left") Sleep(100) While 1 Sleep(100) WEnd Func PauseByHotKey() If $Paused Then $IsHotkey = 1 Pause() EndFunc Func Pause() Opt("GuiOnEventMode", 0) GUICtrlSetData($Button1, "Start") $Paused = 1 While $Paused Sleep(10) $Msg = GUIGetMsg() ToolTip('Script is "Paused"',0,0) If $Msg = $Button1 Or $IsHotkey = 1 Then ExitLoop WEnd $IsHotkey = 0 $Paused = 0 ToolTip("") Opt("GuiOnEventMode", 1) GUICtrlSetData($Button1, "Pause") EndFunc Func Hide() GUISetState(@SW_HIDE) EndFunc Func Show() GUISetState(@SW_SHOW) EndFunc Func Escape() Exit EndFuncI have change a litle the way that script works - now the Start/Paused name is shown when needed.What for you need the lines with Send and MouseDown(Up) in the script? what they do? Edited February 6, 2007 by MsCreatoR Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
trol4ever Posted February 6, 2007 Author Share Posted February 6, 2007 (edited) actually this is a normal recorded script to fish in 2Moons Online. But can u explain me pls what u did in the script ? and how can i start my script autopaused . .. so i can start it whenever i want? Edited February 6, 2007 by trol4ever Link to comment Share on other sites More sharing options...
MrCreatoR Posted February 6, 2007 Share Posted February 6, 2007 trol4everBut can u explain me pls what u did in the script ?Sorry, my english is not wery good, but i try...In the begining of the script, i put Opt("GuiOnEventMode", 1), this allow to script “know” that the control is defined as event, and then i write the funcs:GUISetOnEvent($GUI_EVENT_CLOSE, "Escape")GUICtrlSetOnEvent($Button1, "Pause")GUICtrlSetOnEvent($Button2, "Hide")GUICtrlSetOnEvent($Button3, "Show")Weach is “says” to script that functions will executed when you press some button or use other control.And the loop itself is just for holding the script runed - the Sleep(100) is nesessary to avoiding CPU load.The OnEvent funcs is like the HotkeySet functions, it use UDF (User Defined Functions) to complish needed effects (needed actions of the script, etc).Don't try to understand all concepts at once, it will come to you with time (if you continue to learn).I hope i explain this in way that you understand :"> how can i start my script autopausedJust after the GUISetState(@SW_SHOW) put the function Pause(), it will execute the pause process after the GUI is shown... (i have change my previous post that you can see how to do it - i just added Pause()). Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
trol4ever Posted February 7, 2007 Author Share Posted February 7, 2007 thank you ... you are very kind to help a noob like me I apeciate you . Link to comment Share on other sites More sharing options...
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