#include <Date.
au3>
#include <Array.au3> ;For Array storage
#include <GUIConstantsEx.au3> ;For GUI display
#include <EditConstants.au3> ;Allows positioning of gui input box text
#include <StaticConstants.au3> ;Allows formatting of gui labels
;#include <Sleep2.au3> ;For allowing GUI to still function while the delay is
happening
#include <GuiListView.au3> ;For making the clear listview function work
#include <Restart.au3>
#Include <HotKeyRecording5.au3>
#include <WindowsConstants.au3>
#include <GuiEdit.au3>
#include <File.au3>
$GUI_Parent = GuiCreate("Autosofted Auto Keyboard Presser v1.8", 510, 290, 0,
0) ;Creates the GUI
Global $Start = GUICTRLCREATELabel("Start/Stop Hotkey: ", 30, 5, 110, 20) ;The
start button
Global $Start2 = GUICtrlCREATECombo("Select", 30, 22, 80, 30)
GUICtrlSetData($Start2, "F1|F2|F3|F4|F5|F6|F7|F8|F9|F10|F11|F12|NUMPAD1|NUMPAD2|
NUMPAD3|NUMPAD4|NUMPAD5|NUMPAD6|NUMPAD7|NUMPAD8|NUMPAD9|NUMPAD0|SPACE")
Global $Set1 = GUICtrlCreateButton("Set", 115, 22, 40, 20)
Global $Play = GUICTRLCREATELabel("Play Hotkey:", 170, 5, 110, 20) ;The play button
Global $Play2 = GUICtrlCREATECombo("Select", 170, 22, 80, 30)
GUICtrlSetData($Play2, "F1|F2|F3|F4|F5|F6|F7|F8|F9|F10|F11|F12|NUMPAD1|NUMPAD2|
NUMPAD3|NUMPAD4|NUMPAD5|NUMPAD6|NUMPAD7|NUMPAD8|NUMPAD9|NUMPAD0|SPACE")
Global $Set2 = GUICtrlCreateButton("Set", 255, 22, 40, 20)
Global $EditScript = GUICTRLCREATEButton("Edit Script", 310, 180, 90, 50) ; The
edit script button
Global $Exit = GUICTRLCREATEButton("Exit", 410, 232, 90, 25) ; The exit button
Global $Clear = GUICTRLCREATEButton("Clear", 310, 10, 60, 30) ; The donate button
Global $Visitweb = GUICTRLCREATEButton("Visit our website", 380, 10, 110, 30) ; The
donate button
Global $BuyFull = GUICTRLCREATEButton("Get Full Version", 410, 180, 90, 50) ; The
edit script button
Global $Input = GUICTRLCREATEInput("500", 316, 70, 60, 20, $ES_CENTER) ;The timer
input box
GUICtrlCreateUpdown($Input)
Global $InputLabel1 = GUICTRLCREATELabel("milliseconds", 386, 73, 60,
20) ;milliseconds label
Global $InputLabel2 = GUICTRLCREATELabel("Time between presses", 328, 52, 110,
15) ;time between presses label
Global $InputLabel3 = GUICTRLCREATELabel("", 310, 50, 143, 50,
$SS_ETCHEDFRAME) ;Frame around timer input options
Global $InputLabel4 = GUICTRLCREATELabel("v1.8", 150, 320, 20, 15) ;version number
Global $KeyboardInfo = GUICTRLCREATEListView("Action #| Key Pressed
", 30, 50, 260, 185) ;The keyboard information box in the middle of the GUI
Global $TimerEdit = GUICtrlCreateCheckbox("Disable countdown timer", 310, 160, 140,
15)
Global $Radio1 = GUICtrlCreateRadio("Repeat", 314, 112, 50, 20)
Global $Radio1Input = GUICtrlCreateInput("1", 369, 112, 48, 20, $ES_CENTER)
GUICtrlCreateUpdown($Radio1Input)
Global $Radio1Label = GUICTRLCREATELabel("times",424, 114, 35, 20)
Global $Radio2 = GUICtrlCreateRadio("Repeat continuously", 314, 132, 120, 20)
Global $InputLabel3 = GUICTRLCREATELabel("", 310, 110, 143, 45,
$SS_ETCHEDFRAME) ;Frame around repeat amount input options
Global $rFilePath = @TempDir & "\Autosofted Keyboard Presser Config.txt" ;For
Creating a saved file
Global $rFilePath2 = @LocalAppDataDir & "\Autosofted License.txt" ;For Creating a
saved file
Global $InputLabelStatus = GUICTRLCREATELabel("Status:", 30, 260, 60, 25) ;time
between presses label
GUICtrlSetFont ( $InputLabelStatus, 11, 620 )
Global $InputLabelStatus2 = GUICTRLCREATELabel("No Keys Recorded Yet", 85, 260,
350, 25) ;time between presses label
GUICtrlSetFont ( $InputLabelStatus2, 11, 620 )
GUICtrlSetState($Radio2, $GUI_Checked) ;Makes the continous option automatically
checked upon GUI opening
GUISetState() ;Makes the GUI Appear
;GUICtrlSetState($EditScript, $GUI_DISABLE)
Global $run = 0 ;Makes it so that the program isn't recording when you first open
it
Global $play1 = 0 ;Makes it so that the program isn't playing back recording when
you first open it
Global $play1edit = 0 ;Makes it so that the program isn't play back the edited
script recording
Global $Numberoflines = 0
Global $b = 1
Global $x
Global $u
Global $Hotkey1 = 1
Global $Hotkey2 = 2
Global $SkippedStop = 0
Global $Repeat = 1
Global $EditEnable = 1;0!here!
Global $Trial = 1
Global $Timepressed;;;;;;;;;;;;;;;;;;;;;;;;
Global $DontRepeat = 0
Global $ChangesApplied = 0
Global $makeitup = 0
Global $EditPressed = 0
Global $FileLoad1
Global $HotKey11, $HotKey22, $ApplyChanges, $EditedTime3, $ChildInput
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;See if 30 day trial is
up;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Local $gFileOpen2 = FileOpen($rFilePath2, 1) ;Creates a text file (1 at the end
makes it so that the file is adding a new line and not deleting old one) Put 2, to
reset days
FileWrite($gFileOpen2, @Year&"/"&@MON&"/"&@MDay&" 00:00:00"& @CRLF) ;Write the set
hotkey to the text file
Global $30DayChecker = FileExists($rFilePath2) ;Check if the file for the 30 day
count exists (which it should once the first hotkey is saved)
If $30DayChecker Then
$30DaysAhead = _DateAdd ( 'd', 31, FileReadLine($rFilePath2, 1)) ;Add 30 days to
the day when program was first opened
Local $TimeRemaining = _DateDiff( 'd', _NowCalc(), $30DaysAhead) ;Add 30 days to
when you first opened the program
Global $TimeLeftLabel1 = GUICTRLCREATELabel("You have "&$TimeRemaining&" days left
of the trial!", 30, 242, 160, 15) ;time between presses label
Global $TimeLeftLabel2 = GUICTRLCREATELabel("Full version is just $5.", 185, 242,
110, 15) ;time between presses label
Local $FullVersion = FileReadLine($rFilePath2, 1) ;Add 30 days to the day when
program was first opened
If $FullVersion <> "FULL" Then ;If the full version has never been opened on the
computer
If $TimeRemaining <= 0 Then ;If the trial runs out
GUICtrlSetState ( $Start2, $GUI_DISABLE)
GUICtrlSetState ( $Play2, $GUI_DISABLE)
GUICtrlSetState ( $Set1, $GUI_DISABLE)
GUICtrlSetState ( $Set2, $GUI_DISABLE)
GUICtrlSetState ( $KeyboardInfo, $GUI_DISABLE)
GUICtrlSetState ( $Input, $GUI_DISABLE)
GUICtrlSetState ( $Radio1, $GUI_DISABLE)
GUICtrlSetState ( $Radio2, $GUI_DISABLE)
GUICtrlSetState ( $Radio1Input, $GUI_DISABLE)
GUICtrlSetState ( $EditScript, $GUI_DISABLE)
Local $gFileOpen2 = FileOpen($rFilePath2, 2) ;So that they can't change clock on
computer to bypass the trial
FileWrite($gFileOpen2, "0" & @CRLF) ;Write the set hotkey to the text file
Global $Trial = 0
Msgbox(0,"Trial Expired", "Sorry! But your trial of this program has ended, please
purchase the full version for just $5. Click the Get Full Version button!")
GUICtrlSetState ( $TimeLeftLabel1, $GUI_Hide)
Global $TimeLeftLabel3 = GUICTRLCREATELabel("Your trial has ended!", 30, 242, 140,
15) ;time between presses label
EndIf
EndIf
EndIf
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Func Start()
If $Trial = 1 Then
Sleep(400)
_GUICtrlListView_DeleteAllItems($KeyboardInfo)
Global $avvArray[$a]
Global $timeArray[$x]
Global $pauseArray[$u]
Global $a = 1;!here!!new!
$ReadIt3 = GUICtrlRead($TimerEdit) ;Reads if the disable countdown
timer box is checked or not
If $ReadIt3 == $GUI_Checked Then
Sleep(200)
SplashTextOn("Autosofted", "", 180, 50, -1, -1, 4, "", 15)
ControlSetText("Autosofted", "", "Static1", "PRESS!")
Sleep(500)
WinSetState("Autosofted","",@SW_Hide)
Sleep(10) ;Ends the last message faster
$run = 1 ;enables the program to start recording keystrokes
Global $InputLabelStatus2 = GUICTRLCREATELabel("Recording, press
"&$HotKey1&" to stop recording.", 85, 260, 350, 25) ;time between presses label
GUICtrlSetFont ( $InputLabelStatus2, 11, 620 )
HotKeySet($HotKey11, "Stop") ;Set it so that if you press the
selected hotkey again, that itll stop the program
Else ;go through with the countdown
$SplashX = 0
$SplashY = 3
$Splashmessage = ""
$Splashmessage1 = "Start pressing in " & $Splashmessage
SplashTextOn("Autosofted", $Splashmessage, 180, 50, -1, -1, 4, "", 15)
While $SplashY > $SplashX
$Splashmessage = $SplashY & @LF
ControlSetText("Autosofted", "", "Static1", $Splashmessage1 & $Splashmessage)
sleep(1000)
$SplashY = $SplashY - 1
WEnd
ControlSetText("Autosofted", "", "Static1", "PRESS!")
Sleep(300)
WinSetState("Autosofted","",@SW_Hide)
Sleep(10) ;Ends the last message faster
$run = 1 ;enables the program to start recording keystrokes
Global $InputLabelStatus2 = GUICTRLCREATELabel("Recording, press
"&$HotKey1&" to stop recording.", 85, 260, 350, 25) ;time between presses label
GUICtrlSetFont ( $InputLabelStatus2, 11, 620 )
HotKeySet($HotKey11, "Stop") ;Set it so that if you press the
selected hotkey again, that itll stop the program
EndIf
EndIf
EndFunc
Func Stop() ;Stops Keyrecording
Sleep(400)
TrayTip("Stop", "Recording Done! Press "&$Hotkey2&" to play key presses.", 0)
$EditEnable = 1
GUICtrlSetState($EditScript, $GUI_ENABLE)
$run = 0 ;Makes it so that you can't add anymore keys to the array
;If $EditPressed = 1 Then;
;$a = $b ;Start the script all
over;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Else;
$b = $a ;B will be used to store the value of the array when it's at
it's largest size after the recording is done
;EndIf;
Global $InputLabelStatus2 = GUICTRLCREATELabel("Press "&$Hotkey2&" to play
key presses.", 85, 260, 350, 25) ;time between presses label
GUICtrlSetFont ( $InputLabelStatus2, 11, 620 )
HotKeySet($HotKey11, "Start")
EndFunc
Func Play()
If $Trial = 1 Then
GUICtrlSetState($EditScript, $GUI_DISABLE)
Sleep(400)
;if applied changs have been done, then for blah = numberoflines, minus
1 row
$TimerCheck = GUICtrlRead($Input) ;This is the data inputted in the
timer text box of the GUI
If $TimerCheck < 10 Then ;Added so people don't set such a low number
that they can't control their clicking
GUICtrlSetData($Input, 10) ;Set the timer input box back to 500
MsgBox(0,"Timer","Timer cannot be less than 10 milliseconds.
Timer changed to 10 milliseconds.")
EndIf
$SkippedStop = 1 ;Checks if Start was pressed, then Play, without the
"Stop" in the middle
Sleep(1000)
$play1 = 1 ;Allows the program to playback all recorded keystrokes
SplashTextOn("Autosofted", "", 180, 50, -1, -1, 4, "", 15)
ControlSetText("Autosofted", "", "Static1", "PLAYING!")
Sleep(500)
WinSetState("Autosofted","",@SW_Hide)
Global $InputLabelStatus2 = GUICTRLCREATELabel("Press "&$Hotkey2&" to
Stop Program.", 85, 260, 500, 45) ;time between presses label
GUICtrlSetFont ( $InputLabelStatus2, 11, 620 )
HotKeySet($HotKey22, "StopPlay") ;Set it so that if you press the
selected hotkey again, then it stops the program
EndIf
EndFunc
Func StopPlay() ;Stop Playing, aka Pause
;if changes have never been made before Then
;~ If $EditPressed = 0 Then ;if the editor has not been opened before;!here!
;~ ConsoleWrite("$b="&$b&@CRLF)
;~ $a = $b + 1
;~ $x = $b + 1
;~ $u = $b + 1
;~ EndIf
$SkippedStop = 0 ;makes it so you get errors if you press the start/stop
hotkey in the wrong order
$play1 = 0 ;makes it so that you stop playing
HotKeySet($HotKey22, "Play")
GUICtrlSetState($EditScript, $GUI_ENABLE)
Global $InputLabelStatus2 = GUICTRLCREATELabel("Script paused. Press
"&$HotKey2&" to unpause or "&$HotKey1&" to clear script.", 85, 260, 400, 35) ;time
between presses label
GUICtrlSetFont ( $InputLabelStatus2, 11, 620 )
SplashTextOn("Autosofted", "", 180, 50, -1, -1, 4,
"", 15)
ControlSetText("Autosofted", "", "Static1", "STOPPED!")
Sleep(500)
WinSetState("Autosofted","",@SW_Hide)
HotKeySet($HotKey11, "End")
EndFunc
Func End()
SaveHotKey()
_ScriptRestart()
EndFunc
Func SaveHotKey()
Local $gFileOpen = FileOpen($rFilePath, 2) ;Creates a text file (2 at the end
makes it so that the file is re-created everytime)
FileWrite($gFileOpen, "Start/Stop Hotkey: "&$HotKey11& @CRLF) ;Write the set
hotkey to the text file
FileWrite($gFileOpen, "Play Hotkey: "&$HotKey22& @CRLF) ;Write the set hotkey
to the text file
$TimerCheck = GUICtrlRead($Input)
FileWrite($gFileOpen, "Timer: "&$TimerCheck& @CRLF) ;Write the set hotkey to
the text file
$CountdownCheck = GUICtrlRead($TimerEdit) ;Reads if the disable countdown
timer box is checked or not
If $CountdownCheck == $GUI_Checked Then
FileWrite($gFileOpen, "Check"& @CRLF) ;Write that the countdown disable
is checked
EndIf
EndFunc
;/////////////////////// SAVE
FUNCTION///////////////////////////////////////////
Func Save()
; Create a constant variable in Local scope of the message to display in
FileSaveDialog.
Local Const $sMessage = "Choose a filename."
; Display a save dialog to select a file.
Local $sFileSaveDialog = FileSaveDialog($sMessage, "::{450D8FBA-AD25-11D0-
98A8-0800361B1103}", "Keyboard Text (*.txt)", $FD_PATHMUSTEXIST)
If @error Then
; Display the error message.
MsgBox($MB_SYSTEMMODAL, "", "No file was saved.")
Else
; Retrieve the filename from the filepath e.g. Example.au3.
Local $sFileName = StringTrimLeft($sFileSaveDialog,
StringInStr($sFileSaveDialog, "\", $STR_NOCASESENSE, -1))
; Check if the extension .au3 is appended to the end of the filename.
Local $iExtension = StringInStr($sFileName, ".", $STR_NOCASESENSE)
; If a period (dot) is found then check whether or not the extension is
equal to .au3.
If $iExtension Then
; If the extension isn't equal to .au3 then append to the end of
the filepath.
If Not (StringTrimLeft($sFileName, $iExtension - 1) = ".txt")
Then $sFileSaveDialog &= ".txt"
Else
; If no period (dot) was found then append to the end of the
file.
$sFileSaveDialog &= ".txt"
EndIf
; Display the saved file.
MsgBox($MB_SYSTEMMODAL, "", "You saved the following file:" & @CRLF &
$sFileSaveDialog)
Local $gFileOpen3 = FileOpen($sFileSaveDialog, 2) ;Creates a text file
(1 at the end makes it so that the file is adding a new line and not deleting old
one, 2 saves over)
Global $EditorRead = GUICtrlRead($ChildInput)
FileWrite($gFileOpen3, $EditorRead) ;Write the set hotkey to the text
file
EndIf
EndFunc ;==>Example
;//////////////////////////////////////////////////////////////////////////////////
//////
;/////////////////////// LOAD FUNCTION///////////////////////////////////////////
Func Load()
Local $FileLoad1 = FileOpenDialog("Choose Script File", @WindowsDir & "\",
"Text (*.txt)", $FD_FILEMUSTEXIST + $FD_MULTISELECT)
If @error Then
MsgBox($MB_SYSTEMMODAL, "", "No file(s) were selected.")
FileChangeDir(@ScriptDir)
Else
If StringInStr($FileLoad1, ".txt") > 1 Then ;Make sure its a text file
FileChangeDir(@ScriptDir)
GUICtrlSetData($ChildInput, "") ;Clear the script editor
_GUICtrlListView_DeleteAllItems($KeyboardInfo) ;Clear the first
keypress menu
FileOpen($FileLoad1) ;Open the loaded file
Global $a = 1
Global $x = 1
Global $u = 1
Global $avvArray[$a] ;redeclare to make it 0
Global $timeArray[$x] ;redeclare to make it 0
Global $pauseArray[$u] ;redeclare to make it 0
For $h = 1 to _FileCountLines($FileLoad1) ;Count amount of lines
in that file
$LoadLine = FileReadLine($FileLoad1, $h)
;;;;;;;;;;;;Make the script editor right;;;;;;;;;;;;;;;
$PauseCheck = StringInStr($LoadLine, "Pause")
If $PauseCheck = 0 Then
$LoadLine2 = FileReadLine($FileLoad1, $h+1)
$LoadLine = $LoadLine & $LoadLine2
$h = $h + 1
EndIf
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
GUICtrlSetData($ChildInput, $LoadLine & @CRLF, 1) ;Create a
new line for every line in that text file
$EditedLoadKey = StringInStr($LoadLine, "Press", 0, 1)
$EditedLoadKey2 = StringInStr($LoadLine, "For", 0, 1)
$EditedLoadKey3 = StringMid($LoadLine, $EditedLoadKey + 6,
$EditedLoadKey2 - $EditedLoadKey - 7)
$EditedLoadKey4 = $EditedLoadKey3
Global $CtrlShiftAlt
If StringInStr($EditedLoadKey3, 'Shift+') = 1 Then
$EditedLoadKey4 = StringReplace($EditedLoadKey3,
'Shift+', '+')
$CtrlShiftAlt = 1
Else
$CtrlShiftAlt = 0
EndIf
If StringInStr($EditedLoadKey3, 'Ctrl+') = 1 Then
$EditedLoadKey4 = StringReplace($EditedLoadKey3,
'Ctrl+', '^')
$CtrlShiftAlt = 1
Else
$CtrlShiftAlt = 0
EndIf
If StringInStr($EditedLoadKey3, 'Alt+') = 1 Then
$EditedLoadKey4 = StringReplace($EditedLoadKey3,
'Alt+', '!')
$CtrlShiftAlt = 1
Else
$CtrlShiftAlt = 0
EndIf
$EditedLoadTime = StringInStr($LoadLine, "Pause", 0, 1)
$EditedLoadTime2 = StringInStr($LoadLine, "Milliseconds",
0, 1)
$EditedLoadTime3 = StringMid($LoadLine, $EditedLoadTime +
6, $EditedLoadTime2 - $EditedLoadTime - 6)
$EditedLoadHold = StringInStr($LoadLine, "for", 0, 1)
$EditedLoadHold2 = StringInStr($LoadLine, "seconds Pause",
0, 1)
$EditedLoadHold3 = StringMid($LoadLine, $EditedLoadHold +
4, $EditedLoadHold2 - $EditedLoadHold - 4)
$EditedLoadHold4 = $EditedLoadHold3 * 1000 ;The millisecond
version of how long each key is held down for
_ArrayInsert($avvArray, 0, $EditedLoadKey4)
$a = $a + 1
_ArrayInsert($timeArray, 0, $EditedLoadHold3)
$x = $x + 1
_ArrayInsert($pauseArray, 0, $EditedLoadTime3)
$u = $u + 1
;$NumberofLines = $NumberofLines + 1 ;Incase they click
"Apply Changes" after loading script
If $EditedLoadHold3 < 0.6 or $CtrlShiftAlt = 1 Then;Make it
so that if you hold the key for under 0.6 secs then just count it as one press
GUICtrlCreateListViewItem($h-1&"|"&$EditedLoadKey3,
$KeyboardInfo)
else
GUICtrlCreateListViewItem($h-1&"|"&$EditedLoadKey3&"
held down for "&$EditedLoadHold3&" seconds", $KeyboardInfo)
EndIf
Next
FileClose($FileLoad1)
;~ $DontRepeat = 1;!here!
$b = $a ;B will be used to store the value of the array when it's
at it's largest size after the recording is done (this allows the recording to keep
playing back)
GUICtrlSetState($ApplyChanges, $GUI_DISABLE)
WinClose("Script Editor")
msgbox(0,"Success!", "Script Loaded! Press "&$HotKey2&" to
play.")
EndIf
EndIf
EndFunc ;==>Example
;//////////////////////////////////////////////////////////////////////////////////
//////
Global $hFileExists = FileExists($rFilePath)
If $hFileExists Then
Local $Hotkey1Check = FileReadLine($rFilePath, 1)
Local $Hotkey2Check = FileReadLine($rFilePath, 2)
Local $Hotkey3Check = FileReadLine($rFilePath, 3)
Local $Hotkey4Check = FileReadLine($rFilePath, 4)
Local $CheckPreset1 = StringInStr($Hotkey1Check, ":")
Local $CheckPreset2 = StringInStr($Hotkey2Check, ":")
Local $CheckPreset3 = StringInStr($Hotkey3Check, ":")
Local $CheckPreset4 = StringInStr($Hotkey4Check, "Check")
If $CheckPreset1 >= 1 Then
$Hotkey11 = StringMid($Hotkey1Check, $CheckPreset1 + 2)
HotKeySet($Hotkey11, "Start") ;Set it so that if you press the selected
hotkey, then it performs the Start function
$ClosingBracket1 = StringTrimRight($Hotkey11, 1) ;Removes the ending }
$OpeningBracket1 = StringTrimLeft($ClosingBracket1, 1) ;Removes the
beginning {
$Hotkey1 = $OpeningBracket1
GUICtrlSetData($Start2, $Hotkey1)
EndIf
If $CheckPreset2 >= 1 Then
$Hotkey22 = StringMid($Hotkey2Check, $CheckPreset2 + 2)
HotKeySet($Hotkey22, "Play") ;Set it so that if you press the selected
hotkey, then it plays the recording
$ClosingBracket2 = StringTrimRight($Hotkey22, 1) ;Removes the ending }
$OpeningBracket2 = StringTrimLeft($ClosingBracket2, 1) ;Removes the
beginning {
$Hotkey2 = $OpeningBracket2
GUICtrlSetData($Play2, $Hotkey2)
EndIf
If $CheckPreset3 >= 1 Then
$Hotkey33 = StringMid($Hotkey3Check, $CheckPreset3 + 2)
GUICtrlSetData($Input, $Hotkey33)
EndIf
If $CheckPreset4 >= 1 Then
GUICtrlSetState($TimerEdit, $GUI_CHECKED)
EndIf
EndIf
While 1
Sleep(10)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Cases;;;;;;;;;;;;;;;;;;;;;;;;;;;
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE ;If the "x" button on the GUI is clicked then
exit while loop (which will lead to the last line of code which tells GUI to close)
SaveHotKey()
ExitLoop
Case $Exit ;If the exit button is pressed, then end the program
SaveHotKey()
ExitLoop
Case $BuyFull ;If the visit website button is clicked, then redirect to
autosofted.com
ShellExecute("http://www.autosofted.com/auto_keyboard_premium/")
Case $Clear
SaveHotKey()
_ScriptRestart()
Case $Set1 ;If the first set button is pressed then read what hotkey
was selected in the dropdown
$Hotkey1 = GUICtrlRead($Start2) ;Read item selected in first
dropdown menu
$Hotkey11 = "{"&$Hotkey1&"}" ;Add the { } so that the Hotkeyset
can read it properly
HotKeySet($HotKey11, "Start") ;Set it so that if you press the
selected hotkey, then it starts the recording
MsgBox(0, "Autosofted", "Start/Stop key has been set!", 0)
If $Hotkey1 == $Hotkey2 or $Hotkey1 = "Select" Then ;If both
hotkeys for start/stop and play are the same or the key "Select" was chosen then
give error message
MsgBox(0,"Autosofted","Please select a different key for
Start/Stop")
GUICtrlSetData($Start2, "Select")
EndIf
Case $Set2 ;If the first set button is pressed then read what hotkey
was selected in the dropdown
$Hotkey2 = GUICtrlRead($Play2) ;Read item selected in first
dropdown menu
$Hotkey22 = "{"&$Hotkey2&"}" ;Add the { } so that the Hotkeyset
can read it properly
HotKeySet($HotKey22, "Play") ;Set it so that if you press the
selected hotkey, then it plays the recording
MsgBox(0, "Autosofted", "Play key has been set!", 0)
If $Hotkey1 == $Hotkey2 or $Hotkey2 = "Select" Then ;If both
hotkeys for start/stop and play are the same or the key "Select" was chosen then
give error message
MsgBox(0,"Autosofted","Please select a different key for
Play")
GUICtrlSetData($Play2, "Select")
EndIf
;If $a > $u and $play1edit = 0 Then;When you record a keystroke,
"a" gets bigger, and $u lags behind, but we gotta make them even so that all of
"a"'s played back strokes has a matching "u" with it, "u" is the pause time. and if
apply changes has NOT been pressed
;msgbox(0,"","HI")
;_ArrayInsert($pauseArray, 0, GUICtrlRead($Input)
;$u = $u + 1
;EndIf
Case $EditScript
$EditPressed = 1
$changesapplied = 0
;$makeitup = 0
$numberoflines = 0 ;resets number of lines whenever you go
through the edit script process of reading lines otherwise you have a compounded
childinput on your 2nd edit script/apply changes cycle
If $EditEnable = 1 Then ;Allows you to click ' only after its
done recording
;~ If $b>$a Then $a=$b;!here! !new! Fixes bug with problem
editing after a run
If $b>$a Then Global $a=$b,$x=$a,$u=$x;!here! !new! Fixes
bug with problem editing after a run
GUISetState(@SW_DISABLE, $GUI_Parent) ;Disables current
main GUI
$GUI_Child = GUICreate("Script Editor", 370, 305, 200, 0,
$GUI_SS_DEFAULT_GUI, $WS_EX_MDICHILD, $GUI_Parent)
Local $ChildInput = GUICtrlCreateEdit("", 0, 0, 370, 250,
$ES_AUTOVSCROLL + $WS_VSCROLL)
GUICtrlSetFont ( $ChildInput, 10, 620 )
$WarningChild = GUICtrlCreateLabel("TIP: You can also edit
the saved file in notepad!", 17, 252, 370, 30)
GUICtrlSetFont ( $WarningChild, 11, 620 )
Global $ApplyChanges = GUICtrlCreateButton("Apply Changes",
13, 270, 90, 30)
Global $SaveScript = GUICtrlCreateButton("Save Script",
108, 270, 85, 30)
Global $LoadScript = GUICtrlCreateButton("Load Script",
201, 270, 85, 30)
Global $CloseChild = GUICtrlCreateButton("Close", 296, 270,
60, 30)
$a = $a - 1 ;Just need it to remove an unncessacry line
that keeps appearing
$x = $x - 1;
$u = $u - 1
GUISetState()
If $DontRepeat = 1 Then ;If loaded a file before Then
For $h = 1 to _FileCountLines($FileLoad1) ;Count
amount of lines in that file
$LoadLine = FileReadLine($FileLoad1, $h)
;;;;;;;;;;;;Make the script editor
right;;;;;;;;;;;;;;;
$PauseCheck = StringInStr($LoadLine, "Pause")
If $PauseCheck = 0 Then
$LoadLine2 = FileReadLine($FileLoad1,
$h+1)
$LoadLine = $LoadLine & $LoadLine2
$h = $h + 1
EndIf
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;
GUICtrlSetData($ChildInput, $LoadLine & @CRLF,
1) ;Create a new line for every line in that text file
Next
EndIf
If $DontRepeat = 0 Then ;If file not loaded yet
While 1
Sleep(10) ;IMPORTANT
Switch GUIGetMsg()
Case $ApplyChanges
$play1edit = 1 ;Makes it so that
the program plays back the new edited revisions instead of old ones
$SuccessNote =
GUICtrlCreateLabel("", 25, 278, 40, 20)
$Changesapplied = 1
GUICtrlSetState($ApplyChanges,
$GUI_DISABLE)
GUICtrlSetState($LoadScript,
$GUI_DISABLE)
Sleep(750)
;WinClose("Script Editor")
msgbox(0,"Success!", "Changes were
saved, Press "&$Hotkey22&" to play the edited script.")
WinClose("Script Editor")
Global $Editor =
GUICtrlRead($ChildInput)
Case $SaveScript
Save()
Case $LoadScript
Load()
$a = 0;!here! !new!
Case $CloseChild
;GUICtrlSetState($EditScript,
$GUI_DISABLE)
GUICtrlSetState($ApplyChanges,
$GUI_DISABLE)
ExitLoop
Case $GUI_EVENT_CLOSE ;If the "x" button
on the GUI is clicked then exit while loop (which will lead to the last line of
code which tells GUI to close)
;GUICtrlSetState($EditScript,
$GUI_DISABLE)
GUICtrlSetState($ApplyChanges,
$GUI_DISABLE)
ExitLoop
EndSwitch
If $a > $u and $play1edit = 1 Then;When you
record a keystroke, "a" gets bigger, and $u lags behind, but we gotta make them
even so that all of "a"'s played back strokes has a matching "u" with it, "u" is
the pause time. and if apply changes has NOT been pressed
_ArrayInsert($pauseArray, 0,
$EditedTime3)
$u = $u + 1
EndIf
If $a <> 0 and $DontRepeat = 0 Then ;Dontrepeat
= 0 means the load button was never pushed
$EasyRead = $avvArray[$a - 1]
$EasyTime = $timeArray[$x - 1];
$EasyPause = $pauseArray[$u - 1];
If StringInStr($avvArray[$a - 1], '+') =
1 Then
$EasyRead =
StringReplace($avvArray[$a - 1], '+', 'Shift+')
EndIf
If StringInStr($avvArray[$a - 1], '^') =
1 Then
$EasyRead =
StringReplace($avvArray[$a - 1], '^', 'Ctrl+')
EndIf
If StringInStr($avvArray[$a - 1], '!') =
1 Then
$EasyRead =
StringReplace($avvArray[$a - 1], '!', 'Alt+')
EndIf
If $EasyTime < 0.6 Then ;
GUICtrlSetData($ChildInput, "Press
"&$EasyRead&" for 0 seconds"&" Pause "&$EasyPause&" Milliseconds"&@CRLF, 1)
Else;
GUICtrlSetData($ChildInput, "Press
"&$EasyRead&" for "&$EasyTime&" Pause "&$EasyPause&" Milliseconds"&@CRLF, 1);
EndIf;
$a = $a - 1
$x = $x - 1;
$u = $u - 1
$NumberofLines = $NumberofLines + 1
EndIf
Global $avvArray ;redeclare to make it 0
Global $timeArray ;redeclare to make it 0
Global $pauseArray ;redeclare to make it 0
If GUIGetMsg() = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
EndIf
GUISetState(@SW_ENABLE, $GUI_Parent)
; Delete child
GUIDelete($GUI_Child)
Else
Msgbox(0,"Autosofted Tip", "Please record some keys
first.")
EndIf
EndSwitch
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
If $run = 1 and $SkippedStop = 1 Then ;If you pressed run without pressing
stop after playing then restart script
MsgBox(0,"Autosofted","Error: You have selected to Play without a full
recording. Please make sure you Start AND Stop a recording before Playing")
_ScriptRestart()
EndIf
If $run = 1 Then ;If Start has been pressed then start recording keystrokes
Sleep(10)
_KeyRecord()
If $a <> $u and $play1edit = 0 Then;When you record a keystroke, "a"
gets bigger, and $u lags behind, but we gotta make them even so that all of "a"'s
played back strokes has a matching "u" with it, "u" is the pause time. and if apply
changes has NOT been pressed
_ArrayInsert($pauseArray, 0, GUICtrlRead($Input))
$u = $u + 1
EndIf
EndIf
;;;;;;;;;;;;;;;;;;;;;This is what makes the program play back the key
strokes;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
If $a <> 0 and $play1 = 1 and ($play1edit = 0 or $DontRepeat = 1) Then ;As
long as the number of key presses has not all been played and apply changes has not
been pressed and a script hasnt been loaded and the array has something in it
$TimeStamp = TimerInit() ;Create timestamp
;_ArrayDisplay($timeArray, "2D display")
;_ArrayDisplay($avvArray, "2D display")
;//////////////////////////////////////CTRL CAN'T HOLD
DOWN/////////////////////////////////
$CtrlCheck = StringInStr($avvArray[$a -1], "^", 0)
If $CtrlCheck = 1 Then;
$timeArray[$x - 1] = 0
EndIf;
;//////////////////////////////////////////////////////////////////////
//////////////
;//////////////////////////////////////ALT CAN'T HOLD
DOWN/////////////////////////////////
$AltCheck = StringInStr($avvArray[$a -1], "!", 0)
If $AltCheck = 1 Then;
$timeArray[$x - 1] = 0
EndIf;
;//////////////////////////////////////////////////////////////////////
//////////////
;//////////////////////////////////////SHIFT CAN'T HOLD
DOWN/////////////////////////////////
$ShiftCheck = StringInStr($avvArray[$a -1], "+", 0)
If $ShiftCheck = 1 Then;
$timeArray[$x - 1] = 0
EndIf;
;//////////////////////////////////////////////////////////////////////
//////////////
If $timeArray[$x - 1] * 1000 < 600 Then;
Send($avvArray[$a - 1]) ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $Timer2 =
GUICtrlRead($Input) ;This is the data inputted in the timer text box of the GUI ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Sleep($Timer2) ;Amount of time between each click as entered in by the inputter ;
Sleep($pauseArray[$u - 1])
$a = $a - 1;;;;;;;;;;;;;;;;;;;; ;
$x = $x - 1;;;;;;;;;;;;;;;;;;;; ;
$u = $u - 1;;;;;;;;;;;;;;;;;;;; ;
Else;
$BracketCheck11 = StringInStr($avvArray[$a - 1], "{", 0, 1);
$BracketCheck22 = StringInStr($avvArray[$a - 1], "}", 0, 1);
If $BracketCheck11 = 1 Then;
$BracketCheck33 = StringMid($avvArray[$a - 1],
$BracketCheck11+1, $BracketCheck22- $BracketCheck11 - 1);
While TimerDiff($TimeStamp) < $timeArray[$x - 1] *
1000 ;While the timestamp is less than the time you held the key down for
Send("{" & $BracketCheck33 & " Down}") ;Hold Key down
WEnd
Send("{" & $BracketCheck33 & " Up}");Send key up
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;$Timer2 = GUICtrlRead($Input) ;This is the data inputted in the timer text box
of the GUI
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;; Sleep($Timer2) ;Amount of time between each click as entered in by the
inputter
Sleep($pauseArray[$u - 1])
$a = $a - 1;;;;;;;;;;;;;;;;;;;;
$x = $x - 1;;;;;;;;;;;;;;;;;;;;
$u = $u - 1;;;;;;;;;;;;;;;;;;;;
Else;
While TimerDiff($TimeStamp) < $timeArray[$x - 1] *
1000 ;While the timestamp is less than the time you held the key down for
;//////////////////////////////////////NORMAL KEY
HOLD DOWN AND BACKUP/////////////////////////////////
Send("{" & $avvArray[$a - 1] & " Down}") ;Hold Key
down
WEnd
Send("{" & $avvArray[$a - 1] & " Up}");Send key up
;////////////////////////////////////////////////////
////////////////////////////////
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;$Timer2 = GUICtrlRead($Input) ;This is the data inputted in the timer text box
of the GUI
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;; Sleep($Timer2) ;Amount of time between each click as entered in by the
inputter
Sleep($pauseArray[$u - 1])
$a = $a - 1;;;;;;;;;;;;;;;;;;;;
$x = $x - 1;;;;;;;;;;;;;;;;;;;;
$u = $u - 1;;;;;;;;;;;;;;;;;;
EndIf
EndIf;
;~ GUICtrlSetState($EditScript, $GUI_DISABLE)!here!
EndIf
If $a <> 0 and $play1 = 1 and $play1edit = 1 and $DontRepeat <> 1 Then ;If
the apply changes has been done then and you click on editor again and no script
got
loaded;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Global $avvArray ;redeclare to zero it CAUSE YOU WANT TO START FRESH
AND MAKE SCRIPT READ AND PLAYBACK ONLY THINGS FROM THE SCRIPT EDITOR AS IF NOTHING
ELSE HAPPENED BEFORE IT
;Global $timeArray ;redeclare to zero it
;Global $pauseArray ;reclare to zero it
For $Count = 1 to $NumberofLines
If $play1 = 1 Then
$Anomaly = StringInStr($Editor, "0 Pause")
If $Anomaly <> 0 Then
$BeforeAnomaly = StringMid($Editor, $Anomaly, 30)
$BeforeAnomaly2 = StringMid($Editor, $Anomaly-9, 17)
$Editor = StringReplace($Editor, $BeforeAnomaly,
"PLEASE DELETE THESE LINES AND THEN CLICK APPLY CHANGES")
$Editor = StringReplace($Editor, $BeforeAnomaly2,
"PLEASE")
EndIf
$EditedKey = StringInStr($Editor, "Press", 0, $Count)
$EditedKey2 = StringInStr($Editor, "For", 0, $Count)
$EditedKey3 = StringMid($Editor, $EditedKey + 6,
$EditedKey2 - $EditedKey - 7)
$EditedKey33 = $EditedKey3
If StringLen($EditedKey33) > 12 then ;Makes it so that an
error that sends the entire child window text itself doesn't show
$EditedKey33 = ""
EndIf
;_ArrayInsert($avvArray, 0, $EditedKey33)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Global $CtrlShiftAlt2
If StringInStr($EditedKey3, 'Shift+') = 1 Then
$EditedKey33 = StringReplace($EditedKey3, 'Shift+',
'+')
$CtrlShiftAlt2 = 1
Else
$CtrlShiftAlt2 = 0
EndIf
If StringInStr($EditedKey3, 'Ctrl+') = 1 Then
$EditedKey33 = StringReplace($EditedKey3, 'Ctrl+',
'^')
$CtrlShiftAlt2 = 1
Else
$CtrlShiftAlt2 = 0
EndIf
If StringInStr($EditedKey3, 'Alt+') = 1 Then
$EditedKey33 = StringReplace($EditedKey3, 'Alt+',
'!')
$CtrlShiftAlt2 = 1
Else
$CtrlShiftAlt2 = 0
EndIf
$EditedTime = StringInStr($Editor, "Pause", 0, $Count)
$EditedTime2 = StringInStr($Editor, "Milliseconds", 0,
$Count)
$EditedTime3 = StringMid($Editor, $EditedTime + 6,
$EditedTime2 - $EditedTime - 6)
;_ArrayInsert($pauseArray, 0, $EditedTime3)
$EditedHold = StringInStr($Editor, "for", 0, $Count)
$EditedHold2 = StringInStr($Editor, "seconds Pause", 0,
$Count)
$EditedHold3 = StringMid($Editor, $EditedHold + 4,
$EditedHold2 - $EditedHold - 4)
$EditedHold4 = $EditedHold3 * 1000 ;The millisecond version
of how long each key is held down for
;//////////////////////////////////////CTRL CAN'T HOLD
DOWN/////////////////////////////////
$CtrlCheck2 = StringInStr($EditedKey33, "^", 0)
If $CtrlCheck2 = 1 Then;
$EditedHold3 = 0
$EditedHold4 = 0
EndIf;
;//////////////////////////////////////////////////////////
//////////////////////////
;//////////////////////////////////////ALT CAN'T HOLD
DOWN/////////////////////////////////
$AltCheck2 = StringInStr($EditedKey33, "!", 0)
If $AltCheck2 = 1 Then;
$EditedHold3 = 0
$EditedHold4 = 0
EndIf;
;//////////////////////////////////////////////////////////
//////////////////////////
;//////////////////////////////////////SHIFT CAN'T HOLD
DOWN/////////////////////////////////
$ShiftCheck2 = StringInStr($EditedKey33, "+", 0)
If $ShiftCheck2 = 1 Then;
$EditedHold3 = 0
$EditedHold4 = 0
EndIf;
;//////////////////////////////////////////////////////////
//////////////////////////
;_ArrayInsert($timeArray, 0, $EditedHold3)
;If $makeitup < $numberoflines Then
_ArrayInsert($avvArray, 0, $EditedKey33)
_ArrayInsert($pauseArray, 0, $EditedTime3)
_ArrayInsert($timeArray, 0, $EditedHold3)
; If $Changesapplied = 1 Then; if u click apply
changes a second time
; Endif
;EndIf
$T_INIT = TimerInit()
If $EditedHold4 < 600 Then
Send($EditedKey33)
Sleep($EditedTime3) ;Amount of time between each
click as entered in by the inputter ;
;$a = $a - 1;;;;;;;;;;;;;;;;;;;; ;
;$x = $x - 1;;;;;;;;;;;;;;;;;;;; ;
else;
$BracketCheck111 = StringInStr($EditedKey33, "{", 0,
1);
$BracketCheck222 = StringInStr($EditedKey33, "}", 0,
1);
If $BracketCheck111 = 1 Then;If there are brackets,
then remove them
$EditedKey33 = StringReplace($EditedKey33, "{",
"")
$EditedKey33 = StringReplace($EditedKey33, "}",
"")
EndIf
Do
Send("{" & $EditedKey33 & " Down}") ;Hold Key
down
Until TimerDiff($T_INIT) >= $EditedHold4 ;3000
miliseconds = 3 seconds
Send("{" & $EditedKey33 & " Up}");Hold Key
down;Holdkey up
; Send($EditedKey3) ;Send first key entered into
array (minus 1 since array starts at 0)
Sleep($EditedTime3) ;Amount of time between each
click as entered in by the inputter
;$a = $a - 1
; $x = $x - 1;
EndIf
;below 3 is written so taht the program plays all over
again after script has been edited
EndIf
Next
EndIf
$ReadIt = GUICtrlRead($Radio2) ;Reads if the "repeat continuously" button has
been checked or not
If $a = 0 and $ReadIt == $GUI_Checked Then ;If all key presses have been
played and the repeat continuously button is selected
$a = $b ;Make $a the same as $b so that a <> 0 which makes the entire loop
repeat itself starting from b which was the value when the array was at its largest
size
$x = $b
$u = $b
EndIf
$ReadIt2 = GUICtrlRead($Radio1) ;Reads if the number of times button has been
checked or not
$NumberofRepeats = GUICtrlRead($Radio1Input)
If $a = 0 and $ReadIt2 == $GUI_Checked and $NumberofRepeats <> $Repeat
Then ;If the first loop has been fully played and the "repeat # of times" button
has been checked and The $Repeat variable isn't the same as the number of times
played Then
$a = $b ;Makes it start from the first letter in the array again
$x = $b
$u = $b
$Repeat = $Repeat + 1 ;Keeps adding one after each full loop until it
reaches the same as the number of requested repeat times
EndIf
If $play1 = 1 and $a = 0 and $ReadIt2 == $GUI_Checked and $Repeat ==
$NumberofRepeats Then ;If for the same conditions above, but this time all the
repeats have been played then
$Repeat = 0 ;Restarts the repeat back to 0
StopPlay()
TrayTip("Autosofted Auto Keyboard", "Presses all played", 1)
ToolTip($Hotkey2&" To replay or "&$Hotkey1&" to restart program", 0,
0,"TIP", 1)
HotKeySet($HotKey11, "End") ;Set it so that if you press the selected
hotkey, it'll restart the program
EndIf
WEnd
GuiDelete()