MarkJoel60 Posted August 6, 2008 Share Posted August 6, 2008 I was running through a test script that was working fine, and it fails to enter text into a control suddenly. Weird... since it was working last night... I pull up WinInfo and check the control, to find its INSTANCE NUMBER HAS CHANGED!I run the app as a user, and follow aong with WinInfo... sure enough, depending on which way I bring my windows up, my instances CHANGE... making my script completely unreliable.Two questions: 1) Am I crazy? Or have others seen this behavior?2) Does anyone have a work-around?I was thinking that I could do a mouse click at the control's position, and grab the ID, and then use it instead of the CLASS and INSTANCE... but there seems to be no way of doing this...So, am I stuck with just using mouse-clicks and SENDS() followed by mouse clicks, right mouse click, select all, copy? (Yuck!) Link to comment Share on other sites More sharing options...
amokoura Posted August 6, 2008 Share Posted August 6, 2008 Sending {TAB}s to navigate to the control might help a bit.. Link to comment Share on other sites More sharing options...
MarkJoel60 Posted August 6, 2008 Author Share Posted August 6, 2008 Sending {TAB}s to navigate to the control might help a bit.. Well, I can mouseclick into the position, too. It's just the documentation says: "ControlSend is only unreliable for command prompts as that works differently to normal windows (seems to check physical states rather than accepting the keystroke messages). For normal windows ControlSend should be way more reliable than a normal Send - and yes it does send shift, ctrl, alt etc." But if the instance changes, then it is fully unreliable. The ControlSend function also talks about an ID and even shows a snippet of how to use it: ControlClick("My Window", "", "[ID:254]") But there is no function available (that I can see) in AutoIt that allows you to get the ID. If they are referring to what UISpy calls: "RuntimeId" then this, too, will change every time a program is executed. Which would be fine, if I had a way of getting them and storing it in an internal table or something... but again, I see no function for getting a runtime ID within AutoIt. Anyone who is running AutoIt against a program that is using a tab control will have the same problem I am seeing. It appears that AutoIt is making an assumption that you are running a program which is a single window full of a static list of controls. But a Tabbed control, or in my case an application that uses only one screen, and changes the controls on them depending on choices, renders all of the control functions unreliable. Or, so it seems... I am hoping someone tells me I am oh-so-wrong... Link to comment Share on other sites More sharing options...
amokoura Posted August 6, 2008 Share Posted August 6, 2008 How about the control location, is it always the same? That's another semi-reliable identification method Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 6, 2008 Moderators Share Posted August 6, 2008 http://www.autoitscript.com/forum/index.ph...c=30717&hl= Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
herewasplato Posted August 7, 2008 Share Posted August 7, 2008 ...Two questions: 1) Am I crazy? Or have others seen this behavior?...No - you are not crazy :-)Try the link that SmOke_N posted. [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
MarkJoel60 Posted August 7, 2008 Author Share Posted August 7, 2008 No - you are not crazy :-)Try the link that SmOke_N posted.OK, SmOke_N (and 'herewasplato' ) Thanks for helping maintain my sanity...Interesting script... here's the thing... for speed sake, I have converted my scripts to c# code and am just using the DLL... so, has anyone translated this into a function? (Be nice to add it to the DLL... but even just a class code...)I can do it... but I figured, hey, if someone already had it done...? Link to comment Share on other sites More sharing options...
flyonthewall Posted January 22, 2009 Share Posted January 22, 2009 any suggestions for Instance Number/ID changing each time the application is launched?i've tried the ControlClick, but does not good if the Instance or ID change.thanksControlClick("Spyware Terminator Center 2.5.1.028", "", "[CLASS:TPicBtn; INSTANCE:102]") ControlClick("Spyware Terminator Center 2.5.1.028", "", 328500) ControlClick("Spyware Terminator Center 2.5.1.028", "", "[CLASS:TPicBtn; INSTANCE:96]") ControlClick("Spyware Terminator Center 2.5.1.028", "", 459608) Link to comment Share on other sites More sharing options...
herewasplato Posted January 24, 2009 Share Posted January 24, 2009 any suggestions for Instance Number/ID changing each time the application is launched? ...You did not say if you had tried the info presented in post #5 of this thread. [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Akvice Posted December 14, 2018 Share Posted December 14, 2018 After clicking a control of another application, if bringToFront command or something like that runs, instance number changes. Maybe it causes. 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