MACSCRPT Archives

October 2011

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Mark Lively <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Mon, 10 Oct 2011 16:20:01 +0000
Content-Type:
text/plain
Parts/Attachments:
text/plain (27 lines)
On Oct 10, 2011, at 11:16 AM, Emmett Gray wrote:

> On Sun, 9 Oct 2011 02:43:43 +0000, Mark Lively <[log in to unmask]> wrote:
>> 
>> On Oct 8, 2011, at 3:26 PM, Emmett Gray wrote:
>> 
>>> I have the following script to shut down a bank of machines. It runs from the editor but not when saved as a script or app. It also runs as a QuicKeys script, so that's my workaround. But why? TIA.
>>> 
>>> set machNum to "11"
>>> repeat 7 times
>>> 	set machNum to (machNum + 1) as string
>>> 	set remoteMachine to "eppc://pge:[log in to unmask]" & machNum
>>> 	using terms from application "Finder"
>>> 		tell application "Finder" of machine remoteMachine to shut down
>>> 	end using terms from
>>> end repeat
>> 
>> I didn't think you could call shut down remotely.
>> 
>> Do you get an error or a not running?  Have you tried throwing in dialogs?
> 
> No error, so I didn't bother throwing in a dialog. How can you trap an error if there is none? On a hunch I also tried setting the ownership to root (chmod -R 0:0) but that didn't have any effect. Since I have a workaround, I'm not in need. But I'd like to know what's going on. Has anyone else seen this behavior with any other AppleScript - i.e., it will run from the Editor but not as a saved script or app?

Usually, in my experience it's a case of it not actually running.  There is a flag on AppleEvents (the messaging system underlying AppleScript saying where the message is coming from and apps can refuse requests from certain sources.  I am a bit rusty on this since it's almost never implemented. 

-Mark
setEventInteraction(kAEInteractWithSelf); {I think I did that right, oPascal rules!}

ATOM RSS1 RSS2