Page 1 of 1

Recognize shortcuts to folders? [Solved]

Posted: 06 Apr 2022 02:56
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}";

Re: Recognize shortcuts to folders?

Posted: 06 Apr 2022 14:47
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}";}
 }

Re: Recognize shortcuts to folders?

Posted: 06 Apr 2022 15:05
by xy123
Thank you, but it's not working properly, it thinks that all shortcuts are shortcuts to folders.

Re: Recognize shortcuts to folders?

Posted: 06 Apr 2022 17:39
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";}
 }
}

Re: Recognize shortcuts to folders?

Posted: 06 Apr 2022 17:50
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.

Re: Recognize shortcuts to folders?

Posted: 06 Apr 2022 18:00
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}";}
 }
}