jq46137 Posted December 16, 2008 Posted December 16, 2008 Hi,I am new to scripting and have been trying to automate a particular process. I get lost in how to control a loop. I would like to put a user interface just before the next so that the user has to click a button before the loop continues. I know that most user interfaces use a loop to wait for a choice from the user but I dont know how it works with the For To that I have. Any insight will be well appreciated.The reason I need it to pause is that the AU3INFO cant distinguish a window inside a java created database. (ie it has a form with a different gui window and not the active program)Thanks,Joaquin#include <xcelCOM_UDF.au3>$sExcelFile = "C:\Temp\TCAPS.xls"$oExcel = _ExcelBookOpen($sExcelFile)$vSheet = 'New_Forecasts'$array = _ExcelSheetUsedRangeGet($oExcel, $vSheet)For $i = 2 To $array[3] WinActivate("program")Send("!c")$sCellValue = _ExcelReadCell($oExcel, $i, 1)send($sCellValue)send("{tab}")$sCellValue = _ExcelReadCell($oExcel, $i, 2)send($sCellValue)send("{enter}")Next
November Posted December 16, 2008 Posted December 16, 2008 Hi, I am new to scripting and have been trying to automate a particular process. I get lost in how to control a loop. I would like to put a user interface just before the next so that the user has to click a button before the loop continues. I know that most user interfaces use a loop to wait for a choice from the user but I dont know how it works with the For To that I have. Any insight will be well appreciated. The reason I need it to pause is that the AU3INFO cant distinguish a window inside a java created database. (ie it has a form with a different gui window and not the active program) Thanks, Joaquin #include <xcelCOM_UDF.au3> $sExcelFile = "C:\Temp\TCAPS.xls" $oExcel = _ExcelBookOpen($sExcelFile) $vSheet = 'New_Forecasts' $array = _ExcelSheetUsedRangeGet($oExcel, $vSheet) For $i = 2 To $array[3] WinActivate("program") Send("!c") $sCellValue = _ExcelReadCell($oExcel, $i, 1) send($sCellValue) send("{tab}") $sCellValue = _ExcelReadCell($oExcel, $i, 2) send($sCellValue) send("{enter}") Next Hi there m8, And what about include before Next this: Sleep (5000); 5000 milisecs (can be chanhed for the time you like) Cheers Old Scriptology Visual Ping 1.8 - Mass Ping Program with export to txt delimited. Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code. Desktop 2 RGB - Pick a color in the desktop and get the RGB code. ShootIT 1.0 - Screen Capture full and partial screen [font="'Arial Black';"]Remember Remember The Fifth of November.[/font]
someone Posted December 16, 2008 Posted December 16, 2008 You have a couple options.... If you really just need a very simple pause/continue button, you can use a MsgBox which will hault the script until you press the button. If you want to go beyond that, don't use a For/Next loop and wrap the commands in a function. Pass $i to the function and each time you want it run increase the value of $i. Let us know how it works While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd
oMBRa Posted December 16, 2008 Posted December 16, 2008 (edited) U can do: Global $i = 2 Do $Answer = MsgBox(4, '', 'Do you want to countinue?') If $Anser = 6 Then WinActivate("program") Send("!c") $sCellValue = _ExcelReadCell($oExcel, $i, 1) Send($sCellValue) Send("{tab}") $sCellValue = _ExcelReadCell($oExcel, $i, 2) Send($sCellValue) Send("{enter}") $i = $i + 1 Else ExitLoop EndIf Until $i = Ubound($array[3]) Edited December 16, 2008 by oMBra
jq46137 Posted December 17, 2008 Author Posted December 17, 2008 Hi, Thanks for the help guys! I was able to get what I want from your help. What I finaly did was: #include <xcelCOM_UDF.au3> $sExcelFile = "C:\Temp\TCAPS.xls" $oExcel = _ExcelBookOpen($sExcelFile) $vSheet = 'New_Forecasts' $array = _ExcelSheetUsedRangeGet($oExcel, $vSheet) For $i = 2 To $array[3] $Answer = MsgBox(4, '', 'Do you want to countinue?') If $Answer = 6 Then WinActivate("Microsoft Excel - Book1") Send("!c") $sCellValue = _ExcelReadCell($oExcel, $i, 1) Send($sCellValue) Send("{tab}") $sCellValue = _ExcelReadCell($oExcel, $i, 2) Send($sCellValue) Send("{enter}") Else ExitLoop ENDIF Next
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