 |
 |
New to applescript - will this break my Tibook?
|
 |
|
 |
|
Grizzled Veteran
Join Date: Mar 2003
Location: London/Plymouth, England
Status:
Offline
|
|
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
|
|
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
|
|
cool thanks. can I open it in script editor without running it?
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Jun 2002
Location: UK
Status:
Offline
|
|
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.
|
|
|
| |
|
|
|
 |
|
 |
|
Moderator Emeritus 
Join Date: Mar 2001
Location: Austin, MN, USA
Status:
Offline
|
|
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.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |