• 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: Fri, 20 Dec 2013 10:27:25 +0100

Oops, as I received Alex messages as personal ones I answer to him.
I discovered the message sent thru the forum this morning.


It seems that speaking of eastern languages was unclear.
Testing Chinese, Japanese or Korean would be fine.
In Japanese the grabbed localized string is "デスクトップ 1 へ切り替え" so I'm not sure that testing the contents of the rows beginning with ""デスクトップ " is returning tha wanted result, which the count of rows starting with that AND ending with " へ切り替え"
The problem is the same for Chinese and Corean.
For Russian it seems that there is no problem, the localized string is : "Перейти на Рабочий стол 1" so extracting the rows starting with "Перейти на Рабочий стол " is OK

For Arabian an Hebrew if I understand well, I must drop what appears before the first space and test the end of rows, not the beginning.

At this time the posted script is supposed to fail with Arabian and Hebrew. I will edit it tomorrow.

All that is supposed to be run under Mavericks. For Robert the main problem is that Mavericks doesn't allow it to apply upon « other » application.
As I wrote, 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.
Robert is allowed to include … but the script is not allowed to apply upon the external target.
He sent an additional information :  the script(app) never fails when run from Smile only when double clicked from (for example) the desktop.
My understanding is that when he run the script from Smile, it's the same tah when I run it from AppleScript Editor, the calling application is the editor which is permitted to apply upon external applications.


Yvan KOENIG (VALLAURIS, France) vendredi 20 décembre 2013 10:27:21




Le 19/12/2013 à 22:34, Alex Zavatone <email@hidden> a écrit :

Would you like us to try anything with that script, Yvan?

If so, which languages and operating systems would you like us to test it on and what would you like us to do?

Cheers.

On Dec 19, 2013, at 4:11 PM, koenig.yvan wrote:

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

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>)
 >Re: Access for Applescripts (From: "koenig.yvan" <email@hidden>)
 >Re: Access for Applescripts (From: Alex Zavatone <email@hidden>)

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