T's Blog RSS

I'm Terence Pua. I helped build Bandwagon and iTenna.

View Terence Pua's profile on LinkedIn

Archive

Jan
8th
Tue
permalink
Ranch 99 at Cupertino (recent US trip)
Ranch 99 at Cupertino (recent US trip)
Oct
8th
Mon
permalink
Aug
25th
Sat
permalink

Example HTML for my curious cousin

bold
italics
underline Big
Bigger
Jul
26th
Thu
permalink
Jul
17th
Tue
permalink
My co-founder / colleague c2005/2006
My co-founder / colleague c2005/2006
Jul
4th
Wed
permalink
permalink
Jun
19th
Tue
permalink

AppleScript hack: move screenshots from Desktop to iPhoto

on text_to_list(txt, delim)
    set saveD to AppleScript’s text item delimiters
    try
        set AppleScript’s text item delimiters to {delim}
        set theList to every text item of txt
    on error errStr number errNum
        set AppleScript’s text item delimiters to saveD
        error errStr number errNum
    end try
    set AppleScript’s text item delimiters to saveD
    return (theList)
end text_to_list


———
on change_case(this_text, this_case)
    if this_case is 0 then
        set the comparison_string to “ABCDEFGHIJKLMNOPQRSTUVWXYZ”
        set the source_string to “abcdefghijklmnopqrstuvwxyz”
    else
        set the comparison_string to “abcdefghijklmnopqrstuvwxyz”
        set the source_string to “ABCDEFGHIJKLMNOPQRSTUVWXYZ”
    end if
    set the new_text to “”
    repeat with this_char in this_text
        set x to the offset of this_char in the comparison_string
        if x is not 0 then
            set the new_text to ¬
                (the new_text & character x of the source_string) as string
        else
            set the new_text to (the new_text & this_char) as string
        end if
    end repeat
    return the new_text
end change_case
———

set the_command to “mdfind -onlyin ~/Desktop/ "kMDItemContentTypeTree = ‘*public.image*’wc"”
set text_return to (do shell script the_command)
set returned_list to text_to_list(text_return, return)
set totaltext to {}
repeat with an_image in returned_list
    try
        set this_file to (an_image as string)
        set small_file to change_case(this_file, 0)
       
        if (small_file ends with “png”) or (small_file ends with “gif”) or (small_file ends with “jpg”) or (small_file ends with “tiff”) then
            set totaltext to totaltext & this_file
        end if
        —display dialog this_file
    on error errorstr
        display dialog errorstr
    end try
end repeat

if (totaltext is not equal to “”) then
    tell application “iPhoto”
        import from totaltext
    end tell
end if

Jun
15th
Fri
permalink
permalink
A very alpha version of Shareyourfotos, “photos meet social network”.
A very alpha version of Shareyourfotos, “photos meet social network”.