<no subject>

Michael Terry formido at mac.com
Thu Feb 27 21:03:01 PST 2003


Next in a a continuing stream of quickie scripts that others might be able
to use or perhaps glean something useful. Today I needed to make some
flashcards for my Art History class, and I already had all the piece¹s
titles, dates, and such in OO, so I wrote this script to act on the
currently selected row (and more specifically, the cell in the ³Topic²
column. In my case, the info was separated by a space and semicolon (like
so: ³; ³), so I wrote the script with that in mind. You could, of course,
change this easily enough by changing the text item delimiters line.

The script also takes the pieces title, makes an appropriate file name out
of it, and puts it on the clipboard so that when I download the thumbnail
for it, I could paste its name in the save dialog.

You need the latest beta to use the selected row property of OO.

Mike

PS - IŒll put in my 2 cents, or possibly 2 bits, on the current discussion
in due course.

property googleImageSearchURL :
"http://images.google.com/images?hl=en&lr=&ie=ISO-8859-1&safe=off&q="

on run
    tell application "OmniOutliner" to tell front document
        set imageDescriptor to my getCellValue(selected row, "Topic")
    end tell
    set imageURL to makeURL(imageDescriptor)
    openInExplorer(imageURL)
    setClipboard(imageDescriptor)
end run

on setClipboard(imageStr)
    set AppleScript's text item delimiters to "; "
    set imageStr to imageStr's text items's item 2
    try
        set imageStr to text 1 thru 27 of imageStr
    end try
    tell application (path to frontmost application as text)
        activate
        set the clipboard to imageStr & ".jpg"
    end tell
end setClipboard

on openInExplorer(imageSearchResults)
    tell application "Internet Explorer"
        Activate
        tell AppleScript to log imageSearchResults
        OpenURL imageSearchResults toWindow -1
    end tell
end openInExplorer

on makeURL(imageStr)
    set AppleScript's text item delimiters to "; "
    set imageStr to text items 1 thru 2 of imageStr
    set AppleScript's text item delimiters to "+"
    set imageStr to imageStr as string
    googleImageSearchURL & imageStr
end makeURL

on getCellValue(x, y)
    tell application "OmniOutliner"
        repeat with i in (get cells of x)
            if i's column's title is y then return i's value
        end repeat
    end tell
end getCellValue


-------------- next part --------------
An HTML attachment was scrubbed...
URL: /mailman/archive/omnioutliner-users/attachments/20030227/c6873a4e/attachment.html


More information about the OmniOutliner-Users mailing list