roadrunner Posted April 26, 2004 Posted April 26, 2004 Here the code i'm tring. controlfocus ("FILEGEN*","","Class: TFlatButton2 Text: Generate") controlclick ("FILEGEN*","","Class: TFlatButton2 Text: Generate","left",1) I'm running a program which starts and asks you to press the generate button and i've tried using the scripe above but it doesn't work. The class:TFlatButton2 Text: Generate are copied straight from the autoit window spy. any idears
Valik Posted April 26, 2004 Posted April 26, 2004 There is no guarantee any of the control functions will work. The highest chance for success comes with trying to maninpulate standard Microsoft controls, any 3rd party control that responds is just pure luck. That control name isn't one of Microsoft's.
bshoenhair Posted April 26, 2004 Posted April 26, 2004 (edited) If Not WinExists("FILEGEN" , "") then MsgBox ( 0, "Not Open", "FILEGEN is not open.") Exit EndIf controlclick("FILEGEN","","TFlatButton2","left",1) Edited April 26, 2004 by bshoenhair
Valik Posted April 26, 2004 Posted April 26, 2004 bshoenhair, is probably right. I didn't pay attention you just copied the whole line and not the relevant part. I'm so used to answering with what I replied when I see "Controlfunction doesn't work".
Batch Posted April 26, 2004 Posted April 26, 2004 Not trying to insult your intelligence, but do you have a WinWait statement above? Did you turn on the detecthiddentext option?
roadrunner Posted April 26, 2004 Author Posted April 26, 2004 I put this code into my scripe but it says that filegen is not open, I have also put detecthiddentext =1 into the scripe but still no joy. any more ideals If Not WinExists("FILEGEN" , "") then MsgBox ( 0, "Not Open", "FILEGEN is not open.") Exit EndIf
Developers Jos Posted April 26, 2004 Developers Posted April 26, 2004 I put this code into my scripe but it says that filegen is not open, I have also put detecthiddentext =1 into the scripe but still no joy.any more idealsIf Not WinExists("FILEGEN" , "") then MsgBox ( 0, "Not Open", "FILEGEN is not open.")ExitEndIfcouple of questions:- was your program already running before you tested this code or is your script also starting the program ?- what is the exact text in the title of the window ? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Guest leesob Posted June 22, 2004 Posted June 22, 2004 I also have this problem. I am using the AutoIt DLL (from C#) and have the following calls when trying to confirm the standard Windows 'Save As' dialog: m_autoItCtrl.ControlFocus("Save As", "", "Button2"); m_autoItCtrl.ControlClick("SaveAs", "", "Button2", "left", 1); This code seems to work sometimes and others not. When it fails to work I do notice that the focus has changed and the 'Save As' button seems to get pressed but the dialog is not dismissed. The effect is similar to clicking on the button and taking the mouse off of it without releasing the left mouse button.
Guest leesob Posted June 22, 2004 Posted June 22, 2004 Okay probably unrelated but I seem to have 'fixed' my problem. I was trying to simulate a right click (okay on a custom control) that pops up a context menu, followed by sending 'S' (for save), finishing with automating the standard Windows save as dialog to save the control image to file (it's a graph display control). What I had previously and didn't work was: - changing the focus to the custom control, - Using ControlClick to send a right mouse click to get access to the popup menu - sending Send("{S}", 1) to send the 'S' character to select save from the popup menu - there after setting the filename on the 'Save As' dialog and attempting to click the save button as previously discussed. What I changed (and now it works) was instead of using Send("{S}", 1) I now use ControlSend("My app", "", "WindowsForms10.window.8.app31", "{S}", 0). The significant point to note is that as well as changing the actual method call used I also changed the last parameter, clearly '1' was incorrect since I don't want special interpretation used I just want to sent the 'S' char. I haven't tested whether or not Send("{S}", 0) allows my application to work. So whilst I technically had an error in my logic it was in an apparently unrelated area and may point to an underlying issue with the use of special character interpretation in the Send method. It would seem that incorrectly sending '1' seemed to latch the autoIt DLL in a potentiall unreliable state for subsequent use. I hope this proves useful to your problem.
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