Hello
If you don't want to apply the trials scheme every time, you may use these scripts.
The first one allows you to grab the exact scale value which you defined one by the trials scheme.
--{code}
--[SCRIPT get_Scale_value]
(*
Here the code is in it's extended shape to show the way I got the infos allowing me to build it
Yvan KOENIG (VALLAURIS, France)
2011/10/20
*)
property workInProgress : false
(*
true = activate the instructions grabbing informative infos
false = drop the instructions grabbing informative infos
*)
on run
local the_window, previewIsActive, currentValue
tell application "Numbers" to activate
tell application "System Events" to tell application process "Numbers"
set the_window to name of first window whose subrole is "AXStandardWindow"
tell windowthe_window
if workInProgress then class of every UI element
(*
{button, button, button, splitter group, pop up button, pop up button, static text, color well, checkbox, checkbox, checkbox, checkbox, checkbox, checkbox, checkbox, checkbox, checkbox, checkbox, checkbox, checkbox, checkbox, menu button, button, button, menu button, pop up button, image, static text, tool bar, button, image, static text, grow area}
*)
tell first splitter group
if workInProgress then class of every UI element
--> {splitter group, splitter, splitter group}
if workInProgress then class of every UI element of first splitter group
--> {scroll area, splitter, scroll area, scroll area} not for us !
if workInProgress then class of every UI element of last splitter group
--> {splitter group, splitter, scroll area} It's ours !
tell last splitter group
if workInProgress then class of every UI element
--> {splitter group, splitter, scroll area}
tell first splitter group
if workInProgress then class of every UI element
--> {scroll area, scroll area}
if workInProgress then class of every UI element of first scroll area
--> {text area, scroll bar}
class of every UI element of last scroll area
(*
--> {UI element, scroll bar, scroll bar, UI element, UI element, pop up button, button} it's ours but don't show Preview
or
--> {UI element, scroll bar, scroll bar, UI element, UI element, pop up button, button, slider, group} it's ours showing Preview
*)
set previewIsActive to result contains slider
end tell -- first splitter group
end tell -- last splitter group
end tell -- first splitter group
end tell -- Window
(*
If needed, trigger "Show Preview before Print" *)
if not previewIsActive then
tell menu bar 1 to tell menu bar item 9 to tell menu 1 to click menu item 1
end if
tell window the_window to tell first splitter group to tell last splitter group to tell first splitter group to tell last scroll area
repeat
if (get class of every UI element) contains slider then exit repeat
end repeat
set currentValue to get value of first slider
--> 0.456789
end tell
end tell -- System Events
set the clipboard tocurrentValue as text
activate
if my parleAnglais() then
display dialog "The scale value : " & currentValue & " is in the clipboard."
else
display dialog "L’échelle : " & currentValue & " est dans le presse-papiers."
end if
end run
--=====
on parleAnglais()
local z
try
tell application "Numbers" to set z to localized string "Cancel"
on error
set z to "Cancel"
end try
return (z is not "Annuler")
end parleAnglais
--=====
--[/SCRIPT]
--{code}
Store this scale value in a safe area to be able to reuse it.
The next time you will want to reuse the same setting, run the second script and type the scale value.
The script will apply this exact value to the document.
--{code}
--[SCRIPT set_Scale_value]
(*
Yvan KOENIG (VALLAURIS, France)
2011/10/20
*)
if my parleAnglais() then
set maybe to display dialog "Type the scale to apply" default answer (0.456789 as text)
else
set maybe to display dialog "Saisir l’échelle à appliquer" default answer (0.456789 as text)
end if
set the_scale to (text returned of maybe) as number
tell application "Numbers" to activate
tell application "System Events" to tell application process "Numbers"
set the_window to name of first window whose subrole is "AXStandardWindow"
tell window the_window to tell first splitter group to tell last splitter group to tell first splitter group
set previewActive to class of every UI element of last scroll area contains slider
end tell -- Window
if not previewActive then
tell menu bar 1 to tell menu bar item 9 to tell menu 1 to click menu item 1 --Show Preview before Print
end if
tell window the_window to tell first splitter group to tell last splitter group to tell first splitter group to tell last scroll area
set value of first slider to the_scale
end tell
end tell -- System Events
--=====
on parleAnglais()
local z
try
tell application "Numbers" to set z to localized string "Cancel"
on error
set z to "Cancel"
end try
return (z is not "Annuler")
end parleAnglais
--=====
--[/SCRIPT]
Yvan KOENIG (VALLAURIS, France) jeudi 20 octobre 2011 12:44:27
iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.0
My iDisk is : <http://public.me.com/koenigyvan>
Please : Search for questions similar to your own before submitting them to the community