PDA

View Full Version : trying to automate sleep


macfeller
02-28-2005, 08:00 PM
I have a couple applescripts that work in isolation. One is just to tell Finder to sleep. The other tells SD to quit and then Finder to sleep. The latter I got the idea from a thread on VersionTracker referring to an error that that person's script wouldn't work because it SD wouldn't quit. With each script, when put into the options pane and SD run, I get the following error in the log.

|05:23:50 PM|Error| ## Component Manager: attempting to find symbols in a component alias of type (imdc/IV32/intl)

Any ideas? I can't wait for version 2.

mf

dnanian
02-28-2005, 08:12 PM
Well, mf, that particular error just looks like something that gets sent to the console, and not an error in SD! as such (in either case, it's not an SD! error but a scripting problem).

I don't have enough information here, though, to diagnose. Where exactly are you putting these commands? Are they in a shell script and set in the "Customization Script" part of options? (They have to be...)

Can you run that shell script by hand?

A bit more info and I should be able to point you to a solution...

dnanian
02-28-2005, 10:43 PM
By the way, an error like that indicates a problem with a QuickTime component installed in /Library/QuickTime... any 3rd party entries in there, from DiVX for example? (it looks like it is supposed to deal with AVI files)

macfeller
03-01-2005, 01:12 PM
Well, mf, that particular error just looks like something that gets sent to the console, and not an error in SD! as such (in either case, it's not an SD! error but a scripting problem).

For sure not SD!, didn't mean to imply. The line was copied from SD!'s log.

[QUOTE=dnanian]I don't have enough information here, though, to diagnose. Where exactly are you putting these commands? Are they in a shell script and set in the "Customization Script" part of options? (They have to be...)

It is an AppleScript saved as a Run Only Application. Not a shell script. It is set Run customization script in the Options pane.

[QUOTE=dnanian]Can you run that shell script by hand?

It runs in Applescript Studio and it runs stand-alone. That is, I can select it in Finder, double-click it, and it does what I want. My first attempt was such a script merely telling Finder to sleep. It worked fine but I got the same error. I gave up until I noticed the other thread here about shell scripts and someone's script not working because it couldn't get SD! to quit. So, I added that to the script. (Well, I saw this particular point in VersionTraker, I think.)

[QUOTE=dnanian]A bit more info and I should be able to point you to a solution...

Below is the text from the script. Initially saved as an Application in AS Studio it would not run by double-clicking (error said "Connection is Invalid."). When saved as Run Only as Application, when double-clicked it quits SD! and then puts the machine to sleep. But when called on by SD! via Run custom script, the error occurs.

Dang! I just double-clicked it and it gave the Connection is Invalid. Being as I am I immediately double-clicked it again and it ran. I wonder if that has anything to do with it. I think I'll head for some Applescript forums. When messing with the script saved as Application (Run only not checked in dialog window) every single attempt gave the Connection is Invalid. Only once has a trial of the Run Only save gave that error.

Don't spend too much time onme. I can wait for v.2 to come out. And now the text, clearly nothing fancy!

tell application "SuperDuper!"
quit
end tell
tell application "Finder"
sleep
end tell

dnanian
03-01-2005, 09:22 PM
Yes, quite simple... the error definitely seems to be in a QuickTime component, though... maybe you missed the request above: could you provide a list of what's in /Library/QuickTime?

macfeller
03-01-2005, 10:09 PM
Yeah, I read it and then forgot it. Sorry.

in /Library/QuickTime are
FLAC_Decoder.component
OggVorbis.component
Toast Video CD Support
ToastVideoCDSupport.component

there is no ~/Library Quicktime

in /System/Library/QuickTime
ApplePixletVideo.component
QuickTime Updater
QuickTime3GPP.component
QuickTimeBMPUpdate.component
QuickTimeComponents.component
QuickTimeFirewireDV.component
QuickTimeIIDCDigitizer.component
QuickTimeMPEG.component
QuickTimeMPEG2.component
QuickTimeMPEG4.component
QuickTimeStreaming.component
QuickTimeVR.component

dnanian
03-01-2005, 10:18 PM
OK. Let's try moving the four components in /Library/QuickTime to a folder on your desktop and rebooting. See if that resolves the problem. If so, add them back one at a time until you get a failure... and when you do, that's the conflicting component...

(I'm guessing it's going to be one of the Toasts...)

macfeller
03-01-2005, 11:10 PM
So I go ahead and just try without the 2 Toasts. Curioser and curioser. WHen SD! gets to the point where it says it's invoking custiom script it stops and drops a sheet twith the following query:

SuperDuper! has not finished preparing the target volume.
Stopping now will leave BACKUP in an unknown state. Are you sure you want to Stop? Yes No [buttons]

Choosing No has SD! finishing and quitting, then nothing. Script is not invoked, but at least nothing like original issue. I ran it a second time so i could get the exact wording of the sheet. That time, by the time I finished copying the text I see the AppleScript icon bouncing in the Dock. I get an AppleScript error saying event has timed out. So I wonder if that happened the first time and I just missed it. No, I have tried two more times and each time I get the SD! message and nothing in the Dock. I don't know what happened that one time. Just tried again coz the AS occurence bothered me and this time it did appear but the AS error was Application not running. The only consisten thing has beed SD! pausing to give the sheet.

I'm going to bed. I don't even care about this feature all that much.

macfeller
03-01-2005, 11:21 PM
Took a quick look at the log.

|09:04:28 PM|Info| ...ACTION: Execute Site Customization Script /Applications/Sleep.app
|09:04:28 PM|Info| ......COMMAND => Invoking site customization script: /Applications/Sleep.app
|09:04:54 PM|Info| Copy complete.
[---] Session ended: Tuesday, March 01, 2005 09:04:54 PM US/Central

So it looks like it calls the script before it "finishes" copying. That would explain getting the sheet when I do. The script runs and wants to sleep the machine. SD! asks me if i really want to do this. So, perhaps the 2 times I got the AS errors the script ran but since SD! was waiting for a response (and therefore not responding to anything else, such as a script) it did give the error about time out, not sure about Application not running.

Whatever, it seems that SD! does not have the script run "After copy" as the Options pane section says, but rather it runs the script right before it completes the copy.

dnanian
03-01-2005, 11:27 PM
OK, now that makes sense, actually!

The reason you're seeing that sheet is that the script you're running is trying to Quit SD! while it's still running ... your script!

If you remove that part, the normal SD! Daily Backup script will quit SD! when you wake from sleep.

Alternatively, you can run the command asynchronously, waiting for SD! to finish before quitting -- that's what Daily Backup does. But it's really not necessary since we already do it for you.

Hope that makes some sense to you!

dnanian
03-01-2005, 11:45 PM
Actually, it does callnthe script after the physical copy is finished -- but the whole operation isn't done...just the copy.

macfeller
03-02-2005, 03:28 PM
Yep, I do get it. Might keep playing with it. Main reason it's a problem is my machine is one of those PowerBooks with the notorious failure to sleep via Energy Saver Preference Pane setting.

Thanks for everything!

dnanian
03-02-2005, 06:02 PM
Yeah, totally understood... just doing the sleep should handle it!