mini
Active Members-
Posts
85 -
Joined
-
Last visited
About mini
- Birthday 05/29/1979
mini's Achievements
Wayfarer (2/7)
0
Reputation
-
[SOLVED] Use button to execute one Excel file
mini replied to mini's topic in AutoIt General Help and Support
Thank you very much. -
[SOLVED] Use button to execute one Excel file
mini posted a topic in AutoIt General Help and Support
Hello all. Its been quite some time I don't use AutoIT. Well, only the button "Open" and "Fechar" are working, my main problem now is, I am not been able to "execute/open" a Excel file that already exists. I can select it, but can't make it to open like double clicking. Here's my code, hope that some one can help me. Thanks in advance, mini. #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Excel.au3> Opt("GUIOnEventMode", 1) #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Dialog", 368, 203) GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close") GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form1Minimize") GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Form1Maximize") GUISetOnEvent($GUI_EVENT_RESTORE, "Form1Restore") $Procurar = GUICtrlCreateButton("&Procurar", 285, 11, 75, 25, $WS_GROUP) GUICtrlSetOnEvent(-1, "Procurar") $Adicionar = GUICtrlCreateButton("&Adicionar", 285, 44, 75, 25, $WS_GROUP) GUICtrlSetOnEvent(-1, "Adicionar") $Fechar = GUICtrlCreateButton("&Fechar", 285, 76, 75, 25, $WS_GROUP) GUICtrlSetOnEvent(-1, "Fechar") $Open = GUICtrlCreateButton("&Open", 285, 105, 75, 25, $WS_GROUP) GUICtrlSetOnEvent(-1, "_Open") $Edit1 = GUICtrlCreateEdit("", 8, 8, 273, 185) GUICtrlSetData(-1, "Edit1") GUICtrlSetOnEvent(-1, "Edit1Change") $Input1 = GUICtrlCreateInput("Modelo", 288, 136, 73, 21) GUICtrlSetOnEvent(-1, "Input1Change") $DB_Dir = GUICtrlCreateInput("", 288, 136, 1, 1) GUICtrlSetOnEvent(-1, "Input1Change") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Dim $File While 1 Sleep(100) WEnd Func Procurar() EndFunc ;==>Procurar Func Adicionar() EndFunc ;==>Adicionar Func _Open() ;~ $File = FileOpenDialog("Abrir ficheiro DB", "", "(*.xls;*.xlsx;*.xlsm)") $File = FileOpenDialog(@ScriptDir & "\", "", "(*.xls;*.xlsx;*.xlsm)") If FileExists($File) Then GUICtrlSetData($Input1, $File) Else Run(GUICtrlRead($Input1)) EndIf ;~ $File = FileOpenDialog("Abrir ficheiro DB", "", "Ficheiros Excell(*.xls;*.xlsx;*.xlsm)") ;~ If FileExists($File) Then ;~ GUICtrlSetData($Input1, $File) ;~ Sleep (5000) ;~ _Abrir() ;~ EndIf EndFunc ;==>_Open ;~ Func _Abrir() ;~ run("excel.exe") ;~ EndFunc ;==>_Abrir Func Fechar() $answer = MsgBox(36, "Aviso", "Quer mesmo sair?", 8) If $answer = 6 Then Exit EndIf EndFunc ;==>Fechar Func Edit1Change() EndFunc ;==>Edit1Change Func Form1Close() $answer = MsgBox(36, "Aviso", "Quer mesmo sair?", 8) If $answer = 6 Then Exit EndIf EndFunc ;==>Form1Close Func Form1Maximize() EndFunc ;==>Form1Maximize Func Form1Minimize() EndFunc ;==>Form1Minimize Func Form1Restore() EndFunc ;==>Form1Restore Func Input1Change() EndFunc ;==>Input1Change -
Thanks guys... I let this work In pause, because i wasn't understanding how it wood work. Finally today i did it, i changed all my TryItemText and my ButtonText, and all the Func's are working perfectly. Thanks once again for your replays.
-
WOW I'm getting a BRAIN I did it all alone Thanks for .... (reading this thread) hehehe
-
Hello guys, yesterday I found a GUI that change the text on the Start Button and it have a "While" and some "Func" to do. Here's a Thread replayed from M23 http://www.autoitscript.com/forum/index.php?showtopic=103733&view=findpost&p=735761 And I'm trying to make my GUI to work like that one... Or to change the the button name, here's a test GUI: #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Constants.au3> ;<================================================================================== Opt("TrayMenuMode", 1) ; Default tray menu items (Script Paused/Exit) will not be shown. Opt("TrayOnEventMode", 1) ;~ Opt('MustDeclareVars', 1) TraySetOnEvent($TRAY_EVENT_PRIMARYUP, "On_Show") ;~ <================================================================================== Global $Action_Button ;~ <================================================================================== $Form1 = GUICreate("Swapper", 373, 305) $Action_Button = GUICtrlCreateButton("Start", 75, 270, 50, 25) ;~ <================================================================================== $traget1 = GUICtrlCreateCheckbox("", 10, 16, 14, 20) $tragetInput1 = GUICtrlCreateInput("Target 1", 30, 16, 83, 20) ;~ <================================================================================== $traget2 = GUICtrlCreateCheckbox("", 136, 16, 14, 20) $tragetInput2 = GUICtrlCreateInput("Target 2", 158, 16, 83, 20) ;~ <================================================================================== $traget3 = GUICtrlCreateCheckbox("", 264, 16, 14, 20) $tragetInput3 = GUICtrlCreateInput("Target 3", 285, 16, 83, 20) ;~ <================================================================================== $Sleep_Time = GUICtrlCreateInput("1", 250, 270, 40, 21) ;~ <================================================================================== GUISetState(@SW_SHOW) ;~ <================================================================================== Dim $Action_Button = 0 While 1 ;Code Switch GUIGetMsg() Case -3 _Check4CLOSEClicked() Case $GUI_EVENT_MINIMIZE GUISetState(@SW_HIDE, $Form1) Case $Action_Button _Action() EndSwitch WEnd ;~ <================================================================================== Func _Action() Local $iBegin Switch GUICtrlRead($Action_Button) Case "Start" GUICtrlSetData($Action_Button, "Stop") ; <<<<<<<<<<<<<<<<<<<<<<<<<<<< Your original script starts here While 1 If Action_Check() Then ContinueCase ; <<<<<<<<<<< If Stop button pressed, move to that Case If $Action_Button = 1 And GUICtrlRead($traget1) = 1 Then ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ConsoleWrite("Trg1" & @CRLF) _Delayer() EndIf If $Action_Button = 1 And GUICtrlRead($traget2) = 1 Then ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ConsoleWrite("Trg2" & @CRLF) _Delayer() EndIf If $Action_Button = 1 And GUICtrlRead($traget3) = 1 Then ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ConsoleWrite("Trg3" & @CRLF) _Delayer() EndIf If Action_Check() Then ContinueCase ; <<<<<<<<<<< If Stop button pressed, move to that Case WEnd Case "Stop" GUICtrlSetData($Action_Button, "Start") EndSwitch EndFunc ;==>_Action ;~ <================================================================================== Func Action_Check() Switch GUIGetMsg() Case $Action_Button Return 1 ; <<<<<<<<<<<<<<<< The Stop button was pressed, so return a flag EndSwitch Return 0 ; <<<<<<<<<<<<<<<<<<<<<<<<< Nothing pressed so ensure no flag returned EndFunc ;==>Action_Check ;~ <================================================================================== Func _Delayer() $idBegin = TimerInit() ; Get a timestamp Do ; Loop until Switch GUIGetMsg() ; Check the valid events (no point in looking for Start as we are already running!) Case -3 Exit ;~ Case $Button_Stop ;~ _Check4Stop() ExitLoop EndSwitch Until TimerDiff($idBegin) > GUICtrlRead($Sleep_Time) * 60000 ; Check if 5 secs have elapsed EndFunc ;==>_Delayer ;~ <================================================================================== Func _Check4CLOSEClicked();Exit Opt("WinTitleMatchMode", 2) ; Match substring WinSetTrans("Swapper", "", 0) $answer = MsgBox(36, "Warning", "Close??", 8) WinSetTrans("Swapper", "", 255) If $answer = 6 Then Exit EndIf EndFunc ;==>_Check4CLOSEClicked ;~ <================================================================================== Func On_Show() GUISetState(@SW_SHOW, $Form1) EndFunc ;==>On_Show ;~ <================================================================================== If you guys want my Original GUI, just ask please. Thank you for all replays.
-
[SOLVED]On execution of GUI autoload INI ERROR Syntax.
mini replied to mini's topic in AutoIt General Help and Support
BAHHH, and i wasn't understanding you replay... and them came the "light" =P i was missing 1 big Fat -->> ) I'm blind some times =P Thx for fast replay friend. -
Hello AutoIT'ers. Today i decided to make a little change on my GUI, but i encounter a Error that i cant understand why its happening. Maybe you guys can see the error more easy then me. I try in two different ways to see if it worked, i can load all the rest of the ini info to my GUI. Sow here's the syntax error: C:\Documents and Settings\ras00l\Desktop\SBot_AC\Sbot\Swapper.au3(102,97) : ERROR: syntax error $iRead = GUICtrlSetState($KS1, IniRead("example.ini", "KS,SD", "KS1", "4") If i change $iRead = GUICtrlSetState to GUICtrlSetState(bla bla bla) i get error to... can some one explain to me what am I doing wrong please. Here's my code: #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("AUTO LOAD INI", 373, 305) $hInput1 = GUICtrlCreateInput("", 16, 8, 121, 21) $hInput2 = GUICtrlCreateInput("", 16, 48, 121, 21) $hInput3 = GUICtrlCreateInput("", 16, 80, 121, 21) $KS1 = GUICtrlCreateCheckbox("KS", 10, 170, 110, 17) $Button_Save = GUICtrlCreateButton("Save", 75, 270, 50, 25) $iRead = GUICtrlSetData($hInput1, IniRead("example.ini", "example", "First_name", "N/A")) $iRead = GUICtrlSetData($hInput2, IniRead(@ScriptDir & "\example.ini", "example", "Data", "N/A")) $iRead = GUICtrlSetData($hInput3, IniRead(@ScriptDir & "\example.ini", "example", 3, "N/A")) $iRead = GUICtrlSetState($KS1, IniRead("example.ini", "KS,SD", "KS1", "4") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button_Save _Check4Start() EndSwitch WEnd Func _Check4Start() IniWrite("example.ini", "example", "First_name", GUICtrlRead($hInput1)) IniWrite(@ScriptDir & "\example.ini", "example", "Data", GUICtrlRead($hInput2)) IniWrite("example.ini", "example", "3", GUICtrlRead($hInput3)) IniWrite("example.ini", "KS,SD", "KS1", GUICtrlRead($KS1)) EndFunc ;==>_Check4Start
-
Thanks for your replays guys... @ AdmiralAlkex Your code is more simple, i think its better for my Gui, since I'm not a good coder. Still learning how does this all work. @ PsaltyDS I don't think i can menage to use your code on my Gui. That was just a "test run" to see how i change the text of buttons, now i need to implement them on my MAIN code, and hope i can understand (if it doesn't work) how it works. Thank you two very much for the code/help. Regards.
-
Hi again... well i've been able to change the text to STOP when i press the Start Button... But I'm missing to much code to make it back if the button is pressed again, can some one help me on it please. #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 373, 305) $Button_Start = GUICtrlCreateButton("Start", 75, 270, 50, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch GUIGetMsg() ; Check the valid events (no point in looking for Start as we are already running!) Case -3 Exit Case $Button_Start _Check4Start() EndSwitch WEnd Func _Check4Start() guictrlsetdata($Button_Start,"Stop") EndFunc ;==>_Check4Start
-
Heys all... Well I've seen in some others GUI that wen we press the Yes button or the Start Button, the same button change to NO/Stop... How can i make that on my buttons!?!? BTW and if i have a "TrayCreatItem" how can i make the same on that to!! Thanks for all the replays.
-
Help How can i make counter go back to Countdown
mini replied to mini's topic in AutoIt General Help and Support
wow nice bro, thanks very much.... :) But i try to put it on my code, and it can read my Delayer time, but it stops to work after 3, 4 sec's... I don't know how to work around it, sow i think I'm not going to use it... Unless your up to make it work on my Gui. If your interested on trying to make it, her's my code: #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon= #AutoIt3Wrapper_Outfile=Sbot Training Swapper.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Constants.au3> ;<================================================================================== Opt("TrayMenuMode", 1) ; Default tray menu items (Script Paused/Exit) will not be shown. Opt("TrayOnEventMode", 1) TraySetOnEvent($TRAY_EVENT_PRIMARYUP, "On_Show") ;<================================================================================== #Region TrayCreateItem("") $StartItem = TrayCreateItem("Start") $StopItem = TrayCreateItem("Stop") TrayCreateItem("") $RestoreSbotItem = TrayCreateItem("Show Sbot") $HideSbotItem = TrayCreateItem("Hide Sbot") TrayCreateItem("") $RestoreSROItem = TrayCreateItem("Show SRO") $HideSROItem = TrayCreateItem("Hide SRO") TrayCreateItem("") $RestoreItem = TrayCreateItem("Restore Swapper") $HideItem = TrayCreateItem("Hide Swapper") TrayCreateItem("") $ExitItem = TrayCreateItem("Exit") TrayCreateItem("") #EndRegion ;<================================================================================== #Region $TrayStartItem = TrayItemSetOnEvent($StartItem, "_Check4Start") $TrayStopItem = TrayItemSetOnEvent($StopItem, "_Check4Stop") $TrayRestoreSbotItem = TrayItemSetOnEvent($RestoreSbotItem, "_Check4ShowSbot") $TrayHideSbotItem = TrayItemSetOnEvent($HideSbotItem, "_Check4HideSbot") $TrayRestoreSROItem = TrayItemSetOnEvent($RestoreSROItem, "_Check4ShowSRO") $TrayHideSROItem = TrayItemSetOnEvent($HideSROItem, "_Check4HideSRO") $TrayRestoreItem = TrayItemSetOnEvent($RestoreItem, "_Check4Restore") $TrayHideItem = TrayItemSetOnEvent($HideItem, "_Check4Hide") $TrayExitItem = TrayItemSetOnEvent($ExitItem, "_Check4CLOSEClicked") #EndRegion ;~ <================================================================================== #Region $sINI = @ScriptDir & "\" $Form1 = GUICreate("Sbot Training Swapper", 373, 305) $Button_Start = GUICtrlCreateButton("Start", 75, 270, 50, 25) $Button_Stop = GUICtrlCreateButton("Stop", 130, 270, 50, 25) $training1 = GUICtrlCreateCheckbox("Training place 1", 16, 16, 97, 17) $training2 = GUICtrlCreateCheckbox(" Training place 2", 136, 16, 97, 17) $training3 = GUICtrlCreateCheckbox("Training place 3", 264, 16, 97, 17) $TimeLabel1 = GUICtrlCreateLabel("", 300, 273, 60, 21) ;~ < ;~ $KS1 = GUICtrlCreateCheckbox("Do Kill Still", 10, 170, 97, 17) ;~ $StayTillDead1 = GUICtrlCreateCheckbox(" Stay Till Mob Dead", 10, 190, 110, 17) ;~ $KS2 = GUICtrlCreateCheckbox("Do Kill Still", 130, 170, 97, 17) ;~ $StayTillDead2 = GUICtrlCreateCheckbox(" Stay Till Mob Dead", 130, 190, 110, 17) ;~ $KS3 = GUICtrlCreateCheckbox("Do Kill Still", 260, 170, 97, 17) ;~ $StayTillDead3 = GUICtrlCreateCheckbox(" Stay Till Mob Dead", 260, 190, 110, 17) ;~ < $Input1A = GUICtrlCreateInput("", 8, 48, 105, 21) $Input2A = GUICtrlCreateInput("", 8, 78, 105, 21) $Input3A = GUICtrlCreateInput("", 8, 108, 105, 21) $Input4A = GUICtrlCreateInput("", 8, 138, 105, 21) $Input1B = GUICtrlCreateInput("", 136, 48, 105, 21) $Input2B = GUICtrlCreateInput("", 136, 78, 105, 21) $Input3B = GUICtrlCreateInput("", 136, 108, 105, 21) $Input4B = GUICtrlCreateInput("", 136, 138, 105, 21) $Input1C = GUICtrlCreateInput("", 264, 48, 105, 21) $Input2C = GUICtrlCreateInput("", 264, 78, 105, 21) $Input3C = GUICtrlCreateInput("", 264, 108, 105, 21) $Input4C = GUICtrlCreateInput("", 264, 138, 105, 21) $Input_Sbot_Name = GUICtrlCreateInput("", 70, 220, 100, 21) $Label1 = GUICtrlCreateLabel("Sbot Name", 13, 225, 57, 17) $Input_SRO_Name = GUICtrlCreateInput("", 250, 220, 105, 21) $Label3 = GUICtrlCreateLabel("SRO Name", 180, 225, 57, 17) $Label2 = GUICtrlCreateLabel("Time to switch traning place, time in min, 60m = 1H", 15, 245, 289, 17) $Sleep_Time = GUICtrlCreateInput("", 250, 270, 40, 21) #EndRegion ;<================================================================================== #Region $iRead = GUICtrlSetData($Input1A, IniRead("Sbot Training Swapper.ini", "TrainingA", "$Input1A", "Coor. X")) $iRead = GUICtrlSetData($Input2A, IniRead("Sbot Training Swapper.ini", "TrainingA", "$Input2A", "Coor. Y")) $iRead = GUICtrlSetData($Input3A, IniRead("Sbot Training Swapper.ini", "TrainingA", "$Input3A", "Coor. Z")) $iRead = GUICtrlSetData($Input4A, IniRead("Sbot Training Swapper.ini", "TrainingA", "$Input4A", "Range")) $iRead = GUICtrlSetData($Input1B, IniRead("Sbot Training Swapper.ini", "TrainingB", "$Input1B", "Coor. X")) $iRead = GUICtrlSetData($Input2B, IniRead("Sbot Training Swapper.ini", "TrainingB", "$Input2B", "Coor. Y")) $iRead = GUICtrlSetData($Input3B, IniRead("Sbot Training Swapper.ini", "TrainingB", "$Input3B", "Coor. Z")) $iRead = GUICtrlSetData($Input4B, IniRead("Sbot Training Swapper.ini", "TrainingB", "$Input4B", "Range")) $iRead = GUICtrlSetData($Input1C, IniRead("Sbot Training Swapper.ini", "TrainingC", "$Input1C", "Coor. X")) $iRead = GUICtrlSetData($Input2C, IniRead("Sbot Training Swapper.ini", "TrainingC", "$Input2C", "Coor. Y")) $iRead = GUICtrlSetData($Input3C, IniRead("Sbot Training Swapper.ini", "TrainingC", "$Input3C", "Coor. Z")) $iRead = GUICtrlSetData($Input4C, IniRead("Sbot Training Swapper.ini", "TrainingC", "$Input4C", "Range")) $iRead = GUICtrlSetData($Input_Sbot_Name, IniRead("Sbot Training Swapper.ini", "$Input_Sbot_Name", "$Input_Sbot_Name", "[X" & "X] SBot v1.66 (C)2008,2009 by bot-cave.net")) $iRead = GUICtrlSetData($Input_SRO_Name, IniRead("Sbot Training Swapper.ini", "$Input_SRO_Name", "$Input_SRO_Name", "SRO_Client [X" & "X]")) $iRead = GUICtrlSetData($Sleep_Time, IniRead("Sbot Training Swapper.ini", "$Sleep_Time", "$Sleep_Time", "60")) #EndRegion ;<================================================================================== ;~ ControlCommand ( GUICtrlRead($Input_Sbot_Name), "text", controlID, "IsChecked" ) GUISetState(@SW_SHOW) ;<================================================================================== Dim $Start = 0 While 1 ;Code Switch GUIGetMsg() Case -3 _Check4CLOSEClicked() Case $GUI_EVENT_MINIMIZE GUISetState(@SW_HIDE, $Form1) Case $Button_Stop _Check4Stop() Case $Button_Start _Check4Start() EndSwitch If $Start = 1 And GUICtrlRead($training1) = 1 Then ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ConsoleWrite("Trg1" & @CRLF) ;#cs ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:40]", "{DEL 10}") ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:40]", "{BS 10}") ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:40]", GUICtrlRead($Input1A)) ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:42]", "{DEL 10}") ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:42]", "{BS 10}") ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:42]", GUICtrlRead($Input2A)) ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:43]", "{DEL 10}") ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:43]", "{BS 10}") ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:43]", GUICtrlRead($Input3A)) ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:41]", "{DEL 10}") ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:41]", "{BS 10}") ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:41]", GUICtrlRead($Input4A)) WinSetState(GUICtrlRead($Input_Sbot_Name), "", @SW_MINIMIZE) WinActivate(ControlSend(GUICtrlRead($Input_Sbot_Name), "Save settings", "[CLASS:Button; INSTANCE:192]", "{SPACE 5}")) WinActivate(ControlSend(GUICtrlRead($Input_Sbot_Name), "Stop training", "[CLASS:Button; INSTANCE:195]", "{SPACE 5}")) WinActivate(ControlSend(GUICtrlRead($Input_Sbot_Name), "Start training", "[CLASS:Button; INSTANCE:194]", "{SPACE 5}")) WinActivate(ControlSend(GUICtrlRead($Input_Sbot_Name), "Start training", "[CLASS:Button; INSTANCE:191]", "{SPACE 5}")) WinSetState(GUICtrlRead($Input_Sbot_Name), "", @SW_HIDE) ;#ce _Delayer() EndIf If $Start = 1 And GUICtrlRead($training2) = 1 Then ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ConsoleWrite("Trg2" & @CRLF) ;#cs ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:40]", "{DEL 10}") ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:40]", "{BS 10}") ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:40]", GUICtrlRead($Input1B)) ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:42]", "{DEL 10}") ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:42]", "{BS 10}") ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:42]", GUICtrlRead($Input2B)) ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:43]", "{DEL 10}") ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:43]", "{BS 10}") ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:43]", GUICtrlRead($Input3B)) ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:41]", "{DEL 10}") ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:41]", "{BS 10}") ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:41]", GUICtrlRead($Input4B)) WinSetState(GUICtrlRead($Input_Sbot_Name), "", @SW_MINIMIZE) WinActivate(ControlSend(GUICtrlRead($Input_Sbot_Name), "Save settings", "[CLASS:Button; INSTANCE:192]", "{SPACE 5}")) WinActivate(ControlSend(GUICtrlRead($Input_Sbot_Name), "Stop training", "[CLASS:Button; INSTANCE:195]", "{SPACE 5}")) WinActivate(ControlSend(GUICtrlRead($Input_Sbot_Name), "Start training", "[CLASS:Button; INSTANCE:194]", "{SPACE 5}")) WinActivate(ControlSend(GUICtrlRead($Input_Sbot_Name), "Start training", "[CLASS:Button; INSTANCE:191]", "{SPACE 5}")) WinSetState(GUICtrlRead($Input_Sbot_Name), "", @SW_HIDE) ;#ce _Delayer() EndIf If $Start = 1 And GUICtrlRead($training3) = 1 Then ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ConsoleWrite("Trg3" & @CRLF) ;#cs ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:40]", "{DEL 10}") ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:40]", "{BS 10}") ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:40]", GUICtrlRead($Input1C)) ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:42]", "{DEL 10}") ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:42]", "{BS 10}") ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:42]", GUICtrlRead($Input2C)) ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:43]", "{DEL 10}") ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:43]", "{BS 10}") ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:43]", GUICtrlRead($Input3C)) ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:41]", "{DEL 10}") ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:41]", "{BS 10}") ControlSend(GUICtrlRead($Input_Sbot_Name), "", "[CLASS:Edit; INSTANCE:41]", GUICtrlRead($Input4C)) WinSetState(GUICtrlRead($Input_Sbot_Name), "", @SW_MINIMIZE) WinActivate(ControlSend(GUICtrlRead($Input_Sbot_Name), "Save settings", "[CLASS:Button; INSTANCE:192]", "{SPACE 5}")) WinActivate(ControlSend(GUICtrlRead($Input_Sbot_Name), "Stop training", "[CLASS:Button; INSTANCE:195]", "{SPACE 5}")) WinActivate(ControlSend(GUICtrlRead($Input_Sbot_Name), "Start training", "[CLASS:Button; INSTANCE:194]", "{SPACE 5}")) WinActivate(ControlSend(GUICtrlRead($Input_Sbot_Name), "Start training", "[CLASS:Button; INSTANCE:191]", "{SPACE 5}")) WinSetState(GUICtrlRead($Input_Sbot_Name), "", @SW_HIDE) ;#ce _Delayer() EndIf WEnd ;<================================================================================== Func _Check4Restore() WinSetState("Sbot Training Swapper", "", @SW_MINIMIZE) EndFunc ;==>_Check4Restore ;<================================================================================== Func _Check4Hide() WinSetState("Sbot Training Swapper", "", @SW_HIDE) EndFunc ;==>_Check4Hide ;<================================================================================== Func _Delayer() $iBegin = TimerInit() ; Get a timestamp Do ; Loop until Switch GUIGetMsg() ; Check the valid events (no point in looking for Start as we are already running!) Case -3 Exit Case $Button_Stop _Check4Stop() ExitLoop EndSwitch Until TimerDiff($iBegin) > GUICtrlRead($Sleep_Time) * 60000 ; Check if 5 secs have elapsed EndFunc ;==>_Delayer ;<================================================================================== Func _Check4HideSbot() WinSetState(GUICtrlRead($Input_Sbot_Name), "", @SW_HIDE) EndFunc ;==>_Check4HideSbot ;<================================================================================== Func _Check4ShowSbot() WinSetState(GUICtrlRead($Input_Sbot_Name), "", @SW_MINIMIZE) EndFunc ;==>_Check4ShowSbot ;<================================================================================== Func _Check4HideSRO() WinSetState(GUICtrlRead($Input_SRO_Name), "", @SW_HIDE) EndFunc ;==>_Check4HideSRO ;<================================================================================== Func _Check4ShowSRO() WinSetState(GUICtrlRead($Input_SRO_Name), "", @SW_RESTORE) EndFunc ;==>_Check4ShowSRO ;<================================================================================== Func _Check4Start() $Start = 1 TrayTip("", "Started", 3, 0) #region IniWrite("Sbot Training Swapper.ini", "TrainingA", "$Input1A", GUICtrlRead($Input1A)) IniWrite("Sbot Training Swapper.ini", "TrainingA", "$Input2A", GUICtrlRead($Input2A)) IniWrite("Sbot Training Swapper.ini", "TrainingA", "$Input3A", GUICtrlRead($Input3A)) IniWrite("Sbot Training Swapper.ini", "TrainingA", "$Input4A", GUICtrlRead($Input4A)) IniWrite("Sbot Training Swapper.ini", "TrainingB", "$Input1B", GUICtrlRead($Input1B)) IniWrite("Sbot Training Swapper.ini", "TrainingB", "$Input2B", GUICtrlRead($Input2B)) IniWrite("Sbot Training Swapper.ini", "TrainingB", "$Input3B", GUICtrlRead($Input3B)) IniWrite("Sbot Training Swapper.ini", "TrainingB", "$Input4B", GUICtrlRead($Input4B)) IniWrite("Sbot Training Swapper.ini", "TrainingC", "$Input1C", GUICtrlRead($Input1C)) IniWrite("Sbot Training Swapper.ini", "TrainingC", "$Input2C", GUICtrlRead($Input2C)) IniWrite("Sbot Training Swapper.ini", "TrainingC", "$Input3C", GUICtrlRead($Input3C)) IniWrite("Sbot Training Swapper.ini", "TrainingC", "$Input4C", GUICtrlRead($Input4C)) IniWrite("Sbot Training Swapper.ini", "$Input_Sbot_Name", "$Input_Sbot_Name", GUICtrlRead($Input_Sbot_Name)) IniWrite("Sbot Training Swapper.ini", "$Input_SRO_Name", "$Input_SRO_Name", GUICtrlRead($Input_SRO_Name)) IniWrite("Sbot Training Swapper.ini", "$Sleep_Time", "$Sleep_Time", GUICtrlRead($Sleep_Time)) EndFunc ;==>_Check4Start ;<================================================================================== Func _Check4Stop() $Start = 0 TrayTip("", "Stopped", 3, 0) EndFunc ;==>_Check4Stop ;<================================================================================== Func _Check4CLOSEClicked();Exit Opt("WinTitleMatchMode", 2) ; Match substring WinSetTrans("Sbot Training Swapper", "", 0) $answer = MsgBox(36, "Warning", "Close??", 8) WinSetTrans("Sbot Training Swapper", "", 255) If $answer = 6 Then WinSetState(GUICtrlRead($Input_Sbot_Name), "", @SW_MINIMIZE) Exit EndIf EndFunc ;==>_Check4CLOSEClicked ;<================================================================================== Func On_Show() GUISetState(@SW_SHOW, $Form1) EndFunc ;==>On_Show ;<================================================================================== -
Hello guys. I found this Code that countdown min, but when it rich 0, it continues to countdown to -1,-2 and sow on... How can i change the code to restart counting back from 1min?? I didn't made the code and i don't understand it very well. I'm trying to put it on my GUI because my GUI have some Delayer timer. Here's the code i found: #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("AForm1", 122, 42, 438, 156) $Label1 = GUICtrlCreateLabel("15:00", 8, 8, 43, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $time=TimerInit() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch $new = TimerDiff ($time) $new = (1*60*1000)-$new $seconds = Round ($new/1000) $newMin = Floor ($seconds/60) $newSec = Mod ($seconds, 60) If $newSec < 10 Then $newSec = "0"&$newSec GUICtrlSetData ($Label1, $newMin&":"&$newSec) WEnd Thanks for all replays and help.
-
[SOLVED] Question about autoload INI settings
mini replied to mini's topic in AutoIt General Help and Support
Solution #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("AUTO LOAD INI", 373, 305) $hInput1 = GUICtrlCreateInput("", 16, 8, 121, 21) $hInput2 = GUICtrlCreateInput("", 16, 48, 121, 21) $hInput3 = GUICtrlCreateInput("", 16, 80, 121, 21) $Button_Save = GUICtrlCreateButton("Save", 75, 270, 50, 25) $iRead = GUICtrlSetData($hInput1, IniRead("example.ini", "example", "First_name", "N/A")) $iRead = GUICtrlSetData($hInput2, IniRead(@ScriptDir & "\example.ini", "example", "Data", "N/A")) $iRead = GUICtrlSetData($hInput3, IniRead(@ScriptDir & "\example.ini", "example", 3, "N/A")) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button_Save _Check4Start() EndSwitch WEnd Func _Check4Start() IniWrite("example.ini", "example", "First_name", GUICtrlRead($hInput1)) IniWrite(@ScriptDir & "\example.ini", "example", "Data", GUICtrlRead($hInput2)) IniWrite("example.ini", "example", "3", GUICtrlRead($hInput3)) EndFunc ;==>_Check4Start -
[SOLVED] Question about autoload INI settings
mini replied to mini's topic in AutoIt General Help and Support
Hello guys, please help me on this. I'm not understanding how can I make it to work -
[SOLVED] Question about autoload INI settings
mini replied to mini's topic in AutoIt General Help and Support
Hi Kaotkbliss... Or I'm a real failure on coding and i must start thinking that i must stop from now on, or I'm Dumb.... I can't make your example to work... Here's what i have: #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 153, 114, 192, 124) $first = GUICtrlCreateInput("", 16, 8, 121, 21) $second = GUICtrlCreateInput("", 16, 48, 121, 21) $third = GUICtrlCreateInput("", 16, 80, 121, 21) $first = IniRead(@ScriptDir & "\example.ini", "example", 1, "") $second = IniRead(@ScriptDir & "\example.ini", "example", 2, "") $third = IniRead(@ScriptDir & "\example.ini", "example", 3, "") ;inputbox("","",$first) ;inputbox("","",$second) ;inputbox("","",$third) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Help me on that please. EDIT: I cant figure out where I put on my "GuiCtrlInput" the "$first"