CaptainBeardsEyesBeard Posted November 8, 2019 Posted November 8, 2019 Basically I have written some tests using mostly mouseclicks and send commands Can I wrap my code ensuring that it only runs if the WinActivate window is the correct window?
rudi Posted November 8, 2019 Posted November 8, 2019 Hi $WinTitle="Window Title" $WinText="Window Text" while 1 if WinActivate($WinTitle,$WinText) Then Doit() Else Sleep(100) EndIf WEnd Func Doit() ; your code goes here EndFunc cu, Rudi. CaptainBeardsEyesBeard 1 Earth is flat, pigs can fly, and Nuclear Power is SAFE!
FrancescoDiMuro Posted November 8, 2019 Posted November 8, 2019 @rudi Since it's a While 1, it's better to use Sleep anyway Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
rudi Posted November 11, 2019 Posted November 11, 2019 @FrancescoDiMuro Well, I'd put a Sleep() statement inside the Doit() function, in case it's just very Little code to be executed there... Earth is flat, pigs can fly, and Nuclear Power is SAFE!
rudi Posted November 11, 2019 Posted November 11, 2019 @CaptainBeardsEyesBeard Hint: Have a look at the functions ControlCommand(), ControlSend(), ControlSetText().... They explicitely "send" what you Need to the wanted window and do not depend on that the wanted window is the active one. CU, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE!
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