so
Code: Select all
if ($P_TagOptions == "D") {
regardless if the if clause was true or not. So check that $P_TagOptions
variable
The code I've posted works with that variable set to "D"...
Code: Select all
if ($P_TagOptions == "D") {
Code: Select all
"Apply tag"
$notes = ($P_TagOptions == "D") ? "Directories only": "Directories AND files";
if (!$tag) { status "No tag entered, aborted", , "alert"; end true; }
$selItems = get("SelectedItemsPathNames");
// Directories only
if ($P_TagOptions == "D") {
$selFolders = GetFoldersOnly($selItems, <crlf>, <crlf>);
// Selected folders
if ($selFolders) {
$items = formatlist(quicksearch("lbl:** /d", $selFolders), "sed", <crlf>);
// No selected folders, use folders in <curpath>
} else {
$items = formatlist(quicksearch("lbl:** /d", listfolder(<curpath>, , 2, <crlf>)), "sed", <crlf>);
}
}
if ($items) {
tagitems("label", "", $items);
status "All items tagged...", , "ready";
}
function GetFoldersOnly($items, $inSep="|", $outSep="|") {
$list = "";
foreach($item, $items, $inSep, "e") {
if (exists($item) == 2) { $list = $list . $item . $outSep; }
}
return formatlist($list, "sed", $outSep);
}
Where? Not in that script...I set Tagoptions to D too.
Code: Select all
if ($P_TagOptions == "D") {
That was the original setting"_Initialize"
perm $P_TagOptions;
if (!$P_TagOptions) { $P_TagOptions = "D"; }
is true by adding a new line after it withif ($P_TagOptions == "D") {
Code: Select all
echo "inside if clause";
Code: Select all
"_Initialize"
perm $P_TagOptions;
if (!$P_TagOptions) { $P_TagOptions = "D"; }
"Option: $P_TagOptions"
if ($P_TagOptions == "D") { $P_TagOptions = "D+F"; }
elseif ($P_TagOptions == "D+F") { $P_TagOptions = "D"; }
else { $P_TagOptions = "D"; }
load "*", "Apply tag", "s";
"Apply tag"
$notes = ($P_TagOptions == "D") ? "Directories only": "Directories AND files";
$selItems = get("SelectedItemsPathNames");
// Directories only
if ($P_TagOptions == "D") {
echo "inside if clause";
$selFolders = GetFoldersOnly($selItems, <crlf>, <crlf>);
// Selected folders
if ($selFolders) {
$items = formatlist(quicksearch("lbl:** /d", $selFolders), "sed", <crlf>);
// No selected folders, use folders in <curpath>
} else {
$items = formatlist(quicksearch("lbl:** /d", listfolder(<curpath>, , 2, <crlf>)), "sed", <crlf>);
}
}
if ($items) {
tagitems("label", "", $items);
status "All items tagged...", , "ready";
}
function GetFoldersOnly($items, $inSep="|", $outSep="|") {
$list = "";
foreach($item, $items, $inSep, "e") {
if (exists($item) == 2) { $list = $list . $item . $outSep; }
}
return formatlist($list, "sed", $outSep);
}
Code: Select all
// "Option: $P_TagOptions"
// if ($P_TagOptions == "D") { $P_TagOptions = "D+F"; }
// elseif ($P_TagOptions == "D+F") { $P_TagOptions = "D"; }
// else { $P_TagOptions = "D"; }
// load "*", "Apply tag", "s";
Code: Select all
$selFolders = GetFoldersOnly(get("SelectedItemsPathNames"), <crlf>, <crlf>);
if ($selFolders) { // Selected folders
$items = formatlist(quicksearch("lbl:** /d", $selFolders), "sed", <crlf>);
} else { // No selected folders, use folders in <curpath>
msg "Unlabelling folders will now start...";
$items = formatlist(quicksearch("lbl:** /d", listfolder(<curpath>, , 2, <crlf>)), "sed", <crlf>);
}
if ($items) {
tagitems("label", "", $items);
msg "Unlabelling finished!";
}
function GetFoldersOnly($items, $inSep="|", $outSep="|") {
$list = "";
foreach($item, $items, $inSep, "e") {
if (exists($item) == 2) { $list = $list . $item . $outSep; }
}
return formatlist($list, "sed", $outSep);
}
I can live with that, no problem!highend wrote:Not possible (at least not without an external tool, that wouldn't allow mouse clicks while the script is running. Though it's easy to write such a tool)...
Code: Select all
$path = "D:\Users\Highend\Development\AutoHotkey\#NOT UNDER ACTIVE DEVELOPMENT\xyLockWhileScriptInProgress";
$exe = "xyLockWhileScriptInProgress.exe";
$bat = "%TEMP%\~killLock.bat";
$batContent = <<<>>>
@FOR /F "tokens=1,2,9 delims=," %%P IN ('TASKLIST /NH /V /FO CSV ^| FINDSTR /IL "$exe"') DO (TASKKILL /F /PID %%Q)
>>>;
writefile($bat, $batContent);
$selFolders = GetFoldersOnly(get("SelectedItemsPathNames"), <crlf>, <crlf>);
run """$path\$exe""";
if ($selFolders) { // Selected folders
$items = formatlist(quicksearch("lbl:** /d", $selFolders), "sed", <crlf>);
} else { // No selected folders, use folders in <curpath>
$items = formatlist(quicksearch("lbl:** /d", listfolder(<curpath>, , 2, <crlf>)), "sed", <crlf>);
}
if ($items) {
tagitems("label", "", $items);
status "All items unlabelled...", , "ready";
}
run """$bat""", , 2, 0;
delete 0, 0, $bat;
function GetFoldersOnly($items, $inSep="|", $outSep="|") {
$list = "";
foreach($item, $items, $inSep, "e") {
if (exists($item) == 2) { $list = $list . $item . $outSep; }
}
return formatlist($list, "sed", $outSep);
}
It is but it won't get activated until XY is restarted...I want to change the "Sort folder always ascending" setting via a script, is that possible?