BruceGC Posted February 22, 2021 Author Share Posted February 22, 2021 Not sure if this helps Link to comment Share on other sites More sharing options...
Nine Posted February 22, 2021 Share Posted February 22, 2021 @BruceGC It doesn't seem it has access to drop down box content. I do not see any option. You may as well continue with the approach you have used so far. As for the examples, there is a subfolder in the UIAutomation tree folders called Examples. Inside it there is numerous example scripts that you can study if you wish to. Good luck. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Earthshine Posted February 22, 2021 Share Posted February 22, 2021 (edited) try using @junkew UDF for UIAutomation Wrappers. His spy tool can generate useful code Edited February 22, 2021 by Earthshine My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
BruceGC Posted February 22, 2021 Author Share Posted February 22, 2021 thanks you for your help todate. I have tried to use some other key recording software / scripts which all seem to work with limited success. Its the drop box for sex that buggers it for me as I cannot paste in to it. If the sheet has Male I need the script to beable to read that and press M of F. I will keep hunting around. It will not matte how slow the script runs as it has to be better than my slow typing every record in. Cheers Bruce Link to comment Share on other sites More sharing options...
BruceGC Posted February 23, 2021 Author Share Posted February 23, 2021 I have run the Autoit recorder and Iam adding a litle bit of code to capture in order to activate the Sex dropdown. But what has me buggered is the click to select the Male of Female is not changing with the copied text from excel in the $Data. I can see in the message box that the data is correct. the open sex is the screen location of the dropdown. The $Male and $Female as just the screen locations to be clicked on to select Male / Female But depending on which line of green code is first is the location selceted regardless of what is in $Data. If I switch them around so does my result. Being new to this I am enjoying the ride but this simple IF fuction has me buggered. Thanks for any help Bruce ******************************************************* MouseClick("left",902,695,1) ;Select New Dog window _WinWaitActivate("New Dog","") ; Back to New Dog MouseClick("left",233,101,1) ;open sex $Data = ClipGet() $Female = MouseClick("left",268,148,1) ; Select Female $Male = MouseClick("left",227,130,1) ;Select Male MsgBox($Data, "Title", "This is the sex copied " & $Data & " select the OK button.", 10) If $Data = "Female" Then $Female EndIf If $Data = "Male" Then $Male EndIf Sleep (3000) MouseClick("left",517,567,1) ********************************************************************************** Link to comment Share on other sites More sharing options...
dmob Posted February 23, 2021 Share Posted February 23, 2021 10 hours ago, BruceGC said: If $Data = "Female" Then $Female EndIf If $Data = "Male" Then $Male EndIf Your syntax is incorrect. Try this: If $Data = "Female" Then MouseClick("left",268,148,1) ; Select Female ElseIf $Data = "Male" Then MouseClick("left",227,130,1) ; Select Male EndIf Link to comment Share on other sites More sharing options...
BruceGC Posted February 23, 2021 Author Share Posted February 23, 2021 Thanks but it returns the same result. If male comes first in the code it still displays male even if female is on the clipboard and the same if I swap these two green lines. sorry for the large copy but I thought there maybe something tha tyou cannot see. You can see from the screen shots (code as below) that the clipboard updates ($Data) when I change it in excel but it won't select Male. Thanks Bruce **************************************************************************************************************************** #region --- Au3Recorder generated code Start (v3.3.9.5 KeyboardLayout=00000409) --- #include <MsgBoxConstants.au3> #include <Clipboard.au3> #region --- Internal functions Au3Recorder Start --- Func _Au3RecordSetup() Opt('WinWaitDelay',100) Opt('WinDetectHiddenText',1) Opt('MouseCoordMode',0) Local $aResult = DllCall('User32.dll', 'int', 'GetKeyboardLayoutNameW', 'wstr', '') If $aResult[1] <> '00000409' Then MsgBox(64, 'Warning', 'Recording has been done under a different Keyboard layout' & @CRLF & '(00000409->' & $aResult[1] & ')') EndIf EndFunc Func _WinWaitActivate($title,$text,$timeout=0) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) EndFunc _AU3RecordSetup() #endregion --- Internal functions Au3Recorder End --- _WinWaitActivate("Zoo Import Final 33.xlsm - Excel","") MouseMove(187,305) MouseDown("left") MouseMove(187,304) MouseUp("left") Send("{CTRLDOWN}c{CTRLUP}") ; copy name _WinWaitActivate("Program Manager","") MouseClick("left",899,695,1) _WinWaitActivate("jenny test2.ped — PedPro","") MouseClick("left",627,75,1) _WinWaitActivate("New Dog","") MouseMove(223,79) MouseDown("left") MouseMove(223,78) MouseUp("left") Send("{CTRLDOWN}v{CTRLUP}") ; paste name _WinWaitActivate("Program Manager","") MouseClick("left",467,696,1) _WinWaitActivate("Zoo Import Final 33.xlsm - Excel","") MouseClick("left",126,306,1) Send("{CTRLDOWN}c{CTRLUP}") ;Copy sex _WinWaitActivate("Program Manager","") MouseClick("left",902,695,1) ;Select New Dog window _WinWaitActivate("New Dog","") ; Back to New Dog MouseClick("left",233,101,1) ;open sex $Data = ClipGet() ;$Sex = MouseClick("left",233,101,1) ;Select Sex $Female = MouseClick("left",268,148,1) ; Select Female $Male = MouseClick("left",227,130,1) ;Select Male MsgBox($Data, "Title", "This is the sex copied " & $Data & " select the OK button.", 10) If $Data = "Female" Then MouseClick("left",268,148,1) ; Select Female ElseIf $Data = "Male" Then MouseClick("left",227,130,1) ; Select Male EndIf Sleep (3000) MouseClick("left",517,567,1) #endregion --- Au3Recorder generated code End --- Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted February 23, 2021 Share Posted February 23, 2021 6 minutes ago, BruceGC said: $Female = MouseClick("left",268,148,1) ; Select Female $Male = MouseClick("left",227,130,1) ;Select Male Remove these lines of code. It's normal to hit the same wall if you don't change your direction Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
BruceGC Posted February 23, 2021 Author Share Posted February 23, 2021 OOPs I highlighted the wrong lines $Data = ClipGet() ;$Sex = MouseClick("left",233,101,1) ;Select Sex $Female = MouseClick("left",268,148,1) ; Select Female $Male = MouseClick("left",227,130,1) ;Select Male MsgBox($Data, "Title", "This is the sex copied " & $Data & " select the OK button.", 10) If $Data = "Male " Then MouseClick("left",227,130,1) ; Select Male ElseIf $Data = "Female " Then MouseClick("left",268,148,1) ; Select Female ;If $Data = "Female " Then ; MouseClick("left",268,148,1) ; Select Female ;ElseIf $Data = "Male " Then ;MouseClick("left",227,130,1) ; Select Male EndIf Sleep (3000) MouseClick("left",517,567,1) Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted February 23, 2021 Share Posted February 23, 2021 1 minute ago, BruceGC said: $Female = MouseClick("left",268,148,1) ; Select Female $Male = MouseClick("left",227,130,1) ;Select Male Are you still running these lines of code? Did you see that in both strings there is a trailing space? Is it how it should be? Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
BruceGC Posted February 23, 2021 Author Share Posted February 23, 2021 The trailing space is added in excel as some records had them and some didn't. I will strip them all out before I run the 5000 records Now my script is stopping once the dropdown box is selected and before it clicks on Male or Female. Thanks ****************************************** MouseClick("left",902,695,1) ;Select New Dog window _WinWaitActivate("New Dog","") ; Back to New Dog MouseClick("left",233,101,1) ;open sex $Data = ClipGet() ;$Sex = MouseClick("left",233,101,1) ;Select Sex MsgBox($Data, "Title", "This is the sex copied " & $Data & " select the OK button.", 10) If $Data = "Male " Then MouseClick("left",227,130,1) ; Select Male ElseIf $Data = "Female " Then MouseClick("left",268,148,1) ; Select Female EndIf Sleep (3000) MouseClick("left",517,567,1) #endregion --- Au3Recorder generated code End --- Link to comment Share on other sites More sharing options...
Nine Posted February 23, 2021 Share Posted February 23, 2021 Please use this tool when you post code. You might want to add some sleep after MouseClick ? “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted February 23, 2021 Share Posted February 23, 2021 26 minutes ago, BruceGC said: MsgBox($Data, "Title", "This is the sex copied " & $Data & " select the OK button.", 10) What is the result of this instruction? Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
BruceGC Posted February 23, 2021 Author Share Posted February 23, 2021 Thats of that Nine. I added 1000 sleep after each MouseClick and it still stops once the dropbox has been sleceted. Its has me buggered as I thought this would be easy. I have spent so long on it that I am making silly mistakes now. Link to comment Share on other sites More sharing options...
BruceGC Posted February 23, 2021 Author Share Posted February 23, 2021 1 minute ago, FrancescoDiMuro said: What is the result of this instruction? It always shows correct as per the Excel Link to comment Share on other sites More sharing options...
BruceGC Posted February 23, 2021 Author Share Posted February 23, 2021 2 minutes ago, BruceGC said: Thats of that Nine. I added 1000 sleep after each MouseClick and it still stops once the dropbox has been sleceted. Its has me buggered as I thought this would be easy. I have spent so long on it that I am making silly mistakes now. mistakes like "Thats of that" instead of Thanks for that Link to comment Share on other sites More sharing options...
Nine Posted February 23, 2021 Share Posted February 23, 2021 Can you show how the screen looks like after clicking sex dropdown ? “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
BruceGC Posted February 23, 2021 Author Share Posted February 23, 2021 Like this. the screen positions work if I just run the string to test them. Thanks Link to comment Share on other sites More sharing options...
Nine Posted February 23, 2021 Share Posted February 23, 2021 Ok, lets try to use Send("{DOWN}") for Male and Send("{DOWN}{DOWN}") for Female “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
BruceGC Posted February 23, 2021 Author Share Posted February 23, 2021 No joy with the send down. The code activates the dropbox but nothing is being selected. 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