save a moveable label's position Thread last updated on 2006-06-28 08:06:15

Posted by member 212670 on 2006-04-20 22:52:31

It looks like the other examples are gone, so here's a simple way to save a label's position.

Modules used:

xLabel-3.5.7 (use newer as available)
xTextEdit-0.6

-Setup your label like usual, making sure you've set (LabelName)X and (LabelName)Y lines, example:
floaterX 50
floaterY 50

-Use the following on a single line, with (LabelName)OnMove (example using a label named "floater" - change all instances of "floater" to whatever your label is named):
floaterOnMove !ParseEvars !execute [!xTextSaveEvar @$ConfigDir$labels.rc@ @floaterX@ @%#floaterCurrentX%#@][!xTextSaveEvar @$ConfigDir$labels.rc@ @floaterY@ @%#floaterCurrentY%#@]

-This assumes your label settings are located at: \ThemeName\Config\labels.rc

-Helpful Hint: If you want to make several floater labels and have them all use the same bang, put the OnMove in a label group, and use %[labelname]% instead of floater throughout the !execute line. Then, simply add all your floater labels to the label group (see AddToGroup in the xlabel help file). The floater labels themselves don't need the OnMove, in that situation, since the group they belong to will handle it.

Posted by member 287251 on 2006-04-20 23:13:32 link

Useful

Posted by member 321598 on 2006-06-21 10:16:15 link

Question:
Hmmm, according to the doc, it says only [labelname] works with parseevars; are the % signs some sort of escape sequence for xTextedit (I don't see it in the documentation though). And it also says [] are special characters for xTextedit, how does this work? Does parseevars take precedence?

Posted by member 5575 on 2006-06-21 10:30:39 link

%# is the escape character for $ when using !parseEvars, the @'s are the escape for quotes for textedit. And while [labelname] may work only with !parseEvars, !parseEvars does not work only with [labelname] - it will expand all evars to their current values.

Posted by member 321598 on 2006-06-21 11:20:51 link

Hmmm, yea, I know about %#. I should have specified the line about %[labelname]%, I was wondering why it has the % signs instead of just being [labelname], (which seems like the way it should be according to docs).

Posted by member 212670 on 2006-06-21 13:17:10 link

!ParseEvars can expand xLabel text escape sequences, but it requires they be surrounded with "%". The %[...]% syntax belongs to xLabel.

For example:

!ParseEvars !alert %[time]%
or
!ParseEvars !alert "%[time('h:nn AM/PM - ddd, mmm d, yyyy')]%"
or
!ParseEvars !alert "%[swapAvailable]%"

etc etc

Posted by member 321598 on 2006-06-21 15:15:37 link

oh, I see, learn something new everyday.

Posted by member 325942 on 2006-06-28 08:06:15 link

holy wow nice
kinda weird, i was right this minute going to start a thread about this, and Whammy, there it is