Docfxit Posted February 4, 2017 Posted February 4, 2017 I would like to know how to pause a script until I select the Delete button with the mouse. Opt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) While 1 = 1 WinWait("Bookmark Duplicate Cleaner","") If Not WinActive("Bookmark Duplicate Cleaner","") Then WinActivate("Bookmark Duplicate Cleaner","") WinWaitActive("Bookmark Duplicate Cleaner","") ;Select bookmark on the left column Send("{TAB}{SPACE}") ;Select duplicate on the right Send("{TAB}{DOWN}") ;~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~* ;I would like to pause Until I select the delete key with the mouse. ; This gives me time to Select the bookmarks on the right ;~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~* WEnd Thank you, Docfxit
careca Posted February 4, 2017 Posted February 4, 2017 I guess a combination of things could work. Is that application yours? is it third-party? For an application that's yours you could use something like this example: $SearchCursorInfo = GUIGetCursorInfo($YOURGUI) If $SearchCursorInfo[4] = $BUTTON Then ;is the cursor on top of the button? If _IsPressed("01", $hDLL) Then ;was the left mouse button pressed? For third party im not sure, maybe get the text of the control mouse is hovering and then detecting a mouse press. Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe
Subz Posted February 4, 2017 Posted February 4, 2017 Something like this maybe: #include <Array.au3> Opt("WinWaitDelay",100) HotKeySet('^s', 'SelectBookMarks') HotKeySet('^q', 'ExitScript') While 1 Sleep(100) WEnd Func SelectBookMarks() $hWnd = WinWait("Bookmark Duplicate Cleaner","") If Not WinActive($hWnd,"") Then WinActivate($hWnd,"") WinWaitActive($hWnd,"") ;~ Get Window Position $aWinPos = WinGetPos($hWnd,"") ;~ Select left hand column MouseClick('left', $aWinPos[0] + 30, $aWinPos[1] + 50) ;Select bookmark on the left column Send("{TAB}{SPACE}") ;Select duplicate on the right Send("{TAB 3}") EndFunc Func ExitScript() Exit EndFunc
Docfxit Posted February 5, 2017 Author Posted February 5, 2017 Hi careca, The application does not belong to me. It's a free add-on to Firefox called Bookmark Duplicate Cleaner. Your solution almost works. I have commented out the first two lines, added an EndIf and an #include. What happens is the script doesn't stop to wait for me to select the entries on the right column. This is what I have: Opt("WinWaitDelay", 100) Opt("WinTitleMatchMode", 4) Opt("WinDetectHiddenText", 1) Opt("MouseCoordMode", 0) #include <Misc.au3> Local $YOURGUI, $BUTTON, $hDLL While 1 = 1 WinWait("Bookmark Duplicate Cleaner", "") If Not WinActive("Bookmark Duplicate Cleaner", "") Then WinActivate("Bookmark Duplicate Cleaner", "") WinWaitActive("Bookmark Duplicate Cleaner", "") ;Select bookmark on the left column Send("{TAB}{SPACE}") ;Select duplicate on the right Send("{TAB}{DOWN}") ;~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~* ;I would like to pause Until I select the delete key with the mouse. ; This gives me time to Select the bookmarks on the right ;~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~* ;$SearchCursorInfo = GUIGetCursorInfo($YOURGUI) ;If $SearchCursorInfo[4] = $BUTTON Then ;is the cursor on top of the button? ;EndIf If _IsPressed("01", $hDLL) Then ;was the left mouse button pressed? EndIf WEnd Thank you, Docfxit
Docfxit Posted February 5, 2017 Author Posted February 5, 2017 Hi Subz, You solution almost works. It doesn't let me select the bookmarks on the right. When I press the "S" it automatically selects and deletes the last bookmark on the right. I need it to allow me to select the bookmarks I want to delete and then I will press the Delete button. Thank you, Docfxit
Subz Posted February 5, 2017 Posted February 5, 2017 Strange because I have the app on my system and it works fine, are you pressing Ctrl+s?
InunoTaishou Posted February 5, 2017 Posted February 5, 2017 You could try this, it's a lot more complicated than using _IsPressed but it will only get called when a mouse event happens and only execute code when the left mouse button is released. I left those commented out $hParent and $iCtrlId in case you wanted to delve further. The WindowFromPoint should get the handle of the button, which you can compare in the If statement. But you might want to get the parent of that button and get the control id of a control from a handle expandcollapse popup#include <WinAPI.au3> #include <WindowsConstants.au3> Global Const $tagMSLLHOOKSTRUCT = $tagPOINT & ";DWORD mouseData;DWORD flags; DWORD time;ULONG_PTR dwExtraInfo" Global $hKeyProc = DllCallbackRegister("KeyProc", "long", "int;wparam;lparam") Global $hKeyHookEx = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, DllCallbackGetPtr($hKeyProc), _WinAPI_GetModuleHandle(0)) OnAutoItExitRegister(Cleanup) While 1 Sleep(100) WEnd Func KeyProc($nCode, $wParam, $lParam) If ($nCode < 0) Then Return _WinAPI_CallNextHookEx($hKeyHookEx, $nCode, $wParam, $lParam) Switch ($wParam) Case $WM_LBUTTONUP Local $tMsllHookStruct = DllStructCreate($tagMSLLHOOKSTRUCT, $lParam) Local $hWindowUnderMouse = _WinAPI_WindowFromPoint($tMsllHookStruct) $tMsllHookStruct = Null ;~ Local $hParent = _WinAPI_GetParent($hWindowUndermouse) ;~ If (@Error) Then EndSwitch ;~ Local $iCtrlId = _WinAPI_GetDlgCtrlID($hWindowUndermouse) ;~ If (@Error) Then EndSwitch If ($hWindowUnderMouse = ControlGetHandle("Bookmark Duplicate Cleaner", "", "[Class:Button(BUTTON ID HERE)]")) Then ; Unpause script or do whatever you want EndIf EndSwitch Return _WinAPI_CallNextHookEx($hKeyHookEx, $nCode, $wParam, $lParam) EndFunc ;==>_KeyProc Func Cleanup() _WinAPI_UnhookWindowsHookEx($hKeyHookEx) DllCallbackFree($hKeyProc) OnAutoItExitUnRegister(Cleanup) EndFunc ;==>Cleanup
Docfxit Posted February 5, 2017 Author Posted February 5, 2017 Hi InunoTaishou, I tried getting the Button ID for the delete box. The AutoIt Window Info program doesn't show a Control for the Delete box. I wish it did. Thanks, Docfxit
Docfxit Posted February 5, 2017 Author Posted February 5, 2017 Hi Subz, I modified it slightly and it's almost working. I'm getting an error on the MouseClick because I added speed = 0 The error I get is undefined function. #include <Array.au3> Opt("WinWaitDelay", 100) AutoItSetOption("TrayIconDebug", 1) HotKeySet('^s', 'SelectBookMarks') HotKeySet('^q', 'ExitScript') While 1 Sleep(100) WEnd Func SelectBookMarks() $hWnd = WinWait("Bookmark Duplicate Cleaner", "") If Not WinActive($hWnd, "") Then WinActivate($hWnd, "") WinWaitActive($hWnd, "") ;~ Get Window Position $aWinPos = WinGetPos($hWnd, "") ;~ Select left hand column MouseClick('left', $aWinPos[0] + 30, $aWinPos[1] + 70, 1, speed = 0) ;Select duplicate on the right Send("{TAB}{Down}{SPACE}") ;Move Mouse to right column MouseMove($aWinPos[0] + 530, $aWinPos[1] + 90, speed = 0) ;Select Delete Button Send("{TAB 3}") EndFunc ;==>SelectBookMarks Func ExitScript() Thanks, Docfxit
Subz Posted February 5, 2017 Posted February 5, 2017 You'll need to replace speed = 0 with just 0 for example: MouseMove($aWinPos[0] + 530, $aWinPos[1] + 90, 0)
Docfxit Posted February 5, 2017 Author Posted February 5, 2017 Hi Subz, You are really great. It works absolutely perfect. Thank you very very much, Docfxit
careca Posted February 5, 2017 Posted February 5, 2017 11 hours ago, Docfxit said: What happens is the script doesn't stop to wait for me to select the entries on the right column. That would be the second part of the help, it was now i would point you in that direction. Seeing that you have found another solution, im happy for you. =) Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe
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