Skip to content

Instantly share code, notes, and snippets.

@jbl0ndie
Created February 12, 2017 16:04
Show Gist options
  • Save jbl0ndie/60f059f5e7192dd9a698f6735ec9ba4a to your computer and use it in GitHub Desktop.
Save jbl0ndie/60f059f5e7192dd9a698f6735ec9ba4a to your computer and use it in GitHub Desktop.
AppleScript to copy the path of an image in the syntax required by TiddlyWiki for easy image embedding
on run {input, parameters}
tell application "Finder"
set fileName to selection as alias
set fileName to POSIX path of fileName
set firstPart to "[img[" & fileName
set imagePath to firstPart & "]]"
set the clipboard to imagePath
end tell
return input
end run
@jbl0ndie
Copy link
Author

Adding local images to a TiddlyWiki document is quite tedious because of the syntax (example given in OS X):

[img[/Users/user/path/to/folder/filename.jpg]]

This simple AppleScript can be used to copy the file path from Finder into the clipboard in the correct format, ready for pasting into a TiddlyWiki document. For ultimate awesomeness, set it up as a service and then assign a keyboard shortcut.

Instructions for use

  1. Grab the code
  2. Open Automator and paste it into a Run AppleScript node
  3. Change the input to be accepts files and folders from Finder
  4. Save it out as a Service with a meaningful name
  5. The service should appear in the right-click context menu under Services
  6. Optional: keyboard shortcuts can be assigned to services in System Preferences -> Keyboard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment