• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Access for Applescripts
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Access for Applescripts


  • Subject: Re: Access for Applescripts
  • From: "koenig.yvan" <email@hidden>
  • Date: Thu, 19 Dec 2013 22:11:18 +0100

Hello

Robert Poland sent me one of the offending script.

Here is a part of this one for two reasons :

(1) I wish to know how it behaves when executed on eastern languages because I'm not sure that the scheme which I use to extract the key string identifying the entries interesting Robert behave well with these languages. I have used a quick and dirty code to trigger the correct row — Mission Control one – because it's row 2 on my French iMac but row 3 on Robert's one.

(2) It would be fine to save it as an application and run it at least under English speaking machines.
I'm puzzled because Robert get a behavior different than the one which I get here.
Here I'm urged to include the app in the list of applications having permission to apply upon an other one and when I do that, the app is really allowed to apply.

—[SCRIPT]
tell application "System Preferences"
set switchTo_loc to localized string "Switch to Space 1" from table ¬
"DefaultShortcutsTable" in bundle file ((path to system folder as text) & "Library:PreferencePanes:Keyboard.prefPane:")
end tell
# Keeps only the string before the digit 1
set switchTo_loc to item 1 of my decoupe(switchTo_loc, "1")

tell application "System Preferences"
activate
reveal anchor "shortcutsTab" of pane id "com.apple.preference.keyboard"
end tell # application "System Preferences"

tell application "System Events"
activate
tell process "System Preferences"
tell window 1 to tell splitter group 1 of tab group 1
tell table 1 of scroll area 1
# Code identifying the entry entitled "Mission Control"
set theRow to 0
repeat with r from 1 to count rows
if name of first static text of row r is "Mission Control" then
set theRow to r
exit repeat
end if
end repeat
if theRow > 0 then
# select the correct row (2 in French, 3 in English)
select row theRow
else
error "There is no Mission Control entry !"
end if
end tell
set numSpaces to count (UI elements of rows of outline 1 of scroll area 2 whose name begins with switchTo_loc)
end tell # "Keyboard"
end tell # process "System Preferences"


# tell application "System Preferences" to quit


end tell # System Events

#=====

on parle_anglais()
return (do shell script "defaults read 'Apple Global Domain' AppleLocale") does not start with "fr_"
end parle_anglais

#=====

on decoupe(t, d)
local oTIDs, l
set {oTIDs, AppleScript's text item delimiters} to {AppleScript's text item delimiters, d}
set l to text items of t
set AppleScript's text item delimiters to oTIDs
return l
end decoupe

#=====
—[/SCRIPT]

Yvan KOENIG (VALLAURIS, France) jeudi 19 décembre 2013 22:07:44



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Access for Applescripts
      • From: Alex Zavatone <email@hidden>
References: 
 >Access for Applescripts (From: Robert Poland <email@hidden>)
 >Re: Access for Applescripts (From: "koenig.yvan" <email@hidden>)
 >Re: Access for Applescripts (From: Robert Poland <email@hidden>)

  • Prev by Date: Re: Mail returns empty mailboxes in Mavericks
  • Next by Date: Re: Access for Applescripts
  • Previous by thread: Re: Access for Applescripts
  • Next by thread: Re: Access for Applescripts
  • Index(es):
    • Date
    • Thread