topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Friday March 29, 2024, 10:38 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: DONE: Create Shortcut on the Destop (hopefully not as stupid as it sounds)  (Read 17298 times)

jdd

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 214
    • View Profile
    • Donate to Member
It would be very helpful to have an autohotkey script which sends a shortcut to the desktop. 

In other words, if a file is highlighted in Windows Explorer and I run the script (i.e. run the script in FARR) , it will create a shorcut on the destop.  I realize that I can right click on the file and use SendTo in the context menu but this process is very, very slow on my machine.  :-[

Thanks,
jdd

Eóin

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 1,401
    • View Profile
    • Donate to Member
Would that really be faster than right-click dragging a file onto the desktop which offers creating a shortcut as an option?

Alternatively if you browse the the Send to folder (copy and paste "%APPDATA%\Microsoft\Windows\SendTo" in an explorer window address bar) you can make copies of the "Desktop (create shortcut)" shortcut anywhere you like and dropping files from explorer onto that shortcut makes desktop shortcuts.

Also I'd really recommend looking into why your send to menu is so slow.


jdd

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 214
    • View Profile
    • Donate to Member
Eóin: When I right click on a file, it takes approximately 5 seconds for the context menu to open.  Any idea why this would happen.  I have a 2-yr old Dell lap top with decent processor and 2 gig RAM running with Windows XP .

PhilB66:  Thanks for the suggestions but they do not do what I am looking for.  All of them involve using context menu or multiple steps which is what am trying to avoid.


skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Here you go.  Works with files, folders, single and multiple selections.  Change the shortcut to whatever you'd like (ctrl-d is default).

Code: Autohotkey [Select]
  1. ^d::
  2. {
  3.     ; Save current clipboard contents for restoration later.
  4.     Clipboard_Saved := ClipboardAll
  5.    
  6.     ; Clear clipboard
  7.     Clipboard := ""
  8.    
  9.     ; Get Explorer selection to the clipboard.
  10.     SendInput, ^c
  11.    
  12.     ; Wait up to three seconds for the clipboard to contain data.
  13.     ClipWait, 3
  14.    
  15.     ; Error-checking for the ClipWait.
  16.     If ( ErrorLevel != 0 )
  17.     {
  18.         MsgBox, The Clipboard timed out.
  19.         Return
  20.     }
  21.  
  22.     ; Create shortcuts.
  23.     Loop, Parse, Clipboard, `n, `r
  24.     {
  25.         If ( A_LoopField != "" )
  26.         {
  27.             SplitPath, A_LoopField, , OutDir, , OutNameNoExt
  28.             FileCreateShortcut, % A_LoopField, % A_Desktop . "\" . OutNameNoExt . ".lnk", % OutDir
  29.             Sleep, 1
  30.         }
  31.     }
  32.    
  33.     ; Restore clipboard.
  34.     Clipboard := Clipboard_Saved
  35.    
  36.     ; Free memory.
  37.     Clipboard_Saved := ""
  38. }
  39. Return
« Last Edit: June 03, 2010, 12:20 AM by skwire »

Eóin

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 1,401
    • View Profile
    • Donate to Member
jdd, you probably have a slow or buggy shell extension installed. Try using the excellent ShellExView to disable them and then re enable one by one until you identify the culprit. If you sort by type you can probably just concentrate on the context menu ones.

Note after you disable/enable an extension you need to restart explorer.exe. One way to do so is kill the process through taskmanager and then still in taskmanger chose New task and type explorer. There may also be an easier way someone here knows :)

jdd

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 214
    • View Profile
    • Donate to Member
I use Autohotkey.  Can you translate the script from AutoIt?

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,959
    • View Profile
    • Donate to Member
I use Autohotkey.  Can you translate the script from AutoIt?

I dont know why it says AutoIT (I think it's the nearest option in the drop-down code-highlighting when posting). Skwire's scripts normally work as AHK files (& are ahk I'm fairly sure)
Tom

cranioscopical

  • Friend of the Site
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,776
    • View Profile
    • Donate to Member
I use Autohotkey.  Can you translate the script from AutoIt?

jdd,

That is an ahk script.
the line:
"Formatted for AutoIt with the GeSHI Syntax Highlighter v1.0.8.4 [copy or print]"
is a little misleading.
If you click on the word "copy" in that line you'll be able to transfer the script to your own machine, naming it what you like.

I'd be quick to take Eóin's advice, you almost certainly have a 'bad' shell extension. Finding and removing that will make your computer days a lot less annoying.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
I use Autohotkey.  Can you translate the script from AutoIt?

As tomos and cranioscopical mentioned, that is AHK code.  The AutoIt highlighter is the closest we have to an AHK highlighter.  Apologies for the ambiguity.

AndyM

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 616
    • View Profile
    • Donate to Member
Note after you disable/enable an extension you need to restart explorer.exe. One way to do so is kill the process through taskmanager and then still in taskmanger chose New task and type explorer. There may also be an easier way someone here knows
NirSoft has a utility that restarts explorer:
http://www.nirsoft.n...estart_explorer.html


jdd

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 214
    • View Profile
    • Donate to Member
skwire

Worked like a charm.  However, my preference would be that the script is not always running in the tray. 

Is it possible to add an option so that the script can be executed as an alias in FARR, and closes after the shortcut is created on the desktop?

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Is it possible to add an option so that the script can be executed as an alias in FARR, and closes after the shortcut is created on the desktop?

Do you not run a main AHK script of any sort?  This is a simple hotkey that can be integrated into any AHK script.

See post below...
« Last Edit: March 02, 2010, 07:22 AM by skwire »

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Here's a FARR alias package for it:

http://skwire.dcmemb...sktopShortcutter.zip

Unpack that to your FARR Installed or MyCustom folder and type goreload into FARR.  The default alias is ds and the application is designed to activate the last active window before FARR.  In other words, focus your Explorer (or any file manager) window, make your selection, activate FARR, type ds, and press enter.  Shortcuts of your selection should appear on the desktop.  Let me know how it works out for you.  Thanks.

jdd

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 214
    • View Profile
    • Donate to Member
It works in Windows Explorer but not my preferred file manager which is XPlorer2.  When I try it in XPlorer2, it maximizes my browser (Firefox), and pops open an error message that says "The clipboard timed out".

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
I downloaded and installed Xplorer2 and it works fine here.  However, I've uploaded a new version that allows you to specify the clipboard timeout amount.  Re-download using the same URL and you can now adjust the timeout like this in your alias:

Desktop Shortcutter | %ALIASDIR%\DesktopShortcutter.exe %LASTHWND% 5 /ICON=icons\Desktop.ico

You can change that 5 (timeout in seconds) to whatever number will work on your system.  You may have to experiment a little.  As for Firefox maximising, I have no idea.  I am running Firefox as well and haven't seen that behaviour.

jdd

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 214
    • View Profile
    • Donate to Member
Perfect!   :Thmbsup:  It dosn't maximize Firefox anymore. Thanks.

app103

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,884
    • View Profile
    • Donate to Member
Eóin: When I right click on a file, it takes approximately 5 seconds for the context menu to open.  Any idea why this would happen.  I have a 2-yr old Dell lap top with decent processor and 2 gig RAM running with Windows XP .

Take Eóin's advice, and if you are still having issues with it, read on...

A lot of software likes to stick entries on that SendTo menu (and the "New" menu), and the more stuff you have there the longer it takes to show the menu.

Might want to clean it up if that happens to be your issue.

There is lots of stuff you will never use and cleaning it up not only makes it faster, it makes it easier to find the entry on the menu that you are looking for. Just make sure you are not deleting any of the original stuff.

Keep these (yours may or may not have those odd file extensions showing, depending on how your system is configured):
  • Compressed (zipped) Folder.ZFSendToTarget
  • Desktop (create shortcut).DeskLink
  • desktop.ini
  • Mail Recipient.MAPIMail
  • My Documents.mydocs
(this is from XP, there may be more with Vista/Win7)

Another thing that could cause it to be slow is an issue with one or more of your drives (very large single partition external drives are great for causing this), or having an unusually large number of drive letters it will have to add to the menu. (If you are up to W like I am, you'll be waiting a little bit for that SendTo menu to show)

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
app and Eoin are right.

there are some nice articles and utils to help you diagnose this.
for example:

http://www.watchingt...lems-in-windows.html
http://windowsxp.mvp...g/slowrightclick.htm