locutus243 Posted September 27, 2005 Posted September 27, 2005 Hi, I am tabbing through an application, therefore not using the mouse. I need to know when my tabbing reaches a particular button. If I was using the cursor then I could use the ControlID, ClassNameNN or the Text but because I am tabbing then I don't know how autoIT can recognise when it reaches this button. Once I can recognise when I tab over the button then I can command the program to stop. Is there anyway I can do this or is such recognition only possible with the mouse??? Thanks Mark
LxP Posted September 27, 2005 Posted September 27, 2005 You only need to use the mouse for AutoIt Window Info to identify the control. You then code that information (e.g. control ID) into an AutoIt script, which would find the correct control based on the given information regardless of the position of the mouse when the script is executed. Does that answer your question or am I far off?
locutus243 Posted September 27, 2005 Author Posted September 27, 2005 Hiya, Thanx for trying to help, I'm really stuck with this. I can identify the control id of the button I am trying to stop my tab on. But how do I then stop it in my code. E.g. If I'm tabbing over four buttons with different control id's, how can I tell it to stop when it reaches the fourth one??? Thankyou Mark
GaryFrost Posted September 27, 2005 Posted September 27, 2005 try the Send command for example: Send("{TAB 4}") SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
LxP Posted September 27, 2005 Posted September 27, 2005 (edited) Edit: Ugh, I saw 'tabs' in your post and thought you were referring to e.g. the tabs that you find in a file's Properties window. You may want to look at the ControlFocus() command. I understand what you mean now and it might be slightly trickier than I thought. Try opening AutoIt Window Info again and watch the 'Visible Window Text' area as you click the different tabs. Is there any unique text shown when you arrive on your desired tab? If so, you could do something like this: while not(winExists("Window title", "(the unique text)")) send("^{TAB}") wEnd Edited September 27, 2005 by LxP
locutus243 Posted September 27, 2005 Author Posted September 27, 2005 Hey, Thanks for your help, but it doesn't quite do what I was trying to achieve. It alows me to go straight to a particular button, but I want my script to recognise when it is on a particular button and then stop the script. Is there a tool that can do this??? (i.e. If I'm tabbing across a number of buttons, is there a way that my script recognises the classname of the button its on and is there a way I can tell it to stop on a particular button??) Thanks Mark
LxP Posted September 27, 2005 Posted September 27, 2005 (edited) You could look at the ControlGetFocus() function, which will return something like 'Button4' ** when the desired control has focus? You could then do something similar to what I've crossed out above. I don't understand why you would want to take this route instead of just a single ControlSetFocus() call however. ** Edit: Obviously you would use AutoIt Window Info to determine the real data that's returned for the button. Edited September 27, 2005 by LxP
herewasplato Posted September 27, 2005 Posted September 27, 2005 (edited) ...but I want my script to recognise when it is on a particular button and then stop the script.I'll agree with LxP in that I do not know why you would ever want to "tab around" like that... but here is some code that shows how to "stop the script" on the button of interest.Assumes XP for the OS:Run("rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,3") ;hopefully this will bring up the System Properties interface ; ; WinWait("System Properties", "You must be") WinActivate("System Properties", "You must be") WinWaitActive("System Properties", "You must be") ;wait for the window, activate it and ;wait for it to be active ; ; Do Send("{TAB}") Sleep(1000) Until ControlGetFocus("System Properties", "You must be") = "Button7" ;send tab until "Button7" is found ; ; MsgBox(0, "AutoIt", "Button7 = Environment Variables")Edit: My code/comments may not make sense - so I'll ask... Clear as mud? :-)Edit2: changed codebox to code Edited October 12, 2005 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size]
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