tradertt 0 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}") Hide tradertt's signature Hide all signatures Free Flash Games Online | Car Modifications Articles | Free Arcade Games Online Share this post Link to post Share on other sites
zfisherdrums 5 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. Hide zfisherdrums's signature Hide all signatures Identify .NET controls by their design time namesLazyReader© could have read all this for you. Unit Testing for AutoItFolder WatcherWord Doc ComparisonThis here blog... Share this post Link to post Share on other sites
Paulie 26 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 Share this post Link to post Share on other sites
tradertt 0 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? Hide tradertt's signature Hide all signatures Free Flash Games Online | Car Modifications Articles | Free Arcade Games Online Share this post Link to post Share on other sites
tradertt 0 Posted August 4, 2006 Errr anyone? Hide tradertt's signature Hide all signatures Free Flash Games Online | Car Modifications Articles | Free Arcade Games Online Share this post Link to post Share on other sites
JSThePatriot 17 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 Hide JSThePatriot's signature Hide all signatures AutoIt LinksFile-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.ComputerGetInfo UDF's Updated! 11-23-2006External LinksVortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Share this post Link to post Share on other sites