Alupis Posted March 24, 2011 Share Posted March 24, 2011 Hello, i'm fairly new to autoit scripting so please bare with me... I have a .txt file that is comma separated (was a CSV but changed to txt). The text file contains many lines in it, and basically i need to have the script read the line, look to a certain field, determine what number is in that field for that line, save that number, and then compare every line after that to the saved number. when it reaches a line that has a different number than the saved one, it will need to start a new function. so far i have this: expandcollapse popupDim $onum $NewOrderFile = FileOpen("NEW_ORDERS.TXT", 0) Func setmemory() $line = FileReadLine($NewOrderFile) If @error = -1 Then Exit $clean = StringStripWS($line,"") $array = StringSplit($clean, ",") ;WinActivate("Session A - [24 x 80]", "") WinActivate("Untitled - Notepad") $onum = $array[2] Send($onum) EndFunc Func checkmemory() $line = FileReadLine($NewOrderFile) If @error = -1 Then Exit $clean = StringStripWS($line,"") $array = StringSplit($clean, ",") ;WinActivate("Session A - [24 x 80]", "") WinActivate("Untitled - Notepad") If Not $onum == $array[2] Then setmemory() neworder() Send("1") Else oentry() Send("2") EndIf EndFunc Func neworder() Send("3") EndFunc Func oentry() Send("4") EndFunc setmemory() While 1 checkmemory() WEnd bascially my thoughts were to have the setmemory function run, to set the memory (save the number from the line it read, should be the first line the first run through), then have the checkmemory function run in a loop to constantly read the number in that field each time the script advances to the next line. THen if it finds it does not match, it will launch another function that will eventually return us to the begining of the script. an alternative i thought of while writing this (and it might be simpler???) is to add a few lines of code into every other function to have it check against the saved number, that way i can ensure that each function will use the same "data set" until they have finished (after detecting a different number) and returning us to the begining. here are a few lines from a sample text file i'm working with A,71842,Jason,Sipula,TEST,1234 Test Dr.,,Test,95842,CA,10.22,UPS - Ground,,,A0724,Plastic Tray Liner 3x6 White,3,1.02,0.14,0 A,71842,Jason,Sipula,TEST,1234 Test Dr.,,Test,95842,CA,10.22,UPS - Ground,,,A0740,Gem Jar Insert (24) Cups Black,1,4.64,0.49,0 A,71842,Jason,Sipula,TEST,1234 Test Dr.,,Test,95842,CA,10.22,UPS - Ground,,,A0356,Velveteen Drawstring Pouch Navy (Each),30,0.14,0.01,0 A,71842,Jason,Sipula,TEST,1234 Test Dr.,,Test,95842,CA,10.22,UPS - Ground,,,A0909,Carrying Case (18 Trays) Grey,5,14,1.69,0 A,71859,testname,testname,,3 testname drive,,east testname,2537,MA,13,Ground,,Google Checkout,A0855,Display Assortmet/Neck Busts Black,1,45.95,5,0 A,71859,testname,testname,,3 testname drive,,east testname,2537,MA,13,Ground,,Google Checkout,A0914,Ring Finger Rubber Black,2,0.79,0,0 A,71859,testname,testname,,3 testname drive,,east testname,2537,MA,13,Ground,,Google Checkout,A0161,Med. Half-Moon Bracelet Black,1,3.54,0.26,0 A,71859,testname,testname,,3 testname drive,,east testname,2537,MA,13,Ground,,Google Checkout,A0141,Pillow 3 Black,2,0.88,0.11,0 A,71859,testname,testname,,3 testname drive,,east testname,2537,MA,13,Ground,,Google Checkout,A0115,Small T Bar Black Velvet,1,4.69,0.62,0 A,71859,testname,testname,,3 testname drive,,east testname,2537,MA,13,Ground,,Google Checkout,A0188,Earring T Bar 6.75H Black (Each),2,1.93,0.15,0 A,71859,testname,testname,,3 testname drive,,east testname,2537,MA,13,Ground,,Google Checkout,A0186,Earring T Bar 5.75H Black (Each),2,1.93,0.15,0 the field we are talking about is the second one (or array[2] after the array is built), so for the first customer, setmemory() would then save 71842 to the $onum variable... and then checkmemory() would compare each line's array[2] until it finds one that is not the same (such as the next customer, which would be 71859). the last option i can think of, but can't write it out... lol, would be to have a function read the first line, save the number, count how many times that number shows up in the text file (basically count how many lines total have that number in array[2] including the first counted one) and then somehow tell my script to only do that many lines then return to the begining, having it re-read the file, find the line the next number is on (because it saved the first lines number it would be able to compare the lines and find the next number), then basically repeat the process having it count how many lines to run for before returning to count again. so for example with the text above, it would read the file, save 71842 to "memory" (variable), count how many lines have that number in it (4 lines in this case), run the rest of my script only on those 4 lines, when its finished, return to read file starting at the next line (so line 5), read line 5's array[2], save that number to "memory" (now 71859), count how many lines have that in array[2] (so 7 lines in the example), run the rest of my script on those 7 lines, when its finished, return to read the file starting at the next line (so line 13 now), etc... i hope i'm being clear and not just rambling! lol.... thank you for your help in advance! i have about 400 lines of code and this is all thats hanging me up! Link to comment Share on other sites More sharing options...
bwochinski Posted March 25, 2011 Share Posted March 25, 2011 (edited) I couldn't really figure a clean way to work with the functions you had, but assuming I understood what you wanted, this is what I came up with... It sends an array of the lines for each order number on to the processOrders() function. If this doesn't work for what you need, maybe it'll help you come up with something else. expandcollapse popup#Include <File.au3> #Include <Array.au3> Global $NewOrderFile, $onum = "", $line = "", $arrTemp = 0 ;Read in the entire file to an array If _FileReadToArray("NEW_ORDERS.TXT", $NewOrderFile) == 0 Then MsgBox(0,"error", "Error reading in file.") Exit EndIf For $curLine = 1 To $NewOrderfile[0] ;clean and split the current line $line = StringSplit(StringStripWS($NewOrderFile[$curLine],7), ",") If $onum <> $line[2] Then ;the order number is different $onum = $line[2] ;send the array for the last order number on for processing ;added isArray check to prevent sending on the first loop If IsArray($arrTemp) Then processOrders($arrTemp) EndIf ;start a new temp array for the new order number Dim $arrTemp[1] = [$NewOrderFile[$curLine]] Else ;the order number is the same, add the line to the temp array for the current order number _ArrayAdd($arrTemp,$NewOrderFile[$curLine]) EndIf Next ;send along the last order number after the FOR loop hits the last line in the file If UBound($arrTemp) Then processOrders($arrTemp) EndIf Func processOrders($arrOrders) ;work with array $arrOrders here, all elements will be lines with the same order number ; (raw from file version of the line, not cleaned or split) _ArrayDisplay($arrOrders) EndFunc Edited March 25, 2011 by bwochinski Link to comment Share on other sites More sharing options...
Alupis Posted March 25, 2011 Author Share Posted March 25, 2011 hmm.. this looks like it may be in the right direction. i can't do a straight copy/paste so i will work this code into my script and see how it reacts... question though, in the line :$line = StringSplit(StringStripWS($NewOrderFile[$curLine],7), ",") would i be able to remove the StringStripWS function? i included it in my script for legacy reasons... and i was unsure how it would effect my script to remove it... so i basically have it set as $clean = StringStripWS($line,"") so that is doesn't strip any of the WS. i have this since i found that if i didn't the program would enter addresses and names with no spaces... lol. Link to comment Share on other sites More sharing options...
Alupis Posted March 28, 2011 Author Share Posted March 28, 2011 (edited) Ok so this is what i have so far... expandcollapse popup#Include <File.au3> #Include <Array.au3> Global $NewOrderFile, $onum = "", $line = "", $arrTemp = 0 ;Read in the entire file to an array If _FileReadToArray("NEW_ORDERS.TXT", $NewOrderFile) == 0 Then MsgBox(0,"error", "Error reading in file.") Exit EndIf For $curLine = 1 To $NewOrderfile[0] ;clean and split the current line $line = StringSplit(StringStripWS($NewOrderFile[$curLine],7), ",") If $onum <> $line[2] Then ;the order number is different $onum = $line[2] ;send the array for the last order number on for processing ;added isArray check to prevent sending on the first loop If IsArray($arrTemp) Then processOrders($arrTemp) EndIf ;start a new temp array for the new order number Dim $arrTemp[1] = [$NewOrderFile[$curLine]] Else ;the order number is the same, add the line to the temp array for the current order number _ArrayAdd($arrTemp,$NewOrderFile[$curLine]) EndIf Next ;send along the last order number after the FOR loop hits the last line in the file If UBound($arrTemp) Then processOrders($arrTemp) EndIf Func processOrders($arrOrders) ;work with array $arrOrders here, all elements will be lines with the same order number ; (raw from file version of the line, not cleaned or split) _ArrayDisplay($arrOrders) While 1 ;$clean = StringStripWS($arrOrders,"") ;$array = StringSplit($clean, ",") ;WinActivate("Session A - [24 x 80]", "") WinActivate("Untitled - Notepad") Send($arrOrders[16]) ; item number Send("{NUMPADADD}") Send($arrOrders[18]) ; item qty Send("{NUMPADADD}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send($arrOrders[19]) ; per item price Send("{NUMPADADD}") Send("{ENTER}") ;_debugout("Order#:"&$array[1]&""&$array[2]&" Item#:"&$array[16]&" Qty:"&$array[18]&" Per Item Price:"&$array[19]&"") WEnd EndFunc when i run this it goes through, pops up the ArrayDisplay window and shows exactly what i'm trying to get... each "array" has only that customers lines in it... the problem is i'm unsure of how to only work with that temporary Array... I added the bottom section from some of my other code and i might just be having a "wrong variable" problem. I tried using the $arrOders and $arrTemp : Send($arrOrders[16]) and Send($arrTemp[16]) but neither one seems to work... i'm uploading a sample file in the RAW formatting so that u can test with it and see what i'm seeing... new_orders.txt the goal would be to have the script run, and basically write Item Numbers, Item Qty's, and Item Prices for that customers entire order (tempArray?) to a blank notepad file just for testing, then when its finished writing that data to the notepad for that customer, it would then move on to the next customer and so on... Edited March 28, 2011 by Alupis Link to comment Share on other sites More sharing options...
Alupis Posted March 29, 2011 Author Share Posted March 29, 2011 bump! i'm really having a hard time working with the array the script bwochinski wrote... can someone provide some guidance or possibly an alternative? I'm trying to pull data from the array the script is supposed to create ( such as Send($arrOrders[2]) ect... but i guess i'm not understanding how this array is setup... because whenever i run that command it gives me "==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:" error. am i doing something wrong? i've tried calling the other $arrXXX variables that were created but they have the same effect... i do like how bwochinski has the script setup to have a popup window showing the current active array, and would like to keep that (i can use WinClose command to signify to the rest of my script that the lines are done or something, or at the very least have a visual on what data is being worked with currently). Link to comment Share on other sites More sharing options...
bwochinski Posted March 29, 2011 Share Posted March 29, 2011 Hey Alupis, Glad you messaged me for help, I haven't been checking the forums over the days I've been off work. The only problem I think is that you were looking for an array that had the name / address / etc already separated, but the array I pass to the "processOrders()" function is just an array with each element being a plain text line from the original file. It would be nice to pass it in already split and cleaned up, but AutoIt makes handling multidimensional arrays more of a hassle than I like, so it's easier just to rerun the split. Here's code for the function that should do what you're looking for: Func processOrders($arrOrders) ;work with array $arrOrders here, all elements will be lines with the same order number ; ( $arrOrders is array of plain text lines, each element is an entire line from the file ) _ArrayDisplay($arrOrders) For $order In $arrOrders $order = StringSplit(StringStripWS($order,7), ",") ;WinActivate("Session A - [24 x 80]", "") WinActivate("Untitled - Notepad") Send($order[16]) ; item number Send("{NUMPADADD}") Send($order[18]) ; item qty Send("{NUMPADADD}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send($order[19]) ; per item price Send("{NUMPADADD}") Send("{ENTER}") Next I like to use a FOR loop to iterate through an array when possible, keeps things really easy. The line For $order In $arrOrderswill store an element from $arrOrders in $order each time it iterates through the loop, so within the loop, you only have to deal with $order, which represents a single line from the original text file. From there I run the cleanup functions again $order = StringSplit(StringStripWS($order,7), ",")splitting the line on commas, and using the StringStripWS() to clear out all duplicate spaces. Using the 7 flag on the StringStripWS() function makes it strip all leading and trailing spaces, plus any multiple spaces in the middle, but a single space will be left between words. From that point onward everything else should work just as you expect. Link to comment Share on other sites More sharing options...
Alupis Posted March 29, 2011 Author Share Posted March 29, 2011 Thanks for the help Bwochinski, your the best! After reviewing your code it looks like i can incorporate that nicely... I'll post back if i run into issues! Link to comment Share on other sites More sharing options...
Alupis Posted March 29, 2011 Author Share Posted March 29, 2011 (edited) Ok i got everything working Perfectly!!!!!!! Could not of done it without you Bwochinski!!!!! thanks a million!!! here's what i came up with (i know its messy, but it works! ;-P ) : expandcollapse popup#Include <File.au3> #Include <Array.au3> #include <Debug.au3> _debugSetup ( "Debug!") Global $NewOrderFile, $onum = "", $line = "", $arrTemp = 0 $oshipmethod = 0 $NewOrders = FileOpen("NEW_ORDERS.TXT", 0) $cctype = 0 $visaNum = "4111111111111111" $amexNum = "378282246310005" $discNum = "6011111111111117" $masterNum = "5555555555554444" Func setupasw() WinActivate("Session A - [24 x 80]", "") Send("go asw") Send("{ENTER}") Send("go sales1") Send("{ENTER}") Send("1") Send("{ENTER}") Send("JDB") Send("{TAB}") Send("{TAB}") Send("JDB") Send("{TAB}") Send("{TAB}") Send("JB") Send("{ENTER}") ; End ASW Setup Section EndFunc Func splitnow() If _FileReadToArray("NEW_ORDERS.TXT", $NewOrderFile) == 0 Then MsgBox(0,"error", "Error reading in file.") Exit EndIf For $curLine = 1 To $NewOrderfile[0] ;clean and split the current line $line = StringSplit(StringStripWS($NewOrderFile[$curLine],7), ",") If $onum <> $line[2] Then ;the order number is different $onum = $line[2] ;send the array for the last order number on for processing ;added isArray check to prevent sending on the first loop If IsArray($arrTemp) Then processOrders($arrTemp) EndIf ;start a new temp array for the new order number Dim $arrTemp[1] = [$NewOrderFile[$curLine]] Else ;the order number is the same, add the line to the temp array for the current order number _ArrayAdd($arrTemp,$NewOrderFile[$curLine]) EndIf Next ;send along the last order number after the FOR loop hits the last line in the file If UBound($arrTemp) Then processOrders($arrTemp) EndIf EndFunc Func processOrders($arrOrders) ;work with array $arrOrders here, all elements will be lines with the same order number ; ( $arrOrders is array of plain text lines, each element is an entire line from the file ) _ArrayDisplay($arrOrders) For $order In $arrOrders $order = StringSplit(StringStripWS($order,7), ",") WinActivate("Session A - [24 x 80]", "") ;WinActivate("Untitled - Notepad") Send($order[16]) ; item number Send("{NUMPADADD}") Send($order[18]) ; item qty Send("{NUMPADADD}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send($order[19]) ; per item price Send("{NUMPADADD}") Send("{ENTER}") Next ;WinWait("Array: ListView Display") dship($order) EndFunc Func dship(ByRef $order) ; $line = FileReadLine($NewOrders) ; If @error = -1 Then Exit ; $clean = StringStripWS($line,"") ; $array = StringSplit($clean, ",") ;UPS Variables If StringInStr($order[12], "UPS - Ground") Then ; array[12] is for shipping method type $oshipmethod = 300 EndIf If StringInStr($order[12], "Ground") Then $oshipmethod = 300 EndIf If StringInStr($order[12], "UPS - 2nd Day Air") Then $oshipmethod = 210 EndIf If StringInStr($order[12], "UPS - 3 Day Select®") Then $oshipmethod = 220 EndIf ;USPS Variables If StringInStr($order[12], "USPS - Priority Mail") Then $oshipmethod = 910 EndIf If StringInStr($order[12], "Priority Mail") Then $oshipmethod = 910 EndIf f9($order) EndFunc Func f9(ByRef $order) ; $line = FileReadLine($NewOrders) ; If @error = -1 Then Exit ; $clean = StringStripWS($line,"") ; $array = StringSplit($clean, ",") WinActivate("Session A - [24 x 80]", "") Send("{F9}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send($order[1]) ; Invoice-Prefix Send($order[2]) ; Invoice Num Send("{NUMPADADD}") Send("{ENTER}") If $oshipmethod=300 Then Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send($order[11]) ; shipping cost Send("{NUMPADADD}") Send("{ENTER}") Send("{ENTER}") Else Send("{TAB}") Send("{TAB}") Send($oshipmethod) Send("{ENTER}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send($order[11]) ; shipping cost Send("{NUMPADADD}") Send("{ENTER}") Send("{ENTER}") EndIf f8($order) EndFunc Func f8(ByRef $order) ; $line = FileReadLine($NewOrders) ; If @error = -1 Then Exit ; $clean = StringStripWS($line,"") ; $array = StringSplit($clean, ",") WinActivate("Session A - [24 x 80]", "") ;WinActivate("Untitled - Notepad") Send("{F8}") Send("{TAB}") Send("1") Send("{ENTER}") Send("{TAB}") Send("999") Send("{NUMPADADD}") Send($order[3]) ; first name Send("{SPACE}") Send($order[4]) ; last name Send("{NUMPADADD}") Send($order[6]) ; shipping address Line 1 Send("{NUMPADADD}") Send($order[7]) ; shipping address Line 2 Send("{NUMPADADD}") Send($order[5]) ; Company name Send("{NUMPADADD}") Send($order[8]) ; City Send("{NUMPADADD}") Send($order[10]) ; State Send("{NUMPADADD}") Send($order[9]) ; Zip Send("{NUMPADADD}") Send("{ENTER}") WinWait("Session A - [24 x 80]", "") Send("{ENTER}") WinWait("Session A - [24 x 80]", "") Send("{F6}") Send("{ENTER}") WinWait("Session A - [24 x 80]", "") Send("{F12}") dpay($order) EndFunc Func dpay(ByRef $order) ; $line = FileReadLine($NewOrders) ; If @error = -1 Then Exit ; $clean = StringStripWS($line,"") ; $array = StringSplit($clean, ",") ;WinActivate("Session A - [24 x 80]", "") ;WinActivate("Untitled - Notepad") If StringInStr($order[14], "5") Then ; array[14] is paymethodtype gcheckout($order) EndIf If StringInStr($order[13], "Visa") and StringInStr($order[14], "2") Then ; array[13] is cardtype if present $cctype = $visaNum ccheckout($order) EndIf If StringInStr($order[13], "American Express") and StringInStr($order[14], "2") Then $cctype = $amexNum ccheckout($order) EndIf If StringInStr($order[13], "Discover") and StringInStr($order[14], "2") Then $cctype = $discNum ccheckout($order) EndIf If StringInStr($order[13], "Mastercard") and StringInStr($order[14], "2") Then $cctype = $masterNum ccheckout($order) EndIf If StringInStr($order[14], "4") Then ;and StringInStr($array[14], "") Then pcheckout($order) EndIf EndFunc Func cataxfix($order) ; $line = FileReadLine($NewOrders) ; If @error = -1 Then Exit ; $clean = StringStripWS($line,"") ; $array = StringSplit($clean, ",") ;WinActivate("Session A - [24 x 80]", "") ;WinActivate("Untitled - Notepad") If StringInStr($order[10], "CA") Then Do $continue = MsgBox(0, "CA TAX FIX", "CA Tax Detected, Verify Rounding and Click 'OK'.") Until $continue = 1 EndIf EndFunc Func gcheckout(ByRef $order) ; $line = FileReadLine($NewOrders) ; If @error = -1 Then Exit ; $clean = StringStripWS($line,"") ; $array = StringSplit($clean, ",") WinActivate("Session A - [24 x 80]", "") ;WinActivate("Untitled - Notepad") Send("{F7}") Send($order[15]) ; array[15] is order total $ amount Send("{NUMPADADD}") Send("{TAB}") Send("2") cataxfix($order) Send("{ENTER}") Send("{F12}") Send("+{TAB}") Send("+{TAB}") Send("22") Send("{ENTER}") Send(".") Send("{ENTER}") Send("Google Checkout") Send("{ENTER}") Send("{F12}") Send("{F12}") Send("{ENTER}") EndFunc Func ccheckout(ByRef $order) ; $line = FileReadLine($NewOrders) ; If @error = -1 Then Exit ; $clean = StringStripWS($line,"") ; $array = StringSplit($clean, ",") WinActivate("Session A - [24 x 80]", "") ;WinActivate("Untitled - Notepad") Send("{F7}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send($order[15]) ; array[15] is order total $ amount Send("{NUMPADADD}") Send($cctype) Send("{NUMPADADD}") Send("1213") Send("{NUMPADADD}") Send("{TAB}") Send("1") cataxfix($order) Send("{ENTER}") Send("{F12}") Send("{F12}") Send("{ENTER}") EndFunc Func pcheckout(ByRef $order) ; $line = FileReadLine($NewOrders) ; If @error = -1 Then Exit ; $clean = StringStripWS($line,"") ; $array = StringSplit($clean, ",") WinActivate("Session A - [24 x 80]", "") ;WinActivate("Untitled - Notepad") Send("{F7}") Send($order[15]) ; array[15] is order total $ amount Send("{NUMPADADD}") Send("{TAB}") Send("2") cataxfix($order) Send("{ENTER}") Send("{F12}") Send("+{TAB}") Send("+{TAB}") Send("22") Send("{ENTER}") Send(".") Send("{ENTER}") Send("PayPal") Send("{ENTER}") Send("{F12}") Send("{F12}") Send("{ENTER}") ;"Array: ListView Display" EndFunc setupasw() splitnow() I haven't figured out how to auto-close the Popup Array ListView Display window, (script seems to pause when i try to do a WinWait or anything similar to look for the popup... and i dont really want to get rid of it, i guess i'll just deal lol!), but everything else works perfectly! Edited March 29, 2011 by Alupis Link to comment Share on other sites More sharing options...
bwochinski Posted March 29, 2011 Share Posted March 29, 2011 (edited) Glad I was able to help!One bug that I may have spotted in the processOrders() function, is that I assume you would want the line:dship($order) to be before the "Next" a couple lines above it, otherwise not every order is going to get put through the rest of your functions.EDIT: unless something in the session is totalling up the orders and you only need to process the order number once, which I just realized is possible. In that case you're probably fine as is.And as far as the _arrayDisplay(), that's probably not the best for a production script, it was really more for debugging while writing the file parsing loop. And it does pause the script until the window is closed. You could output pretty much the same thing to a debug dialogOtherwise looks like a really long process that you've automated, so good job. Out of curiosity, am I seeing correctly that you're working with an IBM Personal Communications session for most of this? I doubt you want to rewrite all this now, but you might want to look into the documentation for the PCOMM object, which allows you to interface directly with the session, including easily reading text off of the screen. I just finished up an automation project at work using the PCOMM object. Once I got it all working, it's really solid and doesn't even require the session window to have focus. Edited March 29, 2011 by bwochinski Link to comment Share on other sites More sharing options...
Alupis Posted March 29, 2011 Author Share Posted March 29, 2011 (edited) hmm... i'll try moving the dship($order) line up and see how it works... i put 5 customers through the script already and it seemed to work very well as-is, but i'm no programming expert lol! to be before the "Next" a couple lines above it, otherwise not every order is going to get put through the rest of your functions. EDIT: unless something in the session is totalling up the orders and you only need to process the order number once, which I just realized is possible. In that case you're probably fine as is.EDIT: oh ok... it only needs to know the order number once (in the f9() function), otherwise it just needs to know which lines (or temporary array i guess) is the current data-set... otherwise it would send all the lines in the txt file into 1 order instead of splitting them up like it is now... I might do that and use a debug dialog instead of the _arrayDisplay() function... but for now it wont throw anything off will it? i like being able to see and double check the data before it runs it through so i can look for problems... lol! ya this has been a VERY tedious process for us... we have a site that we receive order from in a .CSV format very close to the sample file i uploaded... and i just simply change the name and extension to .txt. Before we had to go through it line-by-line and hand-key them all in... this obviously led to mis-keyed orders and loss of productivity. Its kind of an IBM system. its actually an AS/400 (sometimes called OS/400) system running ASW software setup by IBS (i guess they are a side company of IBM for inventory/product management and WH control). its a emulated console that we use to key in the orders and stuff (this isn't our main site, just a new startup... the main site is fully automated from the order through shipping process). If the PCOMM stuff ur talking about applies, i may have to look into that... i'm faily new to the whole AS/400 part but have been doing IT for about 7 years... Edited March 29, 2011 by Alupis Link to comment Share on other sites More sharing options...
bwochinski Posted March 29, 2011 Share Posted March 29, 2011 Ok yeah an AS/400 should work just as well, the "IBM Personal Communications" is actually the name of the console emulator software that would be running on the PC. I figured it must be what you're using due to the "Session A" name in the title bar.I don't know if you'd be able to automate it any further being able to look for strings on the console, but I'd certainly recommend a peek. PCOMM DOC LINK - The "autECLPS" class mainly, but the "autECLOIA" class has the handy "WaitForInputReady()" function that allows you to wait for the console to be ready before sending additional commands. I just got done dealing with it all so I can provide some help if you need.Until you're 100% confident there's certainly no harm in using the _arrayDisplay() function to double check the input. And it does pause the script so if there's a problem you could always end the script process rather than let the input get into the system. Link to comment Share on other sites More sharing options...
Alupis Posted March 30, 2011 Author Share Posted March 30, 2011 Hmm... that link has some pretty interesting info! I'll have to read it through when i have some time... WaitForInputReady() sounds useful... especially when u have a slow console connection lol! If I end up going that route in the future i'll let you know! Thanks again Bwochinski, couldn't of done it without you 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