Re: [Clip] Problems with Labels...
- Steve: I won't comment on the accuracy of your clip logic or John's
suggested clip but in answer to your primary question:
>Instead, I get "SNN17°13'16"E" as if both labels have run.YES they are but the problem is you are thinking of a Label as being a
> Are labels run without being told to run?
sub-routine or function.
ie. your suggested clip contains these lines:
> ^!IfSame "N" "^%S1%" ^!Goto IFNORTHRegardless of the contents of "^%S1%" execution is going to fall through
to execute the line after :IFNORTH either by being jumped to it or by
falling through to it.
This is*NOT* the best way to do it but hopefully following (clip not
tested) shows how GOTO's and IF statements are handled:
^!IfSame "N" "^%S1%" ^!Goto IFNORTH
^!IfSame "S" "^%S1%" ^!Goto IFSOUTH
Note - following is NOT recommended practice and is not documented (I
discovered it accidentally a while ago):
If you put a ":" in front of a target label, though not required it is
accepted by the clip parser. I just find it easier to spot the labels in
clip code when they have a colon in front of them. YMMV :-\
So instead of writing:
^!If Integer1 <>= Integer2 GoToLabelTrue ELSE GoToLabelFalse
you could instead write:
^!If Integer1 <>= Integer2 :GoToLabelTrue ELSE :GoToLabelFalse
; in this case any code before label can NEVER be executed
... do true stuff
... do false stuff
One other thing ... you've used the construction
^!IF expression ^!GOTO <space> IFNORTH
while this works I want to make sure you understand its exactly the same as:
^!IF expression IFNORTH
or the way I like to write it:
^!IF expression :IFNORTH
When I started learning clips following examples in CLIP HELP, I found
the use of labels like "GoToLabelTrue" confusing and wonder if that's
why you were using the unnecessary:
^!IF expr ^!GOTO somelabel
^!IF expr somelabel
One last thing ... at least while you are starting *DO* use ^!SETDEBUG
ON so you can step through your code. It won't show the labels
themselves but will show that you are getting to lines you didn't think
Hope some of this helps ... Alec
On 2010-05-11 01:10, John Shotsky wrote:
> This really depends on what your entire data strings look like. If you
> have lines like:
> With nothing else on the lines, it is a simple matter of writing a few
> replace statements.
> Something along the lines of this, for the above example:
> ^!Replace "^N(\d+°.+)E" >> "S$1W" ARSTW
> Will produce this:
> From: email@example.com <mailto:ntb-clips%40yahoogroups.com>
> <mailto:ntb-clips%40yahoogroups.com>] On Behalf Of Steve
> Sent: 10 May, 2010 09:30 PM
> To: firstname.lastname@example.org <mailto:ntb-clips%40yahoogroups.com>
> Subject: [Clip] Problems with Labels...
> Hi Everyone,
> I am trying to reverse (as in north to south, south to north)the
> direction of the first letter of a
> string, such as "N17°13'16"E" to make it "S17°13'16"E".
> I put the cursor at the beginning of the string in the editor and run
> my clip:
> H="Reverse Bearing"
> ^!Set %S1%=^$GetChar$
> ^!IfSame "N" "^%S1%" ^!Goto IFNORTH
> ^!IfSame "S" "^%S1%" ^!Goto IFSOUTH
> Instead, I get "SNN17°13'16"E" as if both labels have run. Are labels
> run without being told to run?
> Any suggestions will be appreciated, as I have more than 600 of these
> to change.
> PS: I also want to reverse the last letter, but figure once I learn
> how to reverse the first I will
> be able to do the second..)
> [Non-text portions of this message have been removed]
Regards ... Alec (buralex@gmail& WinLiveMess - alec.m.burgess@skype)
[Non-text portions of this message have been removed]