tekhed Posted October 29, 2004 Share Posted October 29, 2004 I have been trying for literally days to get ANY type of function to work. I have SCiTE open on the left, AutoIT help open on the right, and I've sat for hours trying all manner of functions with different syntaxes, etc. I am becoming convinced that I do not have a firm enough understanding of this language to accomplish the task I set forth. The script as follows: $text = ClipGet() Do Call("window1") send("^v{TAB 6}") Call("window2") Send("{RIGHT}^c") Call("window1") send("^v{TAB 2}") Call("window2") Send("{RIGHT}^c") Call("window1") send("^v{TAB}") Call("window2") Send("{RIGHT}^c") Call("window1") send("^v{TAB 4}") Call("window2") Send("{RIGHT}^c") Call("window1") send("^v{TAB 2}") Call("window2") Send("{RIGHT}^c") Call("window1") send("^v{TAB}") Call("window2") Send("{RIGHT}^c") Call("window1") send("^v{ENTER}") sleep(2000) send("{ENTER}") sleep(2000) Call("window2") send("{DOWN}{LEFT 6}^ ") il $text = "done" Exit Func window1() WinActivate("WEBDATA - Microsoft Internet Explorer") EndFunc Func window2() WinActivate("Microsoft Excel - WEBDATA.xls") EndFunc Merely copies data from an excel sheet and pastes it into a broswer. I CANNOT FOR THE LIFE OF ME get AutoIT to stop after the cell becomes empty, or even has some type data other than numerical, like "done". Any help would be MUCH appreciated, and I realize I probably should have posted earlier, instead of getting so upset... Link to comment Share on other sites More sharing options...
Matt @ MPCS Posted October 29, 2004 Share Posted October 29, 2004 (edited) You think that code runs? You are missing a while statement to match the do statement... I don't know how to trap excel data, but you could search the forum I believe I have seen something that traps data from excel. *** Matt @ MPCS Edited October 29, 2004 by Matt @ MPCS Link to comment Share on other sites More sharing options...
normeus Posted October 29, 2004 Share Posted October 29, 2004 OK SO MAKE SURE "WEBDATA - Microsoft Internet Explorer" is open and also "Microsoft Excel - WEBDATA.xls" I dont have excel in this computer but this should work. There are easier ways to do this and also you should do error checking!! the first line checks the clipboard so if you have copied the word --- done --- on the clipboard it will stop before it runs but I figured there was a reason why you where checking the clipbard before the script copied something to it. getout(ClipGet()) ;get from the clipboard (your last COPY ? ) window1() ; go to explorer send("^v{TAB 6}") ;paste window2() ; go to excel Send("{RIGHT}^c") ;copy to clipboard getout(ClipGet()) ;test to see if it is done window1() ;go to explorer ...... repeat send("^v{TAB 2}") Call("window2") Send("{RIGHT}^c") window1() send("^v{TAB}") Call("window2") Send("{RIGHT}^c") window1() send("^v{TAB 4}") Call("window2") Send("{RIGHT}^c") window1() send("^v{TAB 2}") Call("window2") Send("{RIGHT}^c") window1() send("^v{TAB}") Call("window2") Send("{RIGHT}^c") window1() send("^v{ENTER}") sleep(2000) send("{ENTER}") sleep(2000) window1() send("{DOWN}{LEFT 6}^ ") Func window1() sleep(100) WinActivate("WEBDATA - Microsoft Internet Explorer") sleep(100) WinWaitActive("WEBDATA - Microsoft Internet Explorer") sleep(100) EndFunc Func window2() sleep(100) WinActivate("Microsoft Excel - WEBDATA.xls") sleep(100) WinWaitActive("Microsoft Excel - WEBDATA.xls") sleep(100) EndFunc Func getout($text) if $text = "done" Then Exit EndIf EndFunc ; just copied your script and fixed the sintax http://www.autoitscript.com/autoit3/scite/...iTe4AutoIt3.exe Link to comment Share on other sites More sharing options...
tekhed Posted October 29, 2004 Author Share Posted October 29, 2004 Doesn't work. I can't even get ClipGet() to play nice with Excel at all, with more simple requests. Seems like Excel doesn't copy data to the clipboard in a way that lets AutoIT read it correctly(?) or something... BUT, it WILL work if I change it a bit and the getout() function reads: Func getout($text) if $text = 99999 Then Exit EndIf EndFunc Unfortunately, I really would like it to work using a single word, such as "done". Some of the other data being copied are #'s themselves, so it might look confusing, or end unexpectedly. Thanks for your help though! P.S. What is 'error checking'? I know it sounds like a naive question, but I'm unsure of the definition. Link to comment Share on other sites More sharing options...
tekhed Posted October 29, 2004 Author Share Posted October 29, 2004 Just found out copying a cell from Excel might be seen as a carriage return when pasted elsewhere, which is why I couldn't use the @error function when the script reached a blank cell either... 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