Jump to content

Help with my project


BruceGC
 Share

Recommended Posts

  • Replies 52
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

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

Link to comment
Share on other sites

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

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

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

Female.JPG

Male.JPG

Link to comment
Share on other sites

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:

 

Link to comment
Share on other sites

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

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:

 

Link to comment
Share on other sites

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

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

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

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