Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Newer than a newbie

Newer than a newbie
Thread Tools
yafreax
Guest
Status:
Reply With Quote
Oct 9, 2000, 02:54 PM
 
okay, i've never had a reason to even look at applescript until now. I've done a little background on it to familiarize myself. Here's my question...

I need a script that can check to see if a program is open or not. and if not i'll need the computer to restart. In addition, i need a script to run each time the computer is rebooted to open some files. Can any of this be done? and how? (in case you're wondering, the application that is checking for is Filemaker 5.0)

Thanks
Jeremy
(Please keep in mind that i know basically nothing about applescripting)
     
Blobby
Guest
Status:
Reply With Quote
Oct 9, 2000, 09:11 PM
 
to check for the app and restart�
Code:
set appName to "Filemaker Pro" tell application "Finder" to set currentApps to name of processes if appName is not in currentApps then display dialog "Are you sure you want to Restart the computor?" buttons {"Cancel", "Restart"} � default button "Restart" set the theResult to the button returned of the result if the theResult is "Restart" then tell application "Finder" restart end tell
to make a script to open files at startup use the Script Editor to record the opening of the files and save as an application checking the 'never show startup screen' option, place the saved applet in the Startup items folder of the System folder.
have fun!
     
yafreax
Guest
Status:
Reply With Quote
Oct 10, 2000, 09:27 AM
 
Thanks for the quick response.

okay, most of the above worked fine. But i need the script to restart the computer automatically because i might not be here when Filemaker goes down. So i modified the script to say this:

set appName to "Filemaker Pro"
tell application "Finder" to set currentApps to name of processes
if appName is not in currentApps then tell application "Finder"
restart
end tell

(makes since to me) but i get the message that the computer cannot restart because one of the programs will not quit. The only program i have running at the time is AppleScript. Again, still know nothing about the actual syntax of AppleScript so if it's a common rule i'm breaking, just make fun of me.

On a side note, does it matter if i save the Open files script as a Classic Applet or a Mac OS X Applet?

Thanks again
Jeremy
     
tonymac
Dedicated MacNNer
Join Date: May 2000
Location: Chattanooga, TN
Status: Offline
Reply With Quote
Oct 10, 2000, 09:57 AM
 
If you're using OS 9 with the CarbonLib installed, then it really doesn't make a difference. When/if you upgrade to OS X, the Carbon (OS X) versions will be able to run with out starting up Classic.
     
Blobby
Guest
Status:
Reply With Quote
Oct 11, 2000, 12:14 AM
 
Are you running the app check as an Applet? if so try a compiled script.
Get one of the freeware process tools such as ProcessGuard or ProcessInfo and see what invisible background applications may be refusing to quit.
     
yafreax
Guest
Status:
Reply With Quote
Oct 12, 2000, 07:12 PM
 
okay, everythings good. Now a new problem (probably real easy again)

How can i get the script to loop to run like every 30 minutes or so. That way, this thing is really automated.

Thanks for all the help
Jeremy
     
jcarr
Senior User
Join Date: Dec 1999
Location: Bar Harbor
Status: Offline
Reply With Quote
Oct 27, 2000, 12:58 PM
 
Originally posted by yafreax:
How can i get the script to loop to run like every 30 minutes or so. That way, this thing is really automated.
Install the iDo script scheduler. It's in the CD Extras folder on your Mac OS 8.5 (or higher) CD, or get it off the web.

------------------
I'm cookoo for Cocoa Apps!
I'm cookoo for Cocoa Apps!
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 10:27 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,