ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

IDEA: Create shortcuts from a list

<< < (6/7) > >>

lanux128:
ok, progress report.. :)
double-clicking on the box for output path works fine, regardless of the spaces within the path. :up:

however from the text file, the output path containing spaces doesn't work. here are a few formats i tried:
• ABC.exe,C:\A AA\BBB - creates BBB.lnk in A AA folder instead of ABC.exe in BBB
• ABC.exe,C:\A AA\BBB, - doesn't work
• ABC.exe,"C:\A AA\BBB" - doesn't work

btw, an option to ignore entries starting with a semi-colons for commenting purposes would be nice plus the implementation of <shortcut name> as part of the syntax..

skrommel:
 :) Here's one I've actually tested!

Text2Shortcut

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>
 <path to source file>,<name of shortcut>
;<path to source file> ;=line is ignored

Skrommel

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

lanux128:
sorry but the results are erratic.. btw, nice touch with the msg-box, i can monitor what's going on..
anyway, here is my text file with results. so that you can have a better picture..

My ListC:\My Tools\bintext.exe --> ok
;C:\My Tools\cpuz.exe --> this line is not ignored
C:\My Tools\DAMN NFO Viewer.ico --> ok
C:\My Tools\Dr.exe,C:\My Downloads\Test --> created as Test.lnk in 'My Downloads'
C:\My Tools\Flashpla.exe --> ok
C:\My Tools\ListFonts.exe --> ok
C:\My Tools\mplayerc.exe,Media Player Classic --> not created.

skrommel:
 :tellme: Forgot one vital information: A \ must be added to the end of a lone destination folder! See the description above!

Skrommel

lanux128:
almost there but there are still some rough edges..

• the .exe appears again on the newly-created shortcuts.. (see above).
• besides this syntax, <path to source file>,<target folder>\<name of shortcut>.lnk, i also want to be able use this format: <path to source file>,<name of shortcut>.lnk, the target folder being the current folder of the text file.

thanks again, skrommel. :)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version