l3ill Posted March 20, 2010 Posted March 20, 2010 Hi Guys, Need a little help with this. I am trying to repeat this process until the last number in my excel sheet. Open PDFFill out the 4 forms on one pageprint itclose itThen do it all again until all numbers have been usedMost of it works except the repeat all part.See notes in code for more info...sanirecord.pdf if you need it...Thanksexpandcollapse popup;step 1 - open sanirecord.pdf $sanirecord = (@DesktopDir & "\SaniMotion\sanirecord.pdf") ShellExecute('AcroRd32.exe', $sanirecord) WinWaitActive("sanirecord.pdf") ;step 2 - fills out the 4 records on sanirecord.pdf $oExcel=_ExcelBookAttach("22022010001.xlsx", "FileName") Sleep(300) Send("+{TAB}") Sleep(300) For $iCount = 1 To 4 ;position counter Send($iCount) Sleep(300) Send("{TAB}") Sleep(300) $sCellValue = _ExcelReadCell($oExcel, $iCount, 1);reads from selected Excel file 1 pos @ a time If $sCellValue = "" Then ExitLoop Send ($sCellValue) Sleep(300) Send("{TAB}") Sleep(300) Send ("Oasis") Send("{TAB}") Sleep(300) $sCellValue2 = _ExcelReadCell($oExcel, $iCount, 2) Send ($sCellValue2) Sleep(300) Send("{TAB}") Sleep(300) Send ("Grunstadt") Sleep(300) Send("{TAB}") Sleep(300) Send(_NowDate()) Send("{TAB}") Next ;step 3 - prints and closes sanirecord.pdf WinActivate("sanirecord.pdf") Send("^p") Sleep(1000) Send("{ENTER}") Sleep(1000) Send("^q") ;should go back and do it all again until (($sCellValue = "")) - no more numbers in excel sheet ;then move to step 3 and print and quit regardless if all 4 records are complete or not My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example
somdcomputerguy Posted March 20, 2010 Posted March 20, 2010 do it all again until (($sCellValue = ""))You might've answered your own question..Do...Until - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
jchd Posted March 20, 2010 Posted March 20, 2010 I'm not sure I understand what you want exactly. I am trying to repeat this process until the last number in my excel sheet. Where do you get that "last number in my excel sheet"? And do you wan to perform steps 1..4 until your exit condition is met? This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
l3ill Posted March 20, 2010 Author Posted March 20, 2010 (edited) Thanks for your interest... @snowmaker the problem with Do Until is that it repeats 1-4 over and over again when I need it to continue with 5-8 and the 9-12 and so on. @jchd the excel sheet has, lets say, a list of 13 serial numbers each 10 integers long in a row. I need to send them one at a time to the pdf form, which holds 4 different serial numbers among other things and then needs to printed and closed and then on to the next 4 numbers from the excel sheet and so on. finally, in our instance the 13th number will be alone on the form that usually holds 4 but still should go then to the print and close step. hope this clears things up... Edited March 20, 2010 by billo My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example
somdcomputerguy Posted March 20, 2010 Posted March 20, 2010 Will it do what you need if you put the For..Next loop in a Do..Until? - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
jchd Posted March 21, 2010 Posted March 21, 2010 _Way_ clearer once explained as you did. Pseudocode: ;; 1) Read the Excel list and grab the whole list of serial numbers into an array and say you call it $SerNum. ;; 2) Say you have read in Local $nbSerNum = UBound($serNum) ;; You will have to fill in Mod($nbSerNum + 3, 4) PDF form holding up to 4 serial numbers. Local $j For $i = 0 To $nbSerNum - 1 ; this is a counter modulo 4 $j = Mod($i, 4) If $j = 0 Then ;; Setup a new empty PDF form Endif ;; fill in the $i-th serial number in the form ;; it will be in $j-th position in the form (0 to 3) or more simply in the next available position WriteSerNumToPDF($Sernum[$i], $j) ; we have to print if a form is full or if the last serial number has been processed If ($i > 0 And $j = 0) Or $i = $nbSerNum - 1 Then ;; print the PDF form If $i = $nbSerNum - 1 Then ExitLoop ; you're done Endif Next This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
l3ill Posted March 21, 2010 Author Posted March 21, 2010 It is kind of difficult to explain. I have been working with these dealies for weeks now so I probably assumed some stuff and left some stuff out. At any rate thanks so much for your help, There is some new ground here for me so I will be playing around with this and get back with any progress and further questions. Once again, thanks for your time JC! My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example
l3ill Posted March 21, 2010 Author Posted March 21, 2010 Arrays are new ground for me and I'm stuck on this one problem: How to declare/call the variable that actually gives me the serial number ('s) I've got the array working and I can see (consolewrite) that the counters and ubound are doing their job. But I cant see a serial number... I've been playing with _FileWriteFromArray($nbSerNum, $serNum, 3) (and other variations of same) but have the feeling I'm on the wrong trolley. any hints? My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example
jchd Posted March 21, 2010 Posted March 21, 2010 Use _ArrayDisplay($array) to ... display the content of an array. Mostly useful for debugging. You declare arrays this way: Local $myArray[50] and $myArray can hold 50 variants (values of any type), which you access with $myArray[0] (first one has index 0), $myArray[1] (second one) up to $myArray[49] (last one in his example). Often, the array will be create by a function like _FileReadFromArray(), _StringSplit(), ... In this case, you only have to declare the variable (Local or Global $myVar) and pass it to the function. It will make it an array of the required dimension (size) to hold the results. Read the Array topic in the help file: Language Reference - Variables This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
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