Docfxit Posted September 8, 2023 Share Posted September 8, 2023 (edited) I'm working with Quickbooks. I start a Journal Entry, Enter the date, put the cursor in the first account field then I run this script. expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** Opt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) #include <MsgBoxConstants.au3> ; Press Esc to terminate script, Pause/Break to "pause" Opt("TrayIconDebug", 1) ;0-off ; Set so that tray displays current line number Global $g_bPaused = False ;~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~* HotKeySet("{+!2}", "_HotKeyPressed") ;If you press Alt-2, the script will Pause ;~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~* HotKeySet("{ESC}", "_HotKeyPressed") HotKeySet("+!d", "_HotKeyPressed") ; Shift-Alt-d WinWait("Docfxit, Inc. - QuickBooks Desktop Pro 2021","Make General Journal") If Not WinActive("Docfxit, Inc. - QuickBooks Desktop Pro 2021","Make General Journal") Then WinActivate("Docfxit, Inc. - QuickBooks Desktop Pro 2021","Make General Journal") WinWaitActive("Docfxit, Inc. - QuickBooks Desktop Pro 2021","Make General Journal") Send("dcu{TAB}") ;~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~* Send("{+!2}") ; I would like it to pause here and it is ;~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~* WinWait("Docfxit, Inc. - QuickBooks Desktop Pro 2021","Make General Journal") If Not WinActive("Docfxit, Inc. - QuickBooks Desktop Pro 2021","Make General Journal") Then WinActivate("Docfxit, Inc. - QuickBooks Desktop Pro 2021","Make General Journal") WinWaitActive("Docfxit, Inc. - QuickBooks Desktop Pro 2021","Make General Journal") Send("{TAB}{TAB}{SHIFTDOWN}i{SHIFTUP}nterest{TAB}digital{TAB}tes{ALTDOWN}n{ALTUP}") Func _HotKeyPressed() Switch @HotKeyPressed ; The last hotkey pressed. Case "{+!2}" ; String is the {PAUSE} hotkey. $g_bPaused = Not $g_bPaused While $g_bPaused Sleep(100) ToolTip('Script is "Paused"', 0, 0) WEnd ToolTip("") Case "{ESC}" ; String is the {ESC} hotkey. Exit Case "+!d" ; String is the Shift-Alt-d hotkey. MsgBox($MB_SYSTEMMODAL, "", "This is a message.") EndSwitch EndFunc ;==>_HotKeyPressed I would like the script to enter the account (which it does) and then go to the debit column (which it does) and pause to let me enter the amount. I'm doing something wrong in the script because I can't un-pause it. I also don't have a pause or a break key on my keyboard. (That I know of) Can I change it to a alt-2 key? Edited September 8, 2023 by Docfxit Link to comment Share on other sites More sharing options...
ioa747 Posted September 8, 2023 Share Posted September 8, 2023 the line _HotKeyPressed("{PAUSE}") is wrong the func _HotKeyPressed() can not be have parameters replace _HotKeyPressed("{PAUSE}") with Send("{PAUSE}") I know that I know nothing Link to comment Share on other sites More sharing options...
Docfxit Posted September 8, 2023 Author Share Posted September 8, 2023 Changing it to Send("{PAUSE}") Worked great. It does pause now. I changed the HotKeySet("{+!2}", "_HotKeyPressed") In the code on the first post to pause it. I'm trying to get the pause to Alt-2. It doesn't un-pause it when I press that key combination. Do you have any suggestions as to an easy key to use? Link to comment Share on other sites More sharing options...
ioa747 Posted September 8, 2023 Share Posted September 8, 2023 (edited) this line is wrong HotKeySet("{+!2}", "_HotKeyPressed") ;If you press Alt-2, the script will Pause replace with HotKeySet("+!2", "_HotKeyPressed") ;If you press shift+Alt+2, the script will Pause or you can direct set $g_bPaused = true Edited September 8, 2023 by ioa747 I know that I know nothing Link to comment Share on other sites More sharing options...
Solution ioa747 Posted September 8, 2023 Solution Share Posted September 8, 2023 (edited) expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <MsgBoxConstants.au3> Opt("WinWaitDelay", 100) Opt("WinTitleMatchMode", 4) Opt("WinDetectHiddenText", 1) Opt("MouseCoordMode", 0) ; Press Esc to terminate script, Pause/Break to "pause" Opt("TrayIconDebug", 1) ;0-off ; Set so that tray displays current line number Global $g_bPaused = False ;~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~* HotKeySet("+!2", "_Paused") ;If you press Shift-Alt-2, the script will Pause\UnPause HotKeySet("{ESC}", "_Exit") HotKeySet("+!d", "_Msg") ; Shift-Alt-d ;~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~* Global $hDocfxit = WinWait("Docfxit, Inc. - QuickBooks Desktop Pro 2021","Make General Journal") If Not WinActive($hDocfxit) Then WinActivate($hDocfxit) WinWaitActive($hDocfxit) Send("dcu{TAB}") _Paused() WinWait($hDocfxit) If Not WinActive($hDocfxit) Then WinActivate($hDocfxit) WinWaitActive($hDocfxit) Send("{TAB}{TAB}{SHIFTDOWN}i{SHIFTUP}nterest{TAB}digital{TAB}tes{ALTDOWN}n{ALTUP}") ;---------------------------------------------------------------------------------------- Func _Paused() $g_bPaused = Not $g_bPaused While $g_bPaused Sleep(100) ToolTip('Script is "Paused"', 0, 0) WEnd ToolTip("") EndFunc ;==>_HotKey_Paused ;---------------------------------------------------------------------------------------- Func _Exit() Exit EndFunc ;---------------------------------------------------------------------------------------- Func _Msg() MsgBox($MB_SYSTEMMODAL, "", "This is a message.") EndFunc ;---------------------------------------------------------------------------------------- Edited September 8, 2023 by ioa747 UpDate Musashi and Docfxit 1 1 I know that I know nothing Link to comment Share on other sites More sharing options...
Docfxit Posted September 8, 2023 Author Share Posted September 8, 2023 Big improvement!!! It's much easier to read. And it works great. Thank you very very much. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now