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 > Mac OS X > New to applescript - will this break my Tibook?

New to applescript - will this break my Tibook?
Thread Tools
Grizzled Veteran
Join Date: Mar 2003
Location: London/Plymouth, England
Status: Offline
Reply With Quote
Sep 30, 2003, 07:22 AM
 
I have just got into wanting to write my own applescripts. I want to write one that'll do the old maintenance method from terminal -
sudo sh /etc/daily
sudo sh /etc/weekly
sudo sh /etc/monthly

I have written an applescript thus:

tell application "terminal"
tell window 1
sudo
sh /etc/daily
sudo
sh /etc/weekly
sudo
sh /etc/monthly
end tell
end tell

Will this do what I want it to, or will it eff up my computer?

I saved it as an application, so don't know how to edit it without activating it. Any ideas?
     
Senior User
Join Date: Jun 2002
Location: UK
Status: Offline
Reply With Quote
Sep 30, 2003, 07:37 AM
 
Originally posted by threestain:
I have just got into wanting to write my own applescripts. I want to write one that'll do the old maintenance method from terminal -
sudo sh /etc/daily
sudo sh /etc/weekly
sudo sh /etc/monthly

I have written an applescript thus:

tell application "terminal"
tell window 1
sudo
sh /etc/daily
sudo
sh /etc/weekly
sudo
sh /etc/monthly
end tell
end tell

Will this do what I want it to, or will it eff up my computer?

I saved it as an application, so don't know how to edit it without activating it. Any ideas?
It won't work like that.
It will tell you "sudo not defined"


Edited:
Try this:

do shell script "sudo /private/etc/daily" with administrator privileges
     
Grizzled Veteran
Join Date: Mar 2003
Location: London/Plymouth, England
Status: Offline
Reply With Quote
Sep 30, 2003, 07:49 AM
 
cool thanks. can I open it in script editor without running it?
     
Senior User
Join Date: Jun 2002
Location: UK
Status: Offline
Reply With Quote
Sep 30, 2003, 07:57 AM
 
Originally posted by threestain:
cool thanks. can I open it in script editor without running it?
just open ScriptEditor and type this in:

do shell script "/private/etc/daily" with administrator privileges

[I think you don't need `sudo' if you put the `with administrator privileges'... it's been some time I played with AppleScript.]

Then just run it... of course, you can save it...
...add the other scripts in it too: weekly, monthly.
     
Xeo
Moderator Emeritus
Join Date: Mar 2001
Location: Austin, MN, USA
Status: Offline
Reply With Quote
Sep 30, 2003, 08:22 AM
 
Originally posted by threestain:
cool thanks. can I open it in script editor without running it?
Yes, by dragging it on the Script editor icon, you can open it for editing (unless you saved it as "run only" which is a step further than just saving as an application).

However, I would simply throw it away and start over as the entire script you posted will not work. You only need 3 lines which are the one VEGAN posted, and the additional for weekly and monthly. You do not need to call Terminal or the Window.
     
   
Thread Tools
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
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:49 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2