Morton Goldberg
8/18/2007 6:04:00 AM
On Aug 17, 2007, at 10:23 PM, Vasil Vangelovski wrote:
> a workaround for this:
> 1. Execute applescript in shell command
> 2. Execute shell command in ruby
>
> Examle:
>
> [code]
> Applescript:
>
> tell application "Finder"
> delete file "Untitled.rtf"
> delete file "untitled2.rtf"
> end tell
>
> Ruby:
> command = "osascript -e 'tell application "Finder" to delete file
> "untitled.rtf"' -e 'tell application "Finder" to delete file
> "untitled2.rtf"'"
> system (command)
> [/code]
>
> That will execute the string in command inthe shell.
> I couldn't test it but hope it works.
Yeah, I could do that. But it would kind of spoil the fun. As I see
it, the whole idea of the appscript library is make the sort of thing
you suggest unnecessary. The appscript library works pretty good for
replacing the AppleScript I tend to use. I much prefer writing
<code>
require "appscript"
include Appscript
finder = app('Finder')
finder.count(finder.desktop, :each => :file) # => 2
finder.disks[its.local_volume.eq(true)].get.size # => 3
</code>
to
</code>
tell app "Finder"
set onDesk to count desktop's files
set drives to (disks whose local volume is true)
set drives to drives's length
{onDesk, drives}
end tell
</code>
I just wish I knew how to access the the standard scripting additions.
Regards, Morton