Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: How to access certain system-data?





Begin forwarded message:

From: Peter Baxter <email@hidden>
Date: 18 September 2006 1:57:28 PM
Subject: Re: How to access certain system-data?

Given that I don't know what it is you want to do it's a bit hard to write a script, but here is a better basis to write your script using GUI than the first one.  Personally, I think you should find the UNIX script for the task you want to do as it will be much more reliable.  Here is the basis for your script anyway with the action missing.

tell application "System Preferences"
activate

tell application "System Events"
if UI elements enabled then
--checks that ui devices is enabled or the whole thing won't work
try
tell application process "System Preferences"
set frontmost to true
click menu item "Energy Saver" of menu "View" of menu bar 1
end tell
tell application process "System Preferences"
(*Do whatever it is you want to do here using GUI
an example I have in another script that wont ;work here is: "set value of slider 5 of group 3 to 900".  You will have to work out the location of the slider and group you wish to change*)

end tell
end try
else --GUI scripting is disabled
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.universalaccess"
end tell
display dialog "Please check the box called \"Enable access for assistive devices.\"" buttons {"Okay"} with icon 1 default button 1
end if
end tell
end tell





Peter
On 18/09/2006, at 8:07 AM, Peter Baxter wrote:

What are you trying to do Holger?

You can access data quite easily through scripts like the ones below, and you can manipulate then in the same way through shell scripts.  Sites like http://www.osxfaq.com/Tutorials/LearningCenter/ can help you find shell scripts to alter your data and you can then write apple scripts to achieve what you want.  Otherwise you can use applescripts to open the preference pane and select data on the pane.



set PDT to (do shell script "system_profiler SPPowerDataType")

or this one

tell application "Finder"
do shell script "ioreg -w0 -l | grep Capacity"
end tell
Network
--Initial Steps:  You would start using UI Scripting to press the buttons you choose to set your changes:
tell application "System Preferences" to activate
tell application "System Events"
tell application process "System Preferences"
click button "Energy Saver" of scroll area 1 of window "System Preferences"
delay 1
(*tell it which buttons you want pressed and contiue to set your preference savings*)
end tell
end tell




On 18/09/2006, at 6:39 AM, Holger Pleus wrote:

Hello list!

I wonder, how to access and manipulate certain system-data, particularly the data, the "energy-saving" pane puts into the system.
I found "Library:Preferences:SystemConfiguration:com.apple.AutoWake.plist" and this seems to be the target, i'm looking for. I really don't know, where to begin, but am willing to learn. Could anyone help me out?

Holger
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-studio mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-studio mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-studio mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-studio/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.