getting text of clipping
getting text of clipping
- Subject: getting text of clipping
- From: doug rogers <email@hidden>
- Date: Mon, 25 Apr 2005 17:41:50 -0400
Noted wizards Martin Orpen and Gnarlodious posted some Wicked scripts
recently to get text out of clippings.
In my blunderings through xCode in an attempt to build an application
to send a paragraph delimited text list to iCal, I have had some
success with Applescript, but - honestly- writing the save using 'call
method' has been deeply vexing, using the online documentation is like
being dropped into the woods and looking for a trail of crumbs. and
adapting the Plain Text Editor sample is overkill. - simply, how do I
change the name from Plain Text Editor? delete unnecessary resources?
Any book on xCode and such will need to be real hand-holder for us 50
plus Hypercard folks. Anyway...
And what moron decided Stickies wouldn't be scriptable?
I want to drop a text clipping from Stickies onto a folder using Folder
Actions and get the text into a variable which I *can* get into iCal as
To Do items. Martin posted this script which gets all the text out of a
clipping:
set foo to choose file
set bar to quoted form of (POSIX path of foo & "/rsrc")
set clipText to do shell script "strings " & bar
set AppleScript's text item delimiters to "FISH"
set theText to text item 1 of clipText
and Gnarly followed up with the far more arcane - (to a Hufflepuff
first year)
property devToolsPath : "/Developer/Tools/" -- path to Apple Developer
Tools
set theFile to "hfsPathToClipping"
set clipPath to quoted form of POSIX path of theFile
set cmd to devToolsPath & "DeRez -e -only 'TEXT' " & clipPath & " | grep
'\\/\\* .* \\*\\/' | sed 's/^.*\\/\\* //;s/ \\*\\/$//' | tr -d '\\n'"
set theText to do shell script cmd
Which i understand does something marvelous to theFile to make theText.
Except I can't find a reference in the deep dark woods to
hfsPathToClipping, which I suspect gets the file to be parsed. Does it
indeed do the same thing as 'set foo to choose file'? anyway...
so, I have this, so far, which doesn't work:
property devToolsPath : "/Developer/Tools/" -- path to Apple Developer
Tools
on adding folder items to this_folder after receiving theFile
set theFile to "hfsPathToClipping" -- do I need to do this even?
set clipPath to quoted form of POSIX path of theFile
set cmd to devToolsPath & "DeRez -e -only 'TEXT' " & clipPath & " |
grep '\\/\\* .* \\*\\/' | sed 's/^.*\\/\\* //;s/ \\*\\/$//' | tr -d
'\\n'"
set theText to do shell script cmd
tell application "iCal"
launch
repeat with m from 1 to (count of paragraphs of theText)
set NewToDo to make new todo at end of todos of calendar 1 with
properties ¬
{due date:(current date), priority:3, summary:(paragraph m of
theText)}
end repeat
end tell
--delete theFile
end adding folder items to
There is a crack in everything. That's how the light gets in.
__________<http://home.golden.net/~samu>__________
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden