Skip to content

Instantly share code, notes, and snippets.

@budRich
Created July 20, 2013 10:01
Show Gist options
  • Save budRich/6044508 to your computer and use it in GitHub Desktop.
Save budRich/6044508 to your computer and use it in GitHub Desktop.
/*
ToFasc - To Folder as shortcut
-------------------------------
Place a shortcut to this file in your SendTo folder.
When you "send" a file to ToFasc it let you choose
folder and name for your shortcut.
budRich - 2013
*/
#SingleInstance force
#NoEnv
#MaxHotkeysPerInterval 200
#Persistent
SetBatchLines, -1
SetWinDelay, -1
SetWorkingDir, %A_ScriptDir%
SendMode, Input
OnExit, Avslut
#NoTrayIcon
Gui +LastFound
Gui +Delimiter`n
IfNotExist %1%
ExitApp
;~ Gui +OwnDialogs
BrowseTxt := "Browse..."
if !FileExist("list.txt")
{
FileAppend, %BrowseTxt%, list.txt
dest:=BrowseTxt
gosub, Select
}
Loop, %1%
fil := A_LoopFileLongPath
FileRead, ddllst, list.txt
;~ IniRead, ddllst,settings.ini,General,ddllst
margarin:=5
winW:=500
objW:=winW-(2*margarin)
Gui, +ToolWindow
Gui, margin, %margarin%
Gui, Add, Text,w%objW%, Where do you want to create your shortcut?
Gui, Add, Edit, vlnkName hide wp, text
Gui, Add, DropDownList, y+30 Choose1 vdest gSelect wp, %ddllst%
Gui, Add, Button,Section x138, Cancel
Gui, Add, Button, Default ys, Ok
Gui, Show, xcenter ycenter h110 w%winW%, %A_Space%
return
NewShortcut(dest) {
global BrowseTxt, ddllst, fil
SplitPath, fil,,trgdir,,filen
InputBox, trgt, %A_Space%, Name your shortcut:,,,,,,,,%filen%
FileCreateShortcut, %fil%, %dest%\%trgt%.lnk,%trgdir%
FileDelete, list.txt
bajLst .= dest
Loop, Parse, ddllst, `n
{
StringReplace, lf, A_LoopField,`n,,All
if((A_LoopField) && (lf <> dest) && (lf <> BrowseTxt)) {
bajLst .= "`n" lf
}
}
bajLst .= "`n" BrowseTxt
FileAppend, %bajLst%, list.txt
}
ButtonOk:
Gui, Submit, NoHide
NewShortcut(dest)
ExitApp
Select:
Gui, Submit, NoHide
if(dest=BrowseTxt) {
FileSelectFolder, newDest,,3, Choose a folder for your shortcut.
If(ErrorLevel=1) {
return
}
NewShortcut(newDest)
ExitApp
}
return
GuiEscape:
GuiClose:
ButtonCancel:
Avslut:
ExitApp
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment