wzc0014 Posted February 13, 2015 Author Share Posted February 13, 2015 They aren't, they are titled Plot of $svar, $svar = "PC_0to280", so Plot of PC_0to280 Link to comment Share on other sites More sharing options...
JohnOne Posted February 13, 2015 Share Posted February 13, 2015 Is one of then titled "Plot of PC_0"? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
wzc0014 Posted February 13, 2015 Author Share Posted February 13, 2015 No it is always titled whatever the $svar is set equal to, and that never changes unless I change it. So it is always "Plot of PC_0to280" Link to comment Share on other sites More sharing options...
JohnOne Posted February 13, 2015 Share Posted February 13, 2015 So if the window is always titles "Plot of PC_0to280" Then why not... ControlClick("Plot of PC_0to280", "", "[CLASS:Button; INSTANCE:3]", "left") And why do you have a loop? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
wzc0014 Posted February 13, 2015 Author Share Posted February 13, 2015 I have tried that as well. Does not work. I only use a variable because when analyzing data the name changes from day to day and it's easier to change it once rather than 5 times. I have a loop because my other window is a stack of images. I plot the values of the images to the window I am trying to copy from, paste them in excel then close the plot window, move to the next image, and then replot copy paste etc. That loops for however many number of images I have in the stack. Everything else works I just can't get the copy button to click. Link to comment Share on other sites More sharing options...
JohnOne Posted February 13, 2015 Share Posted February 13, 2015 It's all very confusing as to what you are trying to achieve. Run this code in scite4autoit, see if you understand why your loop makes no sense... $var = "PC_0to280" ConsoleWrite(Int($var) & @LF) For $i = 1 To $var ConsoleWrite($i & @LF) Next AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
JohnOne Posted February 13, 2015 Share Posted February 13, 2015 Your loop will run exactly zero (0) times. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
wzc0014 Posted February 13, 2015 Author Share Posted February 13, 2015 (edited) I apologize. I had only posted the portion of code I was having trouble with, the button not clicking. This is it in its entirety. expandcollapse popup $svar = "PC_0to280" ;name of imajeJ stack $svar1 = " (75%)" ;window size $svar2 = "Microsoft Excel - 020915_PC data 0 to 280 by 20" ;Name of excel workbook $svar3 = "154" ;mouse x axis $svar4 = "423" ;mouse y axis $svar5 = "70" ;number of images in stack WinActivate($svar & $svar1) Sleep(0500) WinWaitActive($svar & $svar1) Sleep(1000) WinActivate("ImageJ") Sleep(0500) WinWaitActive("ImageJ") Sleep(2500) Send("{ALTDOWN}") Sleep(0050) SEND("{ALTUP}") Sleep(0050) Send("{RIGHT}") Sleep(0050) Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Sleep(0050) Send("{RIGHT}") Sleep(0050) Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Sleep(0050) Send("{ENTER}") Sleep(1000) Send("1280") Sleep(0500) Send("{TAB}") Send("43") Sleep(0500) Send("{TAB}") Send("0") Sleep(0500) Send("{TAB}") Send("469") Sleep(0500) Send("{ENTER}") Sleep(1000) For $i = 1 To $svar5 Sleep (0500) Send("^k") WinActivate("Plot of " & $svar) WinWaitActive("Plot of " & $svar) Sleep(0500) ControlClick("Plot of PC_0to280", "", 3, "left") Sleep(0500) WinActivate($svar2) WinWaitActive($svar2) Send("^v") Sleep(0500) Send("{RIGHT}") Send("{RIGHT}") WinClose("Plot of " & $svar) WinActivate($svar & $svar1) WinWaitActive($svar & $svar1) Send("+{RIGHT}") Next Edited February 13, 2015 by wzc0014 Link to comment Share on other sites More sharing options...
JohnOne Posted February 13, 2015 Share Posted February 13, 2015 If .... ControlClick("Plot of PC_0to280", "", "[CLASS:Button; INSTANCE:3]", "left") ...does not work to simply close your window of that name, then I would assume your window has non standard controls (which just happen to look like standard controls) and you will have to find another way. IUIAutomation is where people go from here, you will find that in example scripts. Also if you are going to do something like... Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") You might as well do... Send("{DOWN 12}") AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
wzc0014 Posted February 13, 2015 Author Share Posted February 13, 2015 I will assume it is not a standard window then. Thanks for the suggestion. I am new to this if you can't notice so I tried doing things the simplest way Link to comment Share on other sites More sharing options...
JohnOne Posted February 13, 2015 Share Posted February 13, 2015 Did you actually try ControlClick("Plot of PC_0to280", "", "[CLASS:Button; INSTANCE:3]", "left") on its own without any other code? and in no loop. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
wzc0014 Posted February 13, 2015 Author Share Posted February 13, 2015 Yes, still does not click the copy button. Link to comment Share on other sites More sharing options...
JohnOne Posted February 13, 2015 Share Posted February 13, 2015 Then I'm 99% certain it is not a standard control. If you are not up for IUIAutomation, I suggest to send what ever series of TAB and Arrow keys get you to the button, and then Enter of SpaceBar, whatever works. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Solution wzc0014 Posted February 13, 2015 Author Solution Share Posted February 13, 2015 Thank you. I had tried to activate it and then press enter earlier, but I never thought to try "Space"! It works with space now. This is the code I ended up using. The controlclick won't click the button but it "activates" it and then I can press space to "click" it. ControlClick("Plot of " & $svar,"",3) Send("{Space}") Thanks for your help. Link to comment Share on other sites More sharing options...
JohnOne Posted February 13, 2015 Share Posted February 13, 2015 Not Ideal, but better than nothing. Actually, try... ControlSend("Plot of " & $svar,"",3,"{Space}") Instead of Send. 0xygen8 1 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. 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