|
Post by PS on Aug 13, 2014 3:59:31 GMT -5
Hi, it seems that using more then one primary-command does not work anymore... Sample: x 'EUR' all;find 'Art' nx all
only the first command will be executed and the cursor move to the first line after 'Top of Data' in column 47
Also, I occasionally get a loop error at reset, undo, etc. SPFLite has detected an internal loop
Last Interactions were: KB Primitive: ENTER Line Cmnd: Primary Cmnd: reset
Module Back Trace: 04 | RESETFUNC 03 | PCMDRESET 02 | CMDASSIGN 01 | POSTKEYBOARD 00 | MAINDKEYPROCESS
Best regards, Peter
|
|
|
Post by George on Aug 13, 2014 10:41:50 GMT -5
PS: Have you checked your command separator character in Options -> General ? Maybe it's somehow not a ; anymore? Multiple commands seem ok here in the latest 8.0.4216 version.
Re: the loops. If you select the OK button to allow it to continue, does everything complete? Or does it continue to loop? (i.e. the message re-appears)
Any other details would help - How big a file 20 lines, 2000, 200000 etc. What were being reset (X'd lines, pending commands, colors, etc.)
I need some help here, I can't just look at RESET code and expect the bug to jump out at me. It seems to be fine when I test it.
George
|
|
ps
New Member
Posts: 2
|
Post by ps on Aug 13, 2014 13:15:44 GMT -5
The command separator is ok. I rechecked the multiple commands: the second command work - but the message is not updated. In my sample the message stays at "excluded xxx lines" and not "chars xxx found xx times in x lines"...
The file has ca. 60000 lines (ca. 17MB) and i reset/undo excluded lines and my changes in the file (i'm testimg my macro to move/copy/overlay/insert and delete column(s) in a file.
Peter
|
|
|
Post by George on Aug 14, 2014 10:17:52 GMT -5
PS: Does the RESET/MACRO/whatever run to completion normally if you just click the OK button on the Loop Error box? The OK button simply allows execution to continue, and if still in a loop, the message will appear again. You can click OK over and over to allow things to just continue running, or you're sure it's a real loop. Loops on native SPF commands are rare, unless you're into extremely large files, or have a really old slow machine. 60000 lines is not really excessive at all, so I don't think the size is a problem.
If it's a macro, and it really is simply taking a long time, once you're confident you don't have a real loop problem, you can issue an SPF_Loop_Check(OFF) at the start of the macro so loop checking is suspended.
Robert's description of message handling is bang on.
George
|
|
ps
New Member
Posts: 2
|
Post by ps on Aug 14, 2014 13:22:46 GMT -5
Hi, the macro never ended in a loop - but the undo/reset. Four days ago i started creating my first macro. While testing (move,copy delete and insert columns) after every run i use undo or reset and then change/run the macro again. After ten or twelve runs i get this error. After using the OK Button undo/reset is ok.
You are right with the message - i checked with an older SPFLite-Version... But: in older Versions the cursor lays on the position of the first occurence of the search string. In this version the cursor remains at the position from the first command (in older versions i think the cursor remains on the command line if using the x-command) x 'EUR' all;find 'Art' nx all The cursor lays on the first excluded row on the position of the first occurence of EUR. So that's why i first thought the second command does not work...
Here ist the macro - not finished yet (and sorry for my bad englisch)
' VCOLS.MACRO ' ' 2014/08/11 by PS ' if Get_Arg$(0) = "" then ' No arguments - show help SPF_Loop_Check(0) ' no loop-check MSGBOX(0,"Parameters:"&$CRLF& ' show help im MSGBOX "------------"&$CRLF& " "&$CRLF& "Delete column(s):"&$CRLF& " vcols d 5 = delete column 5"&$CRLF& " vcols d 11 18 = delete columns 11 to 18"&$CRLF& " "&$CRLF& "Insert/Overlay/Clear column(s):"&$CRLF& " vcols i 5 'Test' = insert Test at column 5"&$CRLF& " vcols o 5 'Test' = overlay Test at columns 5ff"&$CRLF& " vcols o 5 ' ' = clear columns 5ff"&$CRLF& " "&$CRLF& "Copy/Move column(s):"&$CRLF& " vcols c 5 a 17 = copy column 5 after column 17"&$CRLF& " vcols c 5 o 17 = copy column 5 overlay column 17"&$CRLF& " vcols m 22 a 17 = move column 22 after column 17"&$CRLF& " vcols m 22 o 17 = move column 22 overlay column 17"&$CRLF& " "&$CRLF& " vcols c 5 12 a 17 = copy columns 5 to 12 after column 17"&$CRLF& " vcols c 5 12 o 17 = copy column 5 to 12 overlay columns 17ff"&$CRLF& " vcols m 22 35 a 0 = move column 22 to 35 before column 1"&$CRLF& " vcols m 22 35 o 17 = move column 22 to 35 overlay columns 17ff"&$CRLF& " "&$CRLF& "Info:"&$CRLF& " "&$CRLF& "...",%MB_OK,"VCOLS-Macro py PS") halt endif dim p01 as string dim p02 as integer dim p02c as string dim p03 as integer dim p03c as string dim p04 as string dim p05 as integer dim p05c as string dim p06 as string dim pdiff as integer dim zaehl as number dim lif as number dim lit as number dim vol as integer dim vor as integer dim cso as string dim csn as string dim csc as string dim i as number
p01 = LCASE$(Get_Arg$(1)) p02 = LCASE$(Get_Arg$(2)) p02c = LCASE$(Get_Arg$(2)) p03 = LCASE$(Get_Arg$(3)) p03c = LCASE$(Get_Arg$(3)) p04 = LCASE$(Get_Arg$(4)) p05 = LCASE$(Get_Arg$(5)) p05c = LCASE$(Get_Arg$(5)) p06 = LCASE$(Get_Arg$(6)) lif = Get_First_LPtr lit = Get_Last_LPtr vol = Get_LBound vor = Get_RBound
if p03 = "" then if p01 = "i" then p03 = p02 elseif p01 = "o" then p03 = p02 else p06 = p05c p05c = p04 p05 = p04 p04 = p03c p03c = p02c p03 = p02 endif endif
for i = lif to lit ' Loop through the line range if Is_Data(i) then if Get_XSTATUS$(i) = "X" then next if p06 = "x" then cso = Get_Line$(i) else cso = LSET$(Get_Line$(i),vor) endif csc = MID$(cso,p02,p03-p02+1) pdiff = p05 zaehl = zaehl + 1 if p01 = "m" then cso = MID$(cso,1,p02-1)&MID$(cso,p03+1,vor) if p05 < p02 then pdiff = p05 else pdiff = p05 - (p03-p02)-1 endif endif if p01 = "d" then csn = MID$(cso,1,p02-1)&MID$(cso,p03+1,vor) elseif p01 = "i" then csn = MID$(cso,1,p02-1)&MID$(p03c,2,len(p03c)-2)&MID$(cso,p02,vor) elseif p01 = "o" then csn = MID$(cso,1,p02-1)&MID$(p03c,2,len(p03c)-2)&MID$(cso,p02+len(p03c)-2,vor) endif if p04 = "o" then csn = MID$(cso,1,pdiff-1)&csc&MID$(cso,pdiff+(p03-p02)+1,vor) elseif p04 = "a" then csn = MID$(cso,1,pdiff)&csc&MID$(cso,pdiff+1,vor) endif Set_Line(i,csn) endif next Set_Msg("VCOLS: C/M="&p01," von="&p02," bis="&p03," O/A="&p04," Ziel="&p05," Sond="&p06," Anzahl: ",zaehl) halt
|
|
|
Post by George on Aug 15, 2014 10:19:36 GMT -5
ps: The cursor positioning thing is certainly not correct, I will have a look at what is messed up in there. V8 had some major internal restructuring over V7.
I see you didn't exactly start with a trivial macro, did you? It would have helped if the code had been put in using the Forum 'Code' tags so the indenting would show. Could you edit the post to correct this?
Is it UNDO or RESET (or both) experiencing the loop?
George
|
|