Retrieving the label's caption?

Discuss and share scripts and script files...
Post Reply
Filehero
Posts: 2644
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Retrieving the label's caption?

Post by Filehero »

Code: Select all

tagitems("label");
only returns the ID. Currently there's no way to retrieve a label's caption using SC, right?

Thanks,
FH

highend
Posts: 13327
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Retrieving the label's caption?

Post by highend »

Sure there is...

Code: Select all

    $labels = regexmatches(readfile("<xydata>\tag.dat", , 2000), "^((.+?)\|\|(.+?)){7,}$");
    $label  = gettoken(gettoken($labels, tagitems(), ";"), 1, "||");
If label definitions could have been edited, the tags must have been saved first,
otherwise the script could read old definitions
One of my scripts helped you out? Please donate via Paypal

Filehero
Posts: 2644
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Re: Retrieving the label's caption?

Post by Filehero »

highend wrote:

Code: Select all

    $labels = regexmatches(readfile("<xydata>\tag.dat", , 2000), "^((.+?)\|\|(.+?)){7,}$");
    $label  = gettoken(gettoken($labels, tagitems(), ";"), 1, "||");
I am t r u l y spoiled, darn. I wasn't even thinking of doing it myself after I didn't find any straight SC command. :moronicon:

Thanks a lot. :D

admin
Site Admin
Posts: 60588
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Retrieving the label's caption?

Post by admin »

Filehero wrote:

Code: Select all

tagitems("label");
only returns the ID. Currently there's no way to retrieve a label's caption using SC, right?

Thanks,
FH
Next version you can do this:

Code: Select all

echo tagitems("label", 3:=2);
echo tagitems(3:=2); //"label" is default anyway

Filehero
Posts: 2644
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Re: Retrieving the label's caption?

Post by Filehero »

admin wrote:Next version you can do this:

Code: Select all

echo tagitems("label", 3:=2);
echo tagitems(3:=2); //"label" is default anyway
:tup: :tup: :tup:

/e:
Thanks for implementation in v18.00.0021 - 2017-07-06 20:14
:D

Post Reply