Hello,
I am working on an applescript for emacs running 10.4.11 that will serve as a prompt for students using computer lab computers.
Basically my goal is to have the students agree to follow the computer lab rules.
There are two conditions I need for this applescript to work.
-
Have the applescript repeat until the answer yes is submitted by the user
-
Once the user clicks on yes the applescript will quit and the user can go about using the computer
These eMacs are running 10.4 with all of the updates.
Thank you for you help,
paulmattallen
the script so far…
set answer to button returned of question
repeat until answer is equal to "Yes"
set volume 3
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.displays"
end tell
tell application "System Events" to tell process "System Preferences"
tell slider 1 of group 2 of tab group 1 of window 1 to set value to 10
end tell
tell application "System Events"
tell dock preferences
get properties
--> Dock Controller
--> returns: {minimize effect:genie, springing delay:1.0, dock size:0.428571432829, magnification:false, springing:false, location:bottom, class:dock preferences object, magnification size:1.0, animate:true, autohide:false}
set properties to {minimize effect:scale, location:right, autohide:false, magnification:false, magnification size:1.0, dock size:0.5}
end tell
end tell
tell application "GrowlHelperApp"
set the allNotificationsList to {"Test Connection"}
set the enabledNotificationsList to {"Test Connection"} -- ** just one turned on, the other not.
register as application "login_items_v6" all notifications allNotificationsList default notifications enabledNotificationsList icon of application "login_items_v6"
-- Send Growl Notification...
notify with name "Test Connection" title "Please follow the rules!" description "Please agree to the computer rules or you will not be allowed to use the computers." application name "login_items_10.4"
end tell
tell application "System Preferences"
quit "System Preferences"
end tell
set question to display dialog "Computers are for school projects and assignments only.
No food, chewing gum or drinks are allowed at the computers.
Once a computer is turned on, leave it on.
Do not change any of the software settings used on the computers.
Surfing the web and checking personal e-mail is prohibited.
Only print work that is related to your assignments.
Any changes or damages to the computer need to be reported to the teacher immediately." buttons {"Yes", "No"} default button 2 with icon caution with title "Do you agree to follow the computer rules?"
set answer to button returned of question
if answer is equal to "Yes" then
quit application "login_items_10.4.1"
end if
if answer is equal to "No" then
display dialog "Because you did not agree to follow the computer rules, the computer will now go to sleep." buttons {"�"} with icon stop giving up after 4
say "Because you did not agree to follow the computer rules, the computer will now go to sleep."
tell application "Finder"
sleep
end tell
end if
end repeat
Model: eMac
Browser: Safari 530.19
Operating System: Mac OS X (10.4)