Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Applescript to display real date of selected timestamp
on run {input, parameters}
tell application "System Events"
set activeApp to name of first process whose frontmost is true
end tell
set _timestamp to (input as string)
tell application activeApp
set realDate to ((do shell script "date -r " & _timestamp) as string)
display dialog realDate buttons { "Ok" } default button 1
end tell
return realDate
end run
@danharper

This comment has been minimized.

Copy link
Owner Author

commented Sep 25, 2015

To use with a keyboard shortcut:

  1. Open Automator
  2. Create a new 'Service', which "receives selected text in any application"
  3. Drag 'Run Applescript' into the Workflow window, paste in the code
  4. Save as 'Unix Timestamp' (or something else unique)
  5. System Preferences > Keyboard > Keyboard Shortcuts > Services
  6. Find the service in the list (under 'Text') and add a shortcut for it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.