Automatic retrieval of tags from the filename
Re: Automatic retrieval of tags from the filename
this
- Attachments
-
- Captură de ecran 2025-01-30 212355.png (7.62 KiB) Viewed 4108 times
Re: Automatic retrieval of tags from the filename
Then remove this stuff before you further process it?
replace() / regexreplace()...One of my scripts helped you out? Please donate via Paypal
Re: Automatic retrieval of tags from the filename
Code: Select all
$allScripts = report("{basename} - ({comment})|",$allScripts);
$allScripts = replace($allScripts," - ()");
thank you for your suggestion
Re: Automatic retrieval of tags from the filename
a script loader launcher (scan all scripts from XYscripts folder, preselect first script)
in my opinion is usefull and quick
I recommend adding a description of the script in the Comments column.
Add a User Button from Customize toolbar - Edit... - On left click action
ar add code to XYplorer.ini
in my opinion is usefull and quick
I recommend adding a description of the script in the Comments column.
Add a User Button from Customize toolbar - Edit... - On left click action
Code: Select all
$allScripts = listfolder(<xyscripts>, "*.xys");
$count_xys = gettoken($allScripts, "count", ",");
if ($count_xys) {
$allScripts = report("{basename} - ({comment})|",$allScripts);
$allScripts = replace($allScripts," - ());
$selectedscript = inputselect("Select one script to execute",$allScripts,,32);
If ($selectedscript>"")
{
$selectedscript = regexreplace($selectedscript, "(.+) -.+", "$1");
load $selectedscript;
}
} else {
$mycom = "This is a autocreated script";
writefile("<xyscripts>\hello.xys", " msg ""Your scripts folder not contain any script (*.xys)!<br>Warning:$mycom!<br>Script location is <xyscripts>"",48,,""$mycom"";");
tag $mycom, "<xyscripts>\hello.xys", 2;
load "<xyscripts>\hello.xys" }
}
Code: Select all
[CustomButtons]
Version=1
Count=1
1=""script launcher|:ladybug|0|0" $allScripts = listfolder(<xyscripts>, "*.xys"); ¶ $count_xys = gettoken($allScripts, "count", ",");¶ ¶ if ($count_xys) {¶ $allScripts = replace(report("{basename} - ({comment})|",$allScripts)," - ()");¶ $selectedscript = inputselect("Select one script to execute",$allScripts,,32);¶ If ($selectedscript>"") ¶ {¶ $selectedscript = regexreplace($selectedscript, "(.+) -.+", "$1");¶ load $selectedscript; ¶ }¶ } else {¶ $mycom = "This is a autocreated script";¶ writefile("<xyscripts>\hello.xys", " msg ""Your scripts folder not contain any script (*.xys)!<br>Warning:$mycom!<br>Script location is <xyscripts>"",48,,""$mycom"";");¶ tag $mycom, "<xyscripts>\hello.xys", 2;¶ load "<xyscripts>\hello.xys" }¶ } "
Re: Automatic retrieval of tags from the filename
$count_xys = gettoken($allScripts, "count", ",");?listfolder() returns (by default) "|"-separated items so that count will always be one as long as at least one script existsSo:
Code: Select all
if ($allScripts) {
...
$allScripts = replace($allScripts," - ());A mathematical comparison for a string? oO
If ($selectedscript>"")One of my scripts helped you out? Please donate via Paypal
Re: Automatic retrieval of tags from the filename
I corrected the errors after posting.
mistakes happen...
mistakes happen...
Code: Select all
$allScripts = listfolder(<xyscripts>, "*.xys");
end (!<get SelectedItemsPathNames>), "No item(s) selected, aborted!";
if ($allScripts) {
$allScripts = replace(report("{basename} - ({comment})|",$allScripts)," - ()");
$selectedscript = inputselect("Select one script to execute",$allScripts,,32);
If ($selectedscript) {
$selectedscript = regexreplace($selectedscript, "(.+) -.+", "$1");
load $selectedscript;
}
} else {
$mycom = "This is a autocreated script";
writefile("<xyscripts>\hello.xys", " msg ""Your scripts folder not contain any script (*.xys)!<br>Warning:$mycom!<br>Script location is <xyscripts>"",48,,""$mycom"";");
tag $mycom, "<xyscripts>\hello.xys", 2;
load "<xyscripts>\hello.xys" }
}
-
klownboy
- Posts: 4397
- Joined: 28 Feb 2012 19:27
- Location: Windows 11, 25H2 Build 26200.7171 at 100% 2560x1440
Re: Automatic retrieval of tags from the filename
I'd have fun with this script. I have 1066 scripts in my XYplorer script folder.
Maybe it's time to weed through it. 
XYplorer Beta Club