Recognize shortcuts to folders? [Solved]

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
xy123
Posts: 217
Joined: 17 Sep 2017 11:46
Location: Win10 64-bit, @100%

Recognize shortcuts to folders? [Solved]

Post by xy123 »

I have CEA Middle-click on file | Run script | sendkeys "^%{ENTER}";

But this breaks middle-click on shortcut to folder, which is to open it in a new tab.
Is there a way to open shortcut to folder in a new tab and still have sendkeys "^%{ENTER}"; for shortcut to file and regular file?

Something like: if .lnk and .lnk = folder, open in new tab else sendkeys "^%{ENTER}";
Last edited by xy123 on 06 Apr 2022 18:01, edited 1 time in total.

Norn
Posts: 522
Joined: 24 Oct 2021 16:10

Re: Recognize shortcuts to folders?

Post by Norn »

Code: Select all

if(exists(<curitem>) == "2") {#1043;}
 else {
 if(get("curitem", "ext") == "lnk") {tab("new", "<curitem>"); end '1==1';}
 if(exists(<curitem>) == "1") {sendkeys "^%{enter}";}
 }
Windows 11 24H2 @100% 2560x1440

xy123
Posts: 217
Joined: 17 Sep 2017 11:46
Location: Win10 64-bit, @100%

Re: Recognize shortcuts to folders?

Post by xy123 »

Thank you, but it's not working properly, it thinks that all shortcuts are shortcuts to folders.

Norn
Posts: 522
Joined: 24 Oct 2021 16:10

Re: Recognize shortcuts to folders?

Post by Norn »

Code: Select all

if(exists(<curitem>) == "2") {#1043;}

 else {
 if(get("curitem", "ext") != "lnk") {
 sendkeys "^%{enter}"; end '1==1';}}
 
 else {
 if(get("curitem", "ext") == "lnk") {
 $linktarget = property("#linktarget", "<curitem>");
 $Path = regexreplace($linktarget, "(.*\\)(.*)", "$1");
 $Name = regexreplace($linktarget, "(.*\\)(.*)", "$2");

 if(exists($linktarget) == "2") {
 tab("new", "$linktarget");}
 else {
 tab("new", "$Path");
 selectitems "$Name";}
 }
}
Windows 11 24H2 @100% 2560x1440

xy123
Posts: 217
Joined: 17 Sep 2017 11:46
Location: Win10 64-bit, @100%

Re: Recognize shortcuts to folders?

Post by xy123 »

There might be a misunderstanding.
Middle-click on all shortcuts which are not shortcuts to folders should show POM (sendkeys "^%{ENTER}";).
For example, middle click on Notepad++.exe.lnk should show POM, not open Notepad++ folder.

xy123
Posts: 217
Joined: 17 Sep 2017 11:46
Location: Win10 64-bit, @100%

Re: Recognize shortcuts to folders?

Post by xy123 »

Thank you very much for your code :appl: , this works:

Code: Select all

if(exists(<curitem>) == "2") {#1043;}

 else {
 if(get("curitem", "ext") != "lnk") {
 sendkeys "^%{enter}"; end '1==1';}}
 
 else {
 if(get("curitem", "ext") == "lnk") {
 $linktarget = property("#linktarget", "<curitem>");

 if(exists($linktarget) == "2") {
 tab("new", "$linktarget");}
 else {
 sendkeys "^%{enter}";}
 }
}

Post Reply