Go Back   The macosxhints Forums > OS X Help Requests > AppleScript



Reply
 
Thread Tools Rate Thread Display Modes
Old 04-02-2012, 08:41 AM   #1
mzelman
Guest
 
Posts: n/a
Please Help- Login Script

Hi Everyone,

I was hoping somebody would be kind enough to help me out. I am new to AppleScript and am terrible with programming. I just started a new position in a school environment and am working on learning scripting, however I am on a deadline and am having a rough time figuring out how to put the script together. I have read that I might need to use shell commands to run this which is causing a great deal of confusion.

So basically, I need the script to:

1. Log in automatically when computer is not in use
2. Launch script
3. Check non administrator user folder for files not modified within the last seven days
4. If older then 7 days delete without needing password each time
5. After delete empty trash
6. Exit script
7. Restart computer

The machines are running AD and OD if that makes a difference. I have created a script to delete the folders after 7 days of no modification in one user, and believe I can just remove the specific user for it to run on all the users (didn't want to mess up the machine without knowing for sure that I can do this)

Any help would be greatly appreciated.

Thanks for any help you can provide,

Marissa

What I have:

try
tell application "Finder"
delete (every item of folder "Users:test" of startup disk whose modification date is greater than ((get current date) - 7 * days))
end tell
end try
  Reply With Quote
Old 04-02-2012, 01:55 PM   #2
leamanc
Triple-A Player
 
Join Date: Apr 2005
Posts: 157
This would all be accomplished much easier with straight shell scripts, rather than AppleScript. A shell script that is set to run via launchd or cron would not require a user to be logged into the GUI.

Google for bash scripts that perform the 7-day delete function that you want to do. The Unix FAQ on this forum will get you set up on how to write bash scripts and make them executable. Some additional Googling for how to automate script exeuction via launchd or cron will be the last part.
leamanc is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting 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

Forum Jump



All times are GMT -5. The time now is 05:21 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.