Consistency Issue

I have a script that is ran as the last script in a schedule. When this script is ran in the schedule it fails, however when I run it after that it doesn't fail.

I've put the code below, the purpose of the script is to multiple select some items (by using the KeyDown ControlKey command) and drag them onto the apps desktop.
-- Clear all left over object menu arrows
put everyImageLocation("objectMenu") into overallLocations 
put the number of items in overallLocations into i 
Repeat while i > 0 
	MoveTo item i of overallLocations 	
	Subtract 1 from i 
End Repeat 

MoveTo "fieldMaritalStatus"
WaitFor 10.0, "objectMenu"
MoveTo "objectMenu"
Click "objectMenu"
WaitFor 10.0, "valuesMenu"
MoveTo "valuesMenu"
WaitFor 10.0, "valuesMenuSelected"
MoveTo "valuesMenuSelected"
WaitFor 10.0, "valuesMaritalStatusDisplayed"
MoveTo "valuesMaritalStatusDivorced"

-- This click doesn't always happen
Click "valuesMaritalStatusDivorcedHover"

MoveTo "valuesMaritalStatusWidowed"
KeyDown ControlKey
Click "valuesMaritalStatusWidowedHover"
MouseButtonDown 1
Drop "desktopMoveLocation"
KeyUp ControlKey
WaitFor 10.0, "maritalStatusDivorcedWidowedOpenVerify"

Does anyone know why this is happening? I don't think there is a problem with the code but I may be wrong! :?

Comments

  • JonathanOSXJonathanOSX ForumAdmin admin
    Can you describe how it's failing? Do you get an error when it runs? or does it just not do what you expect it to on the SUT?
  • EggplantMattEggplantMatt ForumAdmin admin
    I see that you are using a lot of keydown/keyup and mousebuttondown/mousebuttonup commands. I'd be suspicious that in one of the scripts before this script you have a mismatch where there is a down action but no corresponding up action, so when you get to this script, you have a modifier key in the down position (I don't think a mouse button down would cause a problem, but it might). When you run the script by itself, it starts with all of the modifier keys up, so it works as intended.
  • I've managed to get around this by replacing the Click with a DoubleClick. The object gets selected as expected then.

    Matt - Does a drop constitute a MouseButtonUp action or will I need to clear these MouseButtonDown actions that I've been performing?
  • EggplantMattEggplantMatt ForumAdmin admin
    A drop will release the left mouse button -- if you've put a different mouse button down then it will still be down after the drop.
Sign In or Register to comment.