/* TiddlyWikifier v1.0 by FND Converts Windows file paths to TiddlyWiki PrettyLinks */ /* ToDo: - backup clipboard - automatically add a shortcut to the SendTo menu */ /* Changelog ŻŻŻŻŻŻŻŻŻ # v1.0 (2007-06-08) * initial release */ /* ********** Settings, Variable Declarations ********** */ #SingleInstance Force #NoEnv OnExit, quit programName = TiddlyWikifier programVersion = 1.0 programFullName = %programName% v%programVersion% programAuthor = FND filePath = title = /* ********** Auto-Execute Section ********** */ ; backup clipboard contents ;clipboardBak := ClipboardAll ; DEBUG: disabled, as it complicates script termination ; process command line parameters GoSub, getParams ; get title (optional) If(title = "") { InputBox, title, %programFullName%, Please enter a title for your link.`n(Press cancel to not use a custom title.) ,,,,,,,, %filePath% If(ErrorLevel = 1) title = } ; convert file path StringReplace, filePath, filePath, \, /, All ; convert slashes to Unix format filePath = file:///%filePath% ; add file protocol ; construct PrettyLink If(title = "") tiddlyLink = [[%filePath%]] Else tiddlyLink = [[%title%|%filePath%]] ; copy PrettyLink to clipboard Clipboard := tiddlyLink ; end of auto-execute section Return /* ********** Subroutines ********** */ ; process command line parameters getParams: If 0 > 0 { filePath = %1% if(title != "") title = %2% } Return ; terminate script quit: ; restore clipboard contents ;Clipboard := clipboardBak ; DEBUG: disabled; see above ; terminate script ExitApp Return