Re: Changing screen resolutions - updated
Re: Changing screen resolutions - updated
- Subject: Re: Changing screen resolutions - updated
- From: Paul Thompson <email@hidden>
- Date: Fri, 9 Jul 2004 09:21:35 -0400
Hi Jason,
Thank you very much for this. It worked great. I have so much to
learn.
Thanks once again,
Paul
On Thursday, July 8, 2004, at 05:28 PM, Jason Kacmarski wrote:
Paul,
You should've mentioned you were trying to change colors as well (or
maybe you did and I missed it). Anyway, the script I posted was
actually an excerpt from a script I wrote for someone on the
AppleScript discussion boards to change colors (depth) and resolution.
Here it is with the launching of Classic tacked onto the end. You
can edit the values passed to "SwitchPrefs" to whatever you need but I
think it's set how you want it. Also, there's some code at the end
which tries to dismiss some dialog boxes that you may or may not have
to deal with. I think the person I wrote this for was using a CRT and
that might have been causing the errors for her. But whether they're
there for you or not, the extra code shouldn't cause any problems.
tell application "System Preferences"
activate
set the current pane to pane "com.apple.preference.displays"
end tell
my SwitchPrefs("Thousands", "1024 x 640")
tell application "Classic Startup" to activate
on SwitchPrefs(newColor, newRes)
tell application "System Events"
tell process "System Preferences"
tell tab group 1 of window 1
click radio button "Display"
tell group 1
tell pop up button 1
if value is not newColor then
click
click menu item newColor of menu "OtherViews"
end if
end tell
tell table 1 of scroll area 1
repeat with x from 1 to count of rows
if selected of row x is true then
set currentValue to value of text field 1 of row x
exit repeat
end if
end repeat
if currentValue is not newRes then
repeat with i from 1 to count of rows
if value of text field 1 of row i is newRes then
set selected of row i to true
exit repeat
end if
end repeat
end if
end tell
end tell
end tell
try
tell window 1 to click button "OK"
delay 1
tell window 1 to click button "Confirm"
end try
end tell
end tell
tell application "System Preferences" to quit
end SwitchPrefs
Hope this does the trick.
Jason
On Jul 8, 2004, at 3:59 PM, Paul Thompson wrote:
Hi Everyone,
I have made progress on my script to change screen resolutions,
thanks to the help from Jason Kacmarski. My script as it now stands
will change the resolution of the screen, but I still am having
trouble
getting it to change the colours. After that I have it launch
classic,
and then the program the kids will use. I think that where I'm going
wrong is that way I'm trying to manipulate the change for the colours,
and not understanding how to write and if/then statement for classic
to
check whether it is running or not.
If someone out there might have a moment to perhaps give me a push
in
the right direction for what I'm doing wrong, I would greatly
appreciate it.
Thank you,
Paul
Here is the script currently, with what I learned by using
UIElementInspector
tell application "System Preferences"
activate
set the current pane to pane "com.apple.preference.displays"
end tell
tell application "System Events"
tell process "System Preferences"
tell tab group 1 of window 1
click radio button "Display"
tell group 1
tell table 1 of scroll area 1
repeat with i from 1 to count of rows
if value of text field 1 of row i is "1024 x 640" then
set selected of row i to true
end if
end repeat
end tell
tell table 1 of pop up button 1
repeat with i from 1 to 3
if value of pop up button 1 of text field i is "Thousands" then
set selected of row i to true
end if
end repeat
end tell
end tell
end tell
end tell
end tell
tell application "System Preferences"
activate
set the current pane to pane "com.apple.preference.classic"
end tell
tell application "System Events"
tell process "System Preferences"
tell tab group 1 of window 1
click radio button "Start/Stop"
click button "Start"
end tell
end tell
end tell
Using the UIElement Inspector, I found out that button for the color
is
listed as a pop up button:
<AXApplication: System Preferences>
<AXWindow: iMac>
<AXTabGroup>
<AXGroup>
<AXPopUpButton>
<AXMenu: OtherViews>
<AXMenuItem: Thousands>
Attributes:
AXRole: AXMenuItem
AXRoleDescription: menu item
AXChildren: (null)
AXParent: <AXMenu: OtherViews>
AXTitle: Thousands
AXEnabled: 1
AXPosition: x=707 y=191
AXSize: w=185 h=19
AXSelectedChildren: <array of size 0>
AXVisibleChildren: <array of size 0>
AXHelp: (null)
AXMenuItemCmdChar:
AXMenuItemCmdVirtualKey: (null)
AXMenuItemCmdGlyph: (null)
AXMenuItemCmdModifiers: 0
AXMenuItemMarkChar:
Actions:
AXCancel - cancels menu tracking
AXPick - selects a menu item
AXPress - selects a menu item
I also found out that the start button for classic seems to have a
value of one, whether it is started or stopped. Is this because there
is only one option at any given time?
<AXApplication: System Preferences>
<AXWindow: Classic>
<AXTabGroup>
<AXButton: Start>
Attributes:
AXRole: AXButton
AXRoleDescription: button
AXHelp: (null)
AXEnabled: 1
AXFocused (W): 0
AXParent: <AXTabGroup>
AXWindow: <AXWindow: Classic>
AXPosition: x=49 y=388
AXSize: w=108 h=33
AXTitle: Start
Actions:
AXPress - press
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.