Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Begin Send to desktop
- ^+d::
- ; Get file name
- file_path := % gst()
- if (file_path == "") ; if there is no file is selected
- {
- return
- }
- StringSplit, array, file_path, \
- file_name := array%array0% ;Contains the value of the last item in Array. Use ":=" for assignation.
- ; Remove extension
- StringSplit, array, file_name, .
- file_name := array1
- ; Create shortcut
- FileCreateShortcut, % file_path , %A_Desktop%\%file_name%.lnk
- return
- ; Resources
- ; https://autohotkey.com/docs/commands/FileCreateShortcut.htm
- ; GetSelectedText or FilePath in Windows Explorer by Learning one
- ; https://autohotkey.com/board/topic/60723-can-autohotkey-retrieve-file-path-of-the-selected-file/
- gst() {
- IsClipEmpty := (Clipboard = "") ? 1 : 0
- if !IsClipEmpty {
- ClipboardBackup := ClipboardAll
- While !(Clipboard = "") {
- Clipboard =
- Sleep, 10
- }
- }
- Send, ^c
- ClipWait, 0.1
- ToReturn := Clipboard, Clipboard := ClipboardBackup
- if !IsClipEmpty
- ClipWait, 0.5, 1
- Return ToReturn
- }
- ; End Send to desktop
Advertisement
Add Comment
Please, Sign In to add comment