tradertt Posted August 4, 2006 Share Posted August 4, 2006 Hi guys, I have a code that will copy from excel and open a webpage. However, I want it to loop though excel till it reaches a blank cell then it will end. How can I do that? expandcollapse popup#include <IE.au3> Opt("WinWaitDelay", 100) Opt("WinTitleMatchMode", 4) Opt("WinDetectHiddenText", 1) Opt("MouseCoordMode", 0) WinWait("Microsoft Excel", "") If Not WinActive("Microsoft Excel", "") Then _ WinActivate("Microsoft Excel", "") WinWaitActive("Microsoft Excel", "") Send("{CTRLDOWN}c{CTRLUP}") $sURL = ClipGet() $oIE = _IECreate($sURL, 0, 1, 0) $hwnd = _IEPropertyGet($oIE, "hwnd") WinSetState($hwnd, "", @SW_MAXIMIZE) WinActivate($hwnd, "") _IELoadWait($oIE) _IELinkClickByText($oIE, "Download") WinWaitActive("File Download") Sleep (1000) ControlClick ( "File Download", "&Save", "Button2") WinWait("Microsoft Excel", "") If Not WinActive("Microsoft Excel", "") Then _ WinActivate("Microsoft Excel", "") WinWaitActive("Microsoft Excel", "") Send("{RIGHT}{CTRLDOWN}c{CTRLUP}") WinActivate("Save As", "") WinWait("Save As", "") If Not WinActive("Save As", "") Then _ WinActivate("Save As", "") WinWaitActive("Save As", "") Sleep(1000) Send("{CTRLDOWN}v{CTRLUP}") ControlClick ( "Save As", "&Save", "Button2") Sleep(2000) WinClose ($hwnd, "" ) WinWait("Microsoft Excel","Worksheet Menu Bar") If Not WinActive("Microsoft Excel - test.xls","Worksheet Menu Bar") Then WinActivate("Microsoft Excel - test.xls","Worksheet Menu Bar") WinWaitActive("Microsoft Excel - test.xls","Worksheet Menu Bar") Send("{LEFT}{DOWN}") Free Flash Games Online | Car Modifications Articles | Free Arcade Games Online Link to comment Share on other sites More sharing options...
zfisherdrums Posted August 4, 2006 Share Posted August 4, 2006 Hey tradertt,My last post in the following thread contains a .zip file that gives an example of one way to do it.http://www.autoitscript.com/forum/index.php?showtopic=30130Let me know if this help you or not. Identify .NET controls by their design time namesLazyReader© could have read all this for you. Unit Testing for AutoItFolder WatcherWord Doc ComparisonThis here blog... Link to comment Share on other sites More sharing options...
Paulie Posted August 4, 2006 Share Posted August 4, 2006 Hey tradertt,My last post in the following thread contains a .zip file that gives an example of one way to do it.http://www.autoitscript.com/forum/index.php?showtopic=30130Let me know if this help you or not.Search for the_ExcelCom UDFsthere pretty nice and make doing what you're trying to do easy Link to comment Share on other sites More sharing options...
tradertt Posted August 4, 2006 Author Share Posted August 4, 2006 Thanks will search for those. For a simple loop, say I want the script to loop 5 times or a certain number of times which is defined, how can I do it? Free Flash Games Online | Car Modifications Articles | Free Arcade Games Online Link to comment Share on other sites More sharing options...
tradertt Posted August 4, 2006 Author Share Posted August 4, 2006 Errr anyone? Free Flash Games Online | Car Modifications Articles | Free Arcade Games Online Link to comment Share on other sites More sharing options...
JSThePatriot Posted August 4, 2006 Share Posted August 4, 2006 Errr anyone? This is how to loop 5 times... expandcollapse popupFor $i = 1 To 5 Step 1 ;Your code here... Delete below test MsgBox. MsgBox(0, "For Loop", "$i = " & $i) Next oÝ÷ Ù*.²)àÊ«r^Ü(ºWe¢,¢g)à)¶¬jëh×6 #include <IE.au3> Opt("WinWaitDelay", 100) Opt("WinTitleMatchMode", 4) Opt("WinDetectHiddenText", 1) Opt("MouseCoordMode", 0) For $i = 1 To 5 Step 1 WinWait("Microsoft Excel", "") If Not WinActive("Microsoft Excel", "") Then _ WinActivate("Microsoft Excel", "") WinWaitActive("Microsoft Excel", "") Send("{CTRLDOWN}c{CTRLUP}") $sURL = ClipGet() $oIE = _IECreate($sURL, 0, 1, 0) $hwnd = _IEPropertyGet($oIE, "hwnd") WinSetState($hwnd, "", @SW_MAXIMIZE) WinActivate($hwnd, "") _IELoadWait($oIE) _IELinkClickByText($oIE, "Download") WinWaitActive("File Download") Sleep (1000) ControlClick ( "File Download", "&Save", "Button2") WinWait("Microsoft Excel", "") If Not WinActive("Microsoft Excel", "") Then _ WinActivate("Microsoft Excel", "") WinWaitActive("Microsoft Excel", "") Send("{RIGHT}{CTRLDOWN}c{CTRLUP}") WinActivate("Save As", "") WinWait("Save As", "") If Not WinActive("Save As", "") Then _ WinActivate("Save As", "") WinWaitActive("Save As", "") Sleep(1000) Send("{CTRLDOWN}v{CTRLUP}") ControlClick ( "Save As", "&Save", "Button2") Sleep(2000) WinClose ($hwnd, "" ) WinWait("Microsoft Excel","Worksheet Menu Bar") If Not WinActive("Microsoft Excel - test.xls","Worksheet Menu Bar") Then WinActivate("Microsoft Excel - test.xls","Worksheet Menu Bar") WinWaitActive("Microsoft Excel - test.xls","Worksheet Menu Bar") Send("{LEFT}{DOWN}") Next I hope this helps further your understanding and use of AutoIt, JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) 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