Er, sorry. Make that man strftime, not man date.
On Monday, August 19, 2013 3:55:55 AM UTC-4, Jon Stovell wrote:
>
> Why not use the Prepend Text... and Prepend To... actions included in the
> Text Manipulation plugin?
>
> *To prepend a string or URL*
> Just paste the string into the first pane, select Prepend To... in the
> second, and select the file in the third.
>
> *To prepend the date*
> First, make the following trigger in Quicksilver:
> date -j "+%Y-%m-%d %H:%M" (Run Command in Shell)
> That will get you the current date as a string of text in Quicksilver's
> first pane.
>
> Now, run the trigger, and then select Prepend To... in the second pane and
> your file in the third pane. All done. Plus, you now also have a trigger
> available to get the current date as a string for any other purposes you
> might have for that. :)
>
> Note: the %H above will give you the hour in 24 hour format. If you want
> 12 hour format, change it to %I and add a %p to the end to get an AM or PM
> indicator. If you want to learn more about your formatting options, run man
> date in Terminal.
>
>
> On Sunday, August 18, 2013 4:04:54 PM UTC-4, Andrea Ghensi wrote:
>>
>> Hi all, I'm trying to write an applescript action for quicksilver that
>> lets me prepend a text into a text file (my journal, saved in the same
>> folder of my nvAlt notes). I also add the current date and time before the
>> text (or URL) of the first pane. I put up the script copying from various
>> sources, here you are:
>>
>> set theFile to "Path:To:File.txt"
>>
>>
>> on format_date() --it gives me the date in YYYY.mm.dd HH:MM format
>> set {year:y, month:m, day:d} to current date
>> tell ((y * 10000 + m * 100 + d) as string) & " " & time string of (current
>> date) to text 1 thru 4 & "." & text 5 thru 6 & "." & text 7 thru 14
>> end format_date
>>
>>
>> using terms from application "Quicksilver"
>> on get direct types
>> return {"Apple URL pasteboard type", "NSStringPboardType"}
>> end get direct types
>>
>> on process text journalentry
>> try
>> set N to open for access theFile with write permission
>> get eof N
>> if result > 0 then
>> set theText to read N
>> else
>> set theText to ""
>> end if
>> set eof N to 0
>> write "###" & format_date() & journalentry & return & return & theText
>> to N
>> close access N
>> end try
>> end process text
>> end using terms from
>>
>> It works outside of quicksilver (removing the quicksilver related lines
>> and setting the variable journalentry to some text), but I cannot make it
>> work with QS.
>> Do you have any idea why? or do you know how I can debug this thing?
>> Thanks for your attention!
>> Cheers from Italy
>>
>
--
You received this message because you are subscribed to the Google Groups
"Quicksilver" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/blacktree-quicksilver.
For more options, visit https://groups.google.com/groups/opt_out.