Way to make script symlinks from inside xyplorer

Features wanted...
Post Reply
mydarkpassenger
Posts: 31
Joined: 19 Apr 2014 19:39

Way to make script symlinks from inside xyplorer

Post by mydarkpassenger »

I'm like to see a feature to be able to generate symbolic links from inside of xyplorer through scripts.

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Way to make script symlinks from inside xyplorer

Post 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.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Way to make script symlinks from inside xyplorer

Post 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;
    }
One of my scripts helped you out? Please donate via Paypal

mydarkpassenger
Posts: 31
Joined: 19 Apr 2014 19:39

Re: Way to make script symlinks from inside xyplorer

Post by mydarkpassenger »

Thank you both for the help. I'll check them out! :)

CookieMonster

Re: Way to make script symlinks from inside xyplorer

Post 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 ?

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Way to make script symlinks from inside xyplorer

Post by highend »

What do you think oShellLink.IconLocation does?...
One of my scripts helped you out? Please donate via Paypal

CookieMonster

Re: Way to make script symlinks from inside xyplorer

Post 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 ?

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Way to make script symlinks from inside xyplorer

Post 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?
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Way to make script symlinks from inside xyplorer

Post 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 :whistle:
One of my scripts helped you out? Please donate via Paypal

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Way to make script symlinks from inside xyplorer

Post by bdeshi »

1 should be the right choice. Now it's 1+3+7 == shows+maximizes+minimizes the window! :P
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

CookieMonster

Re: Way to make script symlinks from inside xyplorer

Post 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 ?

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Way to make script symlinks from inside xyplorer

Post by bdeshi »

highend's script just makes a common shortcut.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

CookieMonster

Re: Way to make script symlinks from inside xyplorer

Post 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.

CookieMonster

Re: Way to make script symlinks from inside xyplorer

Post 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 ?

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Way to make script symlinks from inside xyplorer

Post 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
symlinkColorFilter.png (5.98 KiB) Viewed 4516 times
[/size]
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

Post Reply