Jeremy Vyska
Fresh Scripter
Registered: 2002-07-17
Posts: 9
Loc: Boston, MA
|
I've tried in under:
-Windows 2000, running 3.54 -Windows XP, running 4.02
Same trouble. Hence why I am puzzled
One code piece: (Split troubles)
code:
IF OPEN(1,$InputFile) = 2 CLS ? "File " + $InputFile + " does not exist that can be found." QUIT ENDIF OPEN(2,$OutputFile,5) WHILE @ERROR = 0 $Line = READLINE(1) IF SUBSTR($Line, 1, 3) = "SDQ" $Segment = Split($Line, "*") $Pos = 0 FOR EACH $Element in $Segment $Pos = $Pos + 1 SELECT CASE 3 OR 5 OR 7 OR 9 OR 11 OR 13 OR 15 OR 17 OR 19 OR 21 WRITELINE(2, $Element + CHR(13) + Chr(10)) ENDSELECT NEXT ENDIF LOOP
And I also had trouble with this little bugger before I replaced LEFT's and RIGHT's with SUBSTR:
code:
BREAK ON ; Draw the grid and box for the screen, plus the title CLS small Color b+/n BOX (0,0,24,79,GRID) Color b/n BOX (4,11,21,70,Å) Color g+/n BOX (3,10,20,69,FULL)
Color w+/n AT (5,13) "EDI Splitter 1.0 - By Jeremy Vyska" Color n/n AT (22, 13) " * Where path is current path, file names are sufficient "
; We allow the savvy to enter command line parameters if they want, ; otherwise, we ask
IF ($InputFile + ".") = "." AT (18,15) "Please enter your source filename and path:" AT (19,15) "> " GETS $InputFile ENDIF
; Add the set input file to the option list
Color n/n BOX (18,15,19,68," ") AT (7,15) "Input:" AT (7,28) $InputFile
; Now let's do the same thing for the output file...
Color w+/n IF ($OutputFile + ".") = "." AT (18,15) "What name for the resulting file?" AT (19,15) "> " GETS $OutputFile ENDIF
Color n/n BOX (18,15,19,68," ") AT (8,15) "Output:" AT (8,28) $OutputFile AT (23,1) " "
; Now, how do they want the file?
Color w+/n IF ($Format + ".") = "." AT (18,15) "What format for the resulting file? (E)DI/(C)SV/(O)ne Line Only" AT (19,15) "> " GET $Format $Format = UCASE($Format) ENDIF
Color n/n BOX (18,15,19,68," ") AT (9,15) "Format:" AT (9,28) $Format AT (23,1) " "
Color w+/n IF ($SegTerm + ".") = "." AT (18,15) "What is the Segment Terminator?" AT (19,15) "> " GETS $SegTerm ENDIF
Color n/n BOX (18,15,19,68," ") AT (10,15) "SegTerm:" AT (10,28) $SegTerm AT (23,1) " "
Color w+/n IF ($ElTerm + ".") = "." AT (18,15) "What is the Element Terminator?" AT (19,15) "> " GETS $ElTerm ENDIF
Color n/n BOX (18,15,19,68," ") AT (11,15) "El. Term:" AT (11,28) $ElTerm AT (23,1) " "
; Open files
AT (22,13) "Processing..."
AT (22,27) "Opening Files" IF OPEN(1,$InputFile) = 2 CLS ? "File " + $InputFile + " does not exist that can be found." QUIT ENDIF OPEN(2,$OutputFile,5)
; Process files
$TempLine = "Temp"
IF ($Format = "E") OR ($Format = "O") WHILE (@ERROR = 0) OR (LEN($TempLine > 2)) $TempLine = READLINE(1) $NextLine = 1 WHILE $NextLine > 0 $X = INSTR($TempLine,$SegTerm) IF $X > 0 $Garbage = WRITELINE(2, SUBSTR($TempLine, 1, $X)) IF $Format = "E" $Garbage = WRITELINE(2, Chr(13) + Chr(10)) ENDIF $TempLine = SUBSTR($TempLine, $X + 1, LEN($TempLine) - $X) ENDIF IF $X = 0 $Garbage = WRITELINE(2, $TempLine) $NextLine = 0 ENDIF LOOP LOOP ENDIF
IF $Format = "C"
ENDIF
CLOSE(1) CLOSE(2)
Color g+/n BOX (3,10,20,69,FULL)
Color w+/n AT (5,13) "Navision Modifier 1.0 - By Jeremy Vyska" Color n/n AT (22, 13) " * Where path is current path, file names are sufficient "
Color w+/n AT (7, 15) "Process Complete" Color g+/n
AT (23,1) " "
|