Jump to content

tooltip timer problems


Recommended Posts

Ok I'm gonna provide 2 codes 1 is my main script that is automating a piece of an autoit application which is the 2nd code. When it was created at first it was going to be for well games that I create or recode then I decided to change it into a multipurpose tool for the app which will probably turn into an autoit/javascript combo game or something not sure yet making each piece of the application as i make the bot to fully test for errors.

How this is set up the bot script looks for a desktop shortcut of the window script then runs it also be sure to read the Discription in the header for more info.

Problems with the bot part are found in the Hotkey Function Area and commented on of what i have tried. Every piece of code is clearly labeled as i could with my limited knowledge of what everything does (especially GUIs).

Bot Script ::

; =====================================================
; Title .........: Window Opener
; Script Version : 1.0.1
; Date Created ..: July 29th, 2015
; AutoIt Version : 3.5.4
; Description ...: Window opener with INI file. To start the script either edit the start script area or press F1 once running.
; Author(s) .....: xxaviarxx
; Infomation ....: I tried to label each and every thing in this script so everyone would know what everything does (That I knew about at least).
; Disclaimer ....: I am now using this for my own personal applications that I code/recode and do not condone any use of any script that violates any person(s) application's ToS/EULA. That being said I hope you enjoy the script either as reference material or as something you could use to complete your own.
; Credits .......: Melba23 (for helping me fix the 1st INI/GUI problem(s) I was having), Autoit websites help files and programs
; =====================================================

; =====================================================
; Start Includes
; =====================================================

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

; =====================================================
; End Includes
; =====================================================

; =====================================================
; Start Global Variables
; =====================================================

Global $iniWindowTitle = IniRead(@ScriptDir & "\Settings.ini", "Window Info", "Window Name", "") ; sets the name of the window for everything from ini
Global $iniShortcutTitle = IniRead(@ScriptDir & "\Settings.ini", "Window Info", "Window Shortcut", "") ; sets the name of the shortcut icon on the desktop from ini
Global $iniUsernameControl = IniRead(@ScriptDir & "\Settings.ini", "Window Info", "Window Username Control", "") ; sets the name of the username control id from ini
Global $iniPasswordControl = IniRead(@ScriptDir & "\Settings.ini", "Window Info", "Window Password Control", "") ; sets the name of the password control id from ini
Global $iniUsername = IniRead(@ScriptDir & "\Settings.ini", "Login Info", "Username", "") ; reads the username from the ini file and sets it as the variable
Global $iniPassword = IniRead(@ScriptDir & "\Settings.ini", "Login Info", "Password", "") ; reads the password from the ini file and sets it as the variable
Global $iniPlay = IniRead(@ScriptDir & "\Settings.ini", "Hotkey Info", "Play Hotkey", "") ; sets the hotkey of the playscript function from ini
Global $iniPause = IniRead(@ScriptDir & "\Settings.ini", "Hotkey Info", "Pause Hotkey", "") ; sets the hotkey of the pausescript function from ini
Global $iniStop = IniRead(@ScriptDir & "\Settings.ini", "Hotkey Info", "Stop Hotkey", "") ; sets the hotkey of the stopscript function from ini

Global $windowTitleInput = $iniWindowTitle ; sets the window input area of the dialog editor to be the same as the ini
Global $shortcutNameInput = $iniShortcutTitle ; sets the shortcut input area of the dialog editor to be the same as the ini
Global $usernameControlInput = $iniUsernameControl ; sets the usercontrol input area of the dialog editor to be the same as the ini
Global $passwordControlInput = $iniPasswordControl ; sets the passcontrol input area of the dialog editor to be the same as the ini
Global $usernameInput = $iniUsername ; sets the username input area of the dialog editor to be the same as the ini
Global $passwordInput = $iniPassword ; sets the password input area of the dialog editor to be the same as the ini
Global $playInput = $iniPlay ; sets the play input area of the dialog editor to be the same as the ini
Global $pauseInput = $iniPause ; sets the pause input area of the dialog editor to be the same as the ini
Global $stopInput = $iniStop ; sets the stop input area of the dialog editor to be the same as the ini

Global $checkWin = WinExists($iniWindowTitle) ; sees if the Window is open or not
Global $Paused = False ; sets paused to not paused

Global $Form1 = 9999, $Form0 = 9999, $Submit ; something to make multiple GUI's work together

Global $wait = 1000
Global $tick1 = 0
Global $tick2 = 0
Global $i = 10
Global $hotkey = ""

; =====================================================
; End Global Variables
; =====================================================

; =====================================================
; Start Hotkeys
; =====================================================

HotKeySet($iniPlay, "StartScript") ; Starts the script when the hotkey you set is pressed
HotKeySet($iniPause, "PauseScript") ; Pauses the script when the hotkey you set is pressed
HotKeySet($iniStop, "StopScript") ; Ends the script when the hotkey you set is pressed

; =====================================================
; End Hotkeys
; =====================================================




; =====================================================
; Start Script
; =====================================================

While 1
WEnd

; =====================================================
; Start Hotkey Fuctions (tried to first in the Progress() area of my script (bottom) to fix both problems and nothing)
; =====================================================

Func StartScript()
    If @HotKeyPressed = $iniPlay Then
        $hotkey = "Started"
        SettingsControl()
        Timer() ; doesnt work here and if i try to run it as soon as Window() starts it halts the rest of the script not sure what to do
    EndIf
EndFunc   ;==>StartScript

Func PauseScript()
    $Paused = Not $Paused
    If @HotKeyPressed = $iniPause Then
        $hotkey = "Paused" ; supposed to show up in the timer tooltip when you press the pause hotkey once not twice and pause the script at the same time
        While $Paused
            Sleep(100)
        WEnd
    EndIf
EndFunc   ;==>PauseScript

Func StopScript()
    If @HotKeyPressed = $iniStop Then
        While $i >= 0
            $hotkey = "Stopping the Script in : " & $i ; supposed to do a coutdown yet doesnt show anything in the timer tooltip
            ConsoleWrite("Stopping the Script in : " & $i & @CRLF) ; this works but not what i want
            $i = $i - 1
            Sleep(1000)
        WEnd
        EndScriptCd()
    EndIf
EndFunc   ;==>StopScript

; =====================================================
; End Hotkey Fuctions
; =====================================================

; =====================================================
; Start Settings Dialog Boxes Functions
; =====================================================

Func SettingsControl()
    #Region ### START Koda GUI section ### Form=
    $Form0 = GUICreate("Settings Control", 252, 148, 192, 114)
    $Group1 = GUICtrlCreateGroup("", 0, 0, 249, 145)
    $KeepSettings = GUICtrlCreateRadio("Keep Current Settings?", 16, 16, 137, 17)
    $ChangeSettings = GUICtrlCreateRadio("Change Current Settings?", 16, 32, 145, 17)
    $OkButton = GUICtrlCreateButton("Ok", 87, 112, 75, 25)
    GUICtrlSetState(-1, $GUI_DISABLE) ; Disables the button until Keep current settings? radio is checked
    $Group2 = GUICtrlCreateGroup("", 16, 48, 217, 57)
    $ChangeIni = GUICtrlCreateRadio("Change Via INI file?", 32, 64, 137, 17)
    GUICtrlSetState(-1, $GUI_DISABLE) ; Disables radio until Change current settings? radio is checked
    $ChangeDialog = GUICtrlCreateRadio("Change Via Dialog Box?", 32, 80, 161, 17)
    GUICtrlSetState(-1, $GUI_DISABLE) ; Disables the radio until Change current settings? radio is checked
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    While 1
        $nMsg = GUIGetMsg(1)
        Switch $nMsg[1]
            Case $Form0
                Switch $nMsg[0]
                    Case $GUI_EVENT_CLOSE
                        Exit
                    Case $ChangeSettings
                        GUICtrlSetState($ChangeDialog, $GUI_ENABLE) ; enables the radio button
                        GUICtrlSetState($ChangeIni, $GUI_ENABLE) ; enables the radio button
                        GUICtrlSetState($OkButton, $GUI_DISABLE) ; disables the ok button
                    Case $KeepSettings
                        GUICtrlSetState($ChangeDialog, $GUI_DISABLE) ; disables the radio button
                        GUICtrlSetState($ChangeIni, $GUI_DISABLE) ; disables the radio button
                        GUICtrlSetState($OkButton, $GUI_ENABLE) ; enables the ok button
                    Case $OkButton
                        OkButtonClick() ; runs this function
                    Case $ChangeDialog
                        GUICtrlSetState($Form0, $GUI_DISABLE) ; disables current form when Change Via Dialog box is open
                        ChangeDialogClick() ; runs this function
                    Case $ChangeIni
                        ChangeIniClick() ; runs this function
                EndSwitch
            Case $Form1
                Switch $nMsg[0]
                    Case $GUI_EVENT_CLOSE ; closes the GUI
                        GUIDelete($Form1) ; closes the current form without closing the first form
                        GUICtrlSetState($Form0, $GUI_ENABLE) ; enables the first form again when this one is closed
                    Case $Submit
                        SubmitClick() ; Runs this function
                EndSwitch
        EndSwitch
    WEnd
EndFunc   ;==>SettingsControl

Func SettingsViaDialog()
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Enter your information", 552, 447, 192, 116)
    $Labell = GUICtrlCreateLabel("Username", 6, 8, 105, 21)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $usernameInput = GUICtrlCreateInput($iniUsername, 134, 8, 121, 21)
    GUICtrlSetTip(-1, "Insert Username Here")
    $Label2 = GUICtrlCreateLabel("Password", 6, 48, 105, 21)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $passwordInput = GUICtrlCreateInput($iniPassword, 134, 48, 121, 21)
    GUICtrlSetTip(-1, "Insert Password Here")
    $Label3 = GUICtrlCreateLabel("Window", 6, 88, 105, 21)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $windowTitleInput = GUICtrlCreateInput($iniWindowTitle, 134, 88, 121, 21)
    GUICtrlSetTip(-1, "Insert Window Title Here")
    $Label4 = GUICtrlCreateLabel("Shortcut", 6, 128, 105, 21)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $shortcutNameInput = GUICtrlCreateInput($iniShortcutTitle, 134, 128, 121, 21)
    GUICtrlSetTip(-1, "Insert Shorcut Name Here")
    $Label5 = GUICtrlCreateLabel("User Control", 6, 168, 105, 21)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $usernameControlInput = GUICtrlCreateInput($iniUsernameControl, 134, 168, 121, 21)
    GUICtrlSetTip(-1, "Insert Username Control ID Here ex: [NAME:txtUser]")
    $Label6 = GUICtrlCreateLabel("Pass Control", 6, 208, 105, 21)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $passwordControlInput = GUICtrlCreateInput($iniPasswordControl, 134, 208, 121, 21)
    GUICtrlSetTip(-1, "Insert Password Control ID Here ex: [NAME:txtPass]")
    $Label7 = GUICtrlCreateLabel("Play Hotkey", 6, 248, 105, 21)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $playInput = GUICtrlCreateInput($iniPlay, 134, 248, 121, 21)
    GUICtrlSetTip(-1, "Insert Play Hotkey Here ex: {F1}")
    $Label8 = GUICtrlCreateLabel("Pause Hotkey", 6, 288, 115, 21)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $pauseInput = GUICtrlCreateInput($iniPause, 134, 288, 121, 21)
    GUICtrlSetTip(-1, "Insert Pause Hotkey Here ex: {F2}")
    $Label9 = GUICtrlCreateLabel("Stop Hotkey", 6, 328, 105, 21)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $stopInput = GUICtrlCreateInput($iniStop, 134, 328, 121, 21)
    GUICtrlSetTip(-1, "Insert Stop Hotkey Here ex: {F3}")
    $Label10 = GUICtrlCreateLabel("Unknown1", 6, 368, 105, 21)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $UNKNOWN1 = GUICtrlCreateInput("", 134, 368, 121, 21)
    GUICtrlSetTip(-1, "UNKNOWN1 HINT")
    $Label11 = GUICtrlCreateLabel("Unknown2", 292, 9, 105, 21)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $UNKNOWN2 = GUICtrlCreateInput("", 420, 9, 121, 21)
    GUICtrlSetTip(-1, "UNKNOWN2 HINT")
    $Label12 = GUICtrlCreateLabel("Unknown3", 292, 49, 105, 21)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $UNKNOWN3 = GUICtrlCreateInput("", 420, 49, 121, 21)
    GUICtrlSetTip(-1, "UNKNOWN3 HINT")
    $Label13 = GUICtrlCreateLabel("Unknown4", 292, 89, 105, 21)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $UNKNOWN4 = GUICtrlCreateInput("", 420, 89, 121, 21)
    GUICtrlSetTip(-1, "UNKNOWN4 HINT")
    $Label14 = GUICtrlCreateLabel("Unknown5", 292, 129, 105, 21)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $UNKNOWN5 = GUICtrlCreateInput("", 420, 129, 121, 21)
    GUICtrlSetTip(-1, "UNKNOWN5 HINT")
    $Label15 = GUICtrlCreateLabel("Unknown6", 292, 169, 105, 21)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $UNKNOWN6 = GUICtrlCreateInput("", 420, 169, 121, 21)
    GUICtrlSetTip(-1, "UNKNOWN6 HINT")
    $Label16 = GUICtrlCreateLabel("Unknown7", 292, 209, 105, 21)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $UNKNOWN7 = GUICtrlCreateInput("", 420, 209, 121, 21)
    GUICtrlSetTip(-1, "UNKNOWN7 HINT")
    $Label17 = GUICtrlCreateLabel("Unknown8", 292, 249, 105, 21)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $UNKNOWN8 = GUICtrlCreateInput("", 420, 249, 121, 21)
    GUICtrlSetTip(-1, "UNKNOWN8 HINT")
    $Label18 = GUICtrlCreateLabel("Unknown9", 292, 289, 105, 21)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $UNKNOWN9 = GUICtrlCreateInput("", 420, 289, 121, 21)
    GUICtrlSetTip(-1, "UNKNOWN9 HINT")
    $Label19 = GUICtrlCreateLabel("Unknown10", 292, 329, 105, 21)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $UNKNOWN10 = GUICtrlCreateInput("", 420, 329, 121, 21)
    GUICtrlSetTip(-1, "UNKNOWN10 HINT")
    $Label20 = GUICtrlCreateLabel("Unknown11", 292, 369, 105, 21)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $UNKNOWN11 = GUICtrlCreateInput("", 420, 369, 121, 21)
    GUICtrlSetTip(-1, "UNKNOWN11 HINT")
    $Submit = GUICtrlCreateButton("Submit", 161, 409, 219, 25)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
EndFunc   ;==>SettingsViaDialog

Func SubmitClick()
    WriteToIniFile() ; runs this function
    GUIDelete($Form1) ; when Submit is pressed the form closes without closing the first form
    GUISetState() ; sets the state of the GUI
EndFunc   ;==>SubmitClick

Func ChangeDialogClick() ; what happens when you click this radio
    SettingsViaDialog() ; opens the login settings dialog box when radio is clicked
EndFunc   ;==>ChangeDialogClick

Func ChangeIniClick() ; what happens when you click this radio
    ShellExecute(@ScriptDir & "\Settings.ini") ; opens the ini file when radio is clicked
EndFunc   ;==>ChangeIniClick

Func OkButtonClick() ; what happens when you click this button
    Window() ; Runs this function
EndFunc   ;==>OkButtonClick

; =====================================================
; End Settings Dialog Boxes Functions
; =====================================================

; =====================================================
; Start Window Functions
; =====================================================

Func Window() ; runs the Window
    If $checkWin = 0 Then ; 0 = not launched
        ShellExecute($iniShortcutTitle, "", @DesktopDir) ; launches the window from your desktop
        $checkWin = 1 ; enables next block of code to activate
    EndIf
    If $checkWin = 1 Then ; 1 = launched
        WinActivate($iniWindowTitle) ; supposed to activate the window
        WinWaitActive($iniWindowTitle) ; waits for the window to be active before starting
        Sleep(1000) ; waits 1 seconds to make sure window is loaded fully
        UserName() ; runs this function
    EndIf
EndFunc   ;==>Window


; =====================================================
; Start User Input/Output Functions
; =====================================================

Func UserName()
    ControlClick($iniWindowTitle, "", $iniUsernameControl, "left", 1) ; clicks the username box
    Send("{BACKSPACE 30}") ; deletes what is in username in case of different account
    Send("{DELETE 30}") ; in case of missed characters in the username
    Opt("SendKeyDownDelay", 50) ; delays each key stroke following this line by 50 milliseconds
    Send($iniUsername) ; types in your username from the ini
    Send("{TAB}") ; presses tab to ensure Passphrase func doesn't misclick
    Passphrase() ; runs this function
EndFunc   ;==>UserName

Func Passphrase()
    ControlClick($iniWindowTitle, "", $iniPasswordControl, "left", 1) ; clicks the password box just in case Tab doesn't register
    Send("{BACKSPACE 30}") ; deletes what is in password in case of different account
    Send("{DELETE 30}") ; in case of missed characters in the password
    Opt("SendKeyDownDelay", 50) ; delays each key stroke following this line by 50 milliseconds
    Send($iniPassword) ; types in your password from the ini
    Send("{ENTER}") ; presses enter to luanch the game
    GUIDelete($Form0)
EndFunc   ;==>Passphrase

; =====================================================
; End User Input/Output Functions
; =====================================================

; =====================================================
; End Window Functions
; =====================================================

; =====================================================
; Start Write To INI Functions
; =====================================================

Func WriteToIniFile()
    IniWrite(@ScriptDir & "\Settings.ini", "Login Info", "Username", GUICtrlRead($usernameInput)) ; writes the username you enter to the INI file
    IniWrite(@ScriptDir & "\Settings.ini", "Login Info", "Password", GUICtrlRead($passwordInput)) ; writes the password you enter to the INI file
    IniWrite(@ScriptDir & "\Settings.ini", "Window Info", "Window Name", GUICtrlRead($windowTitleInput)) ; writes the window name to the INI file
    IniWrite(@ScriptDir & "\Settings.ini", "Window Info", "Window Shortcut", GUICtrlRead($shortcutNameInput)) ; Writes the desktop shortcut name to ini file
    IniWrite(@ScriptDir & "\Settings.ini", "Window Info", "Window Username Control", GUICtrlRead($usernameControlInput)) ; writes the username control id to the INI file
    IniWrite(@ScriptDir & "\Settings.ini", "Window Info", "Window Password Control", GUICtrlRead($passwordControlInput)) ; Writes the password control id to ini file
    IniWrite(@ScriptDir & "\Settings.ini", "Hotkey Info", "Play Hotkey", GUICtrlRead($playInput)) ; Writes the play hotkey to ini file
    IniWrite(@ScriptDir & "\Settings.ini", "Hotkey Info", "Pause Hotkey", GUICtrlRead($pauseInput)) ; Writes the pause hotkey to ini file
    IniWrite(@ScriptDir & "\Settings.ini", "Hotkey Info", "Stop Hotkey", GUICtrlRead($stopInput)) ; Writes the stop hotkey to ini file
EndFunc   ;==>WriteToIniFile

; =====================================================
; End Write To INI Functions
; =====================================================

; =====================================================
; Start Timer Functions
; =====================================================

Func Timer()
    While 1
        Progress($tick1, $tick2)
        $tick1 = $tick1 + 1
        Sleep($wait)
        Progress($tick1, $tick2)
        $tick2 = $tick2 + 1
        Sleep($wait)
        Progress($tick1, $tick2)
    WEnd
EndFunc   ;==>Timer

Func Progress($tick1, $tick2)
    ToolTip("Hotkey: " & $hotkey & " " & @HotKeyPressed & @CRLF & _
            "Time Elasped : " & Time($tick1, $tick2), _
            0, 0, "Time Running")
EndFunc   ;==>Progress

Func Time($tick1, $tick2)
    $totalSecs = (($tick1 + $tick2) * $wait) / 1000
    $hrs = Floor($totalSecs / 3600)
    $mins = Floor((($totalSecs / 3600) - $hrs) * 60)
    $secs = Floor((($totalSecs / 60) - Floor(($totalSecs / 60))) * 60)
    Return $hrs & " Hours : " & $mins & " Minutes : " & $secs & " Seconds"
EndFunc   ;==>Time

Func EndScriptCd()
    Exit
EndFunc   ;==>EndScriptCd

; =====================================================
; End Timer Functions
; =====================================================

; =====================================================
; End Script
; =====================================================

Window Script ::

; =====================================================
; Title .........: Test Login Window
; Script Version : 1.0.0
; Date Created ..: July 29th, 2015
; AutoIt Version : 3.5.4
; Description ...: Test login window with input areas for Username and Password and a Submit button
; Author(s) .....: xxaviarxx
; Infomation ....: I tried to label each and every thing in this script so everyone would know what everything does (That I knew about at least).
; Disclaimer ....: I do not condone any use of any script that violates any person(s) application's ToS/EULA. That being said I hope you enjoy the script either as reference material or as something you could use to complete your own.
; Credits .......: Autoit websites help files and programs
; =====================================================

; =====================================================
; Start Includes
; =====================================================

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

; =====================================================
; End Includes
; =====================================================

; =====================================================
; Start Global Variables
; =====================================================

Global $iniUsername = IniRead(@ScriptDir & "\test.ini", "Login Info", "Username", "") ; reads the username from the ini file and sets it as the variable
Global $txtUser = $iniUsername ; sets the username input area of the dialog editor to be the same as the ini
Global $iniPassword = IniRead(@ScriptDir & "\test.ini", "Login Info", "Password", "") ; reads the username from the ini file and sets it as the variable
Global $txtPass = "" ; makes sure this inupt field is blank

; =====================================================
; End Global Variables
; =====================================================

; =====================================================
; Start Script
; =====================================================

; =====================================================
; Start Test Window
; =====================================================

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Test Window", 240, 132, 192, 114)
$Label1 = GUICtrlCreateLabel("Username", 8, 16, 86, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("Password", 8, 48, 81, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$txtUser = GUICtrlCreateInput($iniUsername, 112, 16, 121, 21)
$txtPass = GUICtrlCreateInput("", 112, 48, 121, 21)
$Submit = GUICtrlCreateButton("Submit", 88, 88, 75, 25)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
Dim $Form1_AccelTable[1][2] = [["{ENTER}", $Submit]]
GUISetAccelerators($Form1_AccelTable)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Submit
            WriteToIniFile() ; runs this function to test if input was 100% successful
            Exit ; exits the window once Enter is pressed as to test the window opener's timer doesnt really need this
    EndSwitch
WEnd

; =====================================================
; End Test Window
; =====================================================

; =====================================================
; Start Write To Ini File
; =====================================================

Func WriteToIniFile()
    IniWrite(@ScriptDir & "\test.ini", "Login Info", "Username", GUICtrlRead($txtUser)) ; writes the username you enter to the INI file
    IniWrite(@ScriptDir & "\test.ini", "Login Info", "Password", GUICtrlRead($txtPass)) ; writes the password you enter to the INI file
EndFunc   ;==>WriteToIniFile

; =====================================================
; End Write To Ini File
; =====================================================

; =====================================================
; End Script
; =====================================================

In case you need them including the INI files

Bot INI aka Settings.ini

[Window Info]
Window Name=Test Window
Window Shortcut=
Window Username Control=[NAME:txtUser]
Window Password Control=[NAME:txtPass]
[Login Info]
Username=blah
Password=blah123
[Hotkey Info]
Play Hotkey={F1}
Pause Hotkey={F2}
Stop Hotkey={F3}

Window INI aka test.ini

[Login Info]
Username=
Password=

Thank you (all) for any and all help given in resolving these issues as I have been stumped for just around 8-10 hours, think I may have stumped google too.

Edited by xxaviarxx
Link to comment
Share on other sites

Maybe I am making this script a lot harder than it needs to be. Quite honestly I like coding everything that I can from scratch makes the program in my opinion that much more unique. I am not sure what I am doing wrong or what I have messed up in this script for it to not run properly or well not run how I want it to run at least. If there is a better way to run all of this code I am more than willing to accept any and all advice given as I am always looking to improve my coding skills.

On a side note I hope the code is easy to read and find anything you need to look for as that is always my goal. If the structure could use some work I would love to hear how it could be better and or more efficient.

Link to comment
Share on other sites

Please don't bump your thread less than 24 hours.

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Wasn't intending to bump it was intending to only add some more information/questions that I just thought of right after I woke up. I forgot about the edit button in my haste to add the info before I forgot about it so very sorry for that.

Link to comment
Share on other sites

Well here's the 24+ hour bump from time i last posted. I still have no idea how to make this work.

Wondering if anyone is going to attempt to help me and just staying silent or if everyone is thinking this could be a breach of the ToS on this site. If the latter Melba and/or any other mod/dev/etc would have said something by now considering how fast they post on ToS violations, right?

Any and all ideas/suggestions that may work are more than welcome at this point I'm willing to try just about anything.

Edited by xxaviarxx
Link to comment
Share on other sites

Quick glance.

In your StartScript func you call Timer().

In that func it is a constant loop which has no way of exiting unless you hit another hotkey, but it will still just return to the Timer() loop.

If you cannot figure your problem from that, I suggest you try to create a smaller demo script which demonstrates the problem. When you do that, 9 times out of 10 you will realize your mistake, and if not, you will most certainly get more takers.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

I've placed it there because it wasn't starting and still isn't starting unless I run it before SettingsControl in which case SettingsControl never starts.

What I want it to do is run as soon as the Window function begins as the timer tells me how long the automation part of the script has ran for until the hotkey is pressed to stop the entire script (look at the function called EndScriptCd it happens after the hotkey stop loop and is at the bottom of the script), but if I place Timer at the beginning of the Window function that never runs because as you already pointed out the timer is a constant loop as it should be for this application of a timer.

Then there is the problem of Pause not saying it's description when you hit the Pause hotkey only once when you hit it for the 2nd time it then says paused but the timer starts going again and Stop same thing except it never shows correction I had it show one time but the countdown did not work now I cannot remember how I even got that to show.

So I am completely lost on what to actually do I have tested and failed at countless things to make everything work how I want them to but to no avail. Again any and all help would be greatly appreciated.

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