Page 1 of 8
Way to make script symlinks from inside xyplorer
Posted: 01 Jul 2015 17:52
by mydarkpassenger
I'm like to see a feature to be able to generate symbolic links from inside of xyplorer through scripts.
Re: Way to make script symlinks from inside xyplorer
Posted: 01 Jul 2015 17:57
by bdeshi
use run/runret and the cmdline utility mklink, which is I think available in every windows OS released after XP.
prerequisite: you may have to run XY as admin.
Re: Way to make script symlinks from inside xyplorer
Posted: 01 Jul 2015 18:22
by highend
No need for admin rights for normal symlinks:
Code: Select all
$vbsFile = "%TEMP%\~CreateSymlink.vbs";
$baseName = getpathcomponent("<curitem>", "base");
$cscript = ("%osbitness%" == 64) ? "%windir%\System32\cscript.exe" : "%windir%\SysWOW64\cscript.exe";
$vbsContent = <<<>>>
set WshShell = WScript.CreateObject("WScript.Shell")
set oShellLink = WshShell.CreateShortcut("<curpath>\$baseName.lnk")
oShellLink.TargetPath = "<curitem>"
oShellLink.WindowStyle = 11
oShellLink.IconLocation = "<curitem>"
oShellLink.Description = "$baseName"
oShellLink.WorkingDirectory = "<curpath>"
oShellLink.Save
>>>;
if (exists("<curitem>") == 1) {
writefile($vbsFile, $vbsContent);
run """$cscript"" ""$vbsFile"" /nologo", , 1, 0;
delete 0, 0, $vbsFile;
}
Re: Way to make script symlinks from inside xyplorer
Posted: 01 Jul 2015 18:28
by mydarkpassenger
Thank you both for the help. I'll check them out!

Re: Way to make script symlinks from inside xyplorer
Posted: 21 Jul 2015 02:01
by CookieMonster
Can you find, and give those symbolic links distinguishable icons, for example, or file names so you can differentiate them ?

If you can't find them, give them something that makes them unique from the rest ?
Re: Way to make script symlinks from inside xyplorer
Posted: 21 Jul 2015 07:32
by highend
What do you think oShellLink.IconLocation does?...
Re: Way to make script symlinks from inside xyplorer
Posted: 21 Jul 2015 16:11
by CookieMonster
Highend - I thought the script you posted only creates symbolic links, considering what the OP of the thread wanted, instead it does what I want to do or both ?
Re: Way to make script symlinks from inside xyplorer
Posted: 21 Jul 2015 19:44
by bdeshi
That's a very small piece of code. Just reading without understanding anything should tell you what most every line does.
Code: Select all
set oShellLink = WshShell.CreateShortcut("<curpath>\$baseName.lnk") 'this is the shortcut's location
oShellLink.TargetPath = "<curitem>" ; this is the shortcut's target
oShellLink.WindowStyle = 11 'decides whether the target app window is minimized, maximized etc
oShellLink.IconLocation = "<curitem>" 'the shortcut gets this icon
oShellLink.Description = "$baseName" 'this fills the shortcut's description field
oShellLink.WorkingDirectory = "<curpath>"
@highend: are you sure WindowStyle = 11 is logical?
Re: Way to make script symlinks from inside xyplorer
Posted: 21 Jul 2015 20:19
by highend
@sammy
No clue, that is a very old script. 1, 3 and 7 are the possible values iirc... Binary combinable? No resources to check that now. Sunday

Re: Way to make script symlinks from inside xyplorer
Posted: 22 Jul 2015 15:55
by bdeshi
1 should be the right choice. Now it's 1+3+7 == shows+maximizes+minimizes the window!

Re: Way to make script symlinks from inside xyplorer
Posted: 22 Jul 2015 16:54
by CookieMonster
If you know, for the time being what is a symbolic link; running this portion of the script will give the symbolic link a distinguishable icon and add a description in the shortcut field ?
Code: Select all
oShellLink.IconLocation = "<curitem>" 'the shortcut gets this icon
oShellLink.Description = "$baseName" 'this fills the shortcut's description field
oShellLink.WorkingDirectory = "<curpath>"
The script needs intelligence, whereas, if you forgot where you created and what is a symbolic link, the script could search and find the file then run the script, I'm assuming windows writes something to the file to distinguish from a non-symbolic link to a symbolic link ?
Re: Way to make script symlinks from inside xyplorer
Posted: 22 Jul 2015 19:06
by bdeshi
highend's script just makes a common shortcut.
Re: Way to make script symlinks from inside xyplorer
Posted: 22 Jul 2015 21:20
by CookieMonster
Code: Select all
oShellLink.IconLocation = "<curitem>" 'the shortcut gets this icon
It gets an icon, so one can tell it apart from other files.
Re: Way to make script symlinks from inside xyplorer
Posted: 24 Jul 2015 03:53
by CookieMonster
If I know what the symbolic link is, can one assume running this command will give the icon a distinguishable icon for symbolic links ?
Code: Select all
oShellLink.IconLocation = "<curitem>" 'the shortcut gets this icon
Can intelligence not be injected into the script whereas it can search for symbolic links and then give those links a distinguishable icon ?
Re: Way to make script symlinks from inside xyplorer
Posted: 24 Jul 2015 07:17
by bdeshi
No, that is
not a standalone command. And as far as I know,
symbolic links always take the icon of the target file, like a mirror.
Windows shortcuts can have arbitrary icons though.
But a shortcut is not a symbolic link.
If you just want to distinguish symlinks from normal files, then maybe this can help.
Open
Tools > Configuration > Color Filters, click
New, paste this into the newly-focused textbox:
attr:junction //colorize links , and press ENTER.
Then
without clicking or pressing anything else, click "
Text..." to choose a text color, and click "
Back..." to choose a background color.

- symlinkColorFilter.png (5.98 KiB) Viewed 5612 times
[/size]