Drop a textfile with filenames on it to create shortcuts in the folder of the dropped textfile.
DoubleClick the drop window to select another target folder.
RightClick the drop window to edit the settings.
Spoiler
;Text2Shortcut.ahk
; Drop a textfile with filenames on it to create shortcuts in the folder of the dropped textfile.
; DoubleClick the drop window to select another target folder.
; RightClick the drop window to edit the settings.
;Syntax of dropped text file:
; <path to source file>
; <path to source file>,<target folder>\ <--- a \ must be added to a folder
; <path to source file>,<target folder>\<name of shortcut>.lnk
; <path to source file>,<name of shortcut>.lnk
;;<path to source file> ;=line is ignored
;Skrommel @2006
#SingleInstance,Force
#NoEnv
applicationname=TS
Gosub,INIREAD
If target=
TrayTip,%applicationname%,Target set to the folder of the dropped file
Else
TrayTip,%applicationname%,Target set to the folder %target%
Gosub,GUI
Return
GuiDropFiles:
Loop,Read,%A_GuiControlEvent%
{
SplitPath,A_GuiControlEvent,,dropdir,,,
dir:=dropdir
If target<>
dir:=target
StringSplit,part_,A_LoopReadLine,`,
IfInString,part_1,`;
Continue
If part_0=1
{
SplitPath,part_1,name,,ext,name_no_ext,
If ext In %noext%
name:=name_no_ext
FileCreateShortCut,%part_1%,%dir%\%name%.lnk
TrayTip,%applicationname%,Created shortcut to %part_1% in %dir%\%name%.lnk
}
Else
If part_0=2
{
SplitPath,part_2,name,dir,ext,name_no_ext,
If dir=
dir:=dropdir
If name=
SplitPath,part_1,name,,ext,name_no_ext,
If ext In %noext%
name:=name_no_ext
FileCreateShortCut,%part_1%,%dir%\%name%.lnk
TrayTip,%applicationname%,Created shortcut to %part_1% in %dir%\%name%.lnk
}
}
Return
GUI:
Gui,Destroy
Gui,+ToolWindow +DropFiles +AlwaysOnTop -Border +Caption +Resize
Gui,Add,ListView,X0 Y0 W%w% H%h% GGUICLICK AltSubmit Icon
Gui,Show,X%x% Y%y% W%w% H%h%,%applicationname%
Gui,+LastFound
guiid:=WinExist("A")
WinMove,ahk_id %guiid%,,%x%,%y%,%w%,%h%
Return
GUICLICK:
If A_GuiControlEvent=DoubleClick
{
FileSelectFolder,target,%target%,3,Select target folder
If ErroLevel=1
target=
If target=
TrayTip,%applicationname%,Target set to the folder of the dropped file
Else
TrayTip,%applicationname%,Target set to the folder %target%
}
Else
If A_GuiControlEvent=RightClick
{
RunWait,%applicationname%.ini
Reload
}
Else
PostMessage,0xA1,2,,,A
Return
GuiEscape:
GuiClose:
WinGetPos,x,y,w,h,ahk_id %guiid%
IniWrite,%x%,%applicationname%.ini,Settings,x
IniWrite,%y%,%applicationname%.ini,Settings,y
IniWrite,%w%,%applicationname%.ini,Settings,w
IniWrite,%h%,%applicationname%.ini,Settings,h
IniWrite,%target%,%applicationname%.ini,Settings,target
ExitApp
INIREAD:
IfNotExist,%applicationname%.ini
{
IniWrite,% A_ScreenWidth-140,%applicationname%.ini,Settings,x
IniWrite,0,%applicationname%.ini,Settings,y
IniWrite,37,%applicationname%.ini,Settings,w
IniWrite,37,%applicationname%.ini,Settings,h
IniWrite,%A_Space%,%applicationname%.ini,Settings,target
IniWrite,exe`,com`,cmd`,bat,%applicationname%.ini,Settings,noext
}
IniRead,x,%applicationname%.ini,Settings,x
IniRead,y,%applicationname%.ini,Settings,y
IniRead,w,%applicationname%.ini,Settings,w
IniRead,h,%applicationname%.ini,Settings,h
IniRead,target,%applicationname%.ini,Settings,target
If (target="" Or target=" " Or target="ERROR")
target=
IniRead,noext,%applicationname%.ini,Settings,noext
Return