Jump to content
LittleEntity

alfreTS - copy formatted current timestamp to clipboard

Recommended Posts

alfreTS

This is a time stamp workflow for the Alfred Application.

 

Download the current package via dropbox.

 

Open the alfred window then type now. The results show the current timestamp in different formats. Select a timestamp format to copy the shown timestamp to the clipboard. Paste it into any editor you like.

 

You can define your own formats via the python strftime syntax. It is also possible to define your preferred locale setting to acquire the weekday and month names in your local language. In order to edit these settings you need to enter the settings into the script of the Script Filter inside the workflow. This can be done by editing the #commented lines. (In case you did not know how #comments work: lines with # in front will be ignored by the python interpreter and not be executed.)

 

Please visit the projects github repository.

 

If you are using this workflow and you happen to make a new format for timestamps please share it here. Thankyou!

 

<( ^_^)> hug me <(^.^ )>

 

PS: somehow I cannot add screenshots here. It says I am not allowed to link *.png files  (T_T)"  If you would like to see some screenshots please visit the github repository. The README.md contains two screenshots.

 

update: new version online =) alfreTS_v0.0.201402142154.alfredworkflow

 

Question to all users: Would you like to have an interface via the Alfred input window to edit your locale and your formats?

Edited by LittleEntity

Share this post


Link to post

Great workflow! Thanks for sharing.

Changing locale to [myLocale = 'el_GR.UTF-8'] (without the brackets) breaks it for some reason (keyword "now" is not recognized).

What am I doing wrong? Thanks for any help!

Share this post


Link to post

Hi =)

 

I've tried to fix this issue for quite a while now. Right now I cannot find what breaks it. It's something with the Element Tree tostring( ) library function that breaks it. I assume the greek weekday letters contain non ascii symbols. Actually that should be addressed by the tostring( ) method.

I'm doing something wrong I guess... I'll try next week to fix it. Got an exam next Monday ^^"

 

thank you for your reply =D

 

PS: fixed some bugs on the way ^^ so it wasn't completely useless =)

Edited by LittleEntity

Share this post


Link to post

new version online! GREEK LOCALE is now supported! download it from the drop box ^^

 

Download the current package via dropbox.

 

I don't exactly know how I fixed it but it works with greek letters now. I really need to learn more about encodings and stuff ...

I will learn about encodings next week ^^

 

enjoy the update =)

 

@M1m1s: please write a greek format string to the forums so we can share it for everyone =D thank you. <(^.^)> *cheer!* <(^o^)>

Edited by LittleEntity

Share this post


Link to post

Great idea!

 

Small bug: the "German date representation" is a bit wrong.

 

("%A %d.%b.%Y um %H:%M Uhr", "German date representation")

 

produces Montag 17.Feb.2014 um 10:06 Uhr

 

It should read:

 

("%A %d. %b %Y um %H:%M Uhr", "German date representation")

 

which produces Monday 17. Feb 2014 um 10:14 Uhr

 

It might be a better idea to use the system locale as default:

import locale
locale.setlocale(locale.LC_ALL, '')

### edit this page to your liking ###
#    <()> *free hugs* <(^o^)>    #

### enter or select your locale setting: ###
myLocale = locale.getlocale()
#myLocale = 'de_DE.UTF-8'
#myLocale = 'en_GB.UTF-8'
#myLocale = 'el_GR.UTF-8'
#myLocale = 'en_US.UTF-8'

so it uses my system's default formatting (i.e. 17/02/14 not 17.02.14).

Share this post


Link to post

thank you for your reply.

I live in germany and my native language is german. My System is also configured german. When I use your script it takes an english language locale. What I want is an output like

Montag 17.Feb.2014 um 16:39 Uhr

Montag (dt.) = Monday (en.)

I don't know why it cannot find out my real system's locale. So I decided to manually implement the locale by defining myLocale in the first script.

 

[ locale.setlocale(locale.LC_ALL, '') ] is called in the executed script [ main.py ] in the workflows directory. You don't need to execute it manually in the first script. If you want to use an english locale you can either use [ myLocale = 'en_GB.UTF-8' ] or [ myLocale = locale.getlocale() ]. The last only works properly if you first define [ import locale ] of course.

 

Have fun =)

 

Question to all users: Would you like to have an interface via the Alfred input window to edit your locale and your formats?

Share this post


Link to post

Yeah, I know how to set a British locale, thanks. I was suggesting a way to use the system locale automatically.

 

I don't know why your system uses an English locale with my edit: on mine I get the correct system locale, i.e. en_GB on my main, English-language account and de_DE on my German account.

 

My bad: I accidentally deleted a full stop too many from the DE date format. But yours is still lacking spaces (if you want it to be correct). It should be "17. Feb. 2014" not "17.Feb.2014".

 

This is how my edited script works on my system:

 

VhBjSLq.png

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...