update 10.1.2後,AppleScript內的say statement,總是沒有了最頭大約5 second。不只一條script有此問題! [img]images/smiles/icon_confused.gif[/img]
但又會不會是Dec DeveloperTools才是問題呢?我是一起update的!
[ 12-23-2001: 留言編輯者: 真理士 ]
OS X 10.1.2下的AppleScript
版主: ross_tt、bryanchang、digdog、chester
OS X 10.1.2下的AppleScript
我發現是另外的問題作怪…
OS X 10.1.2下的AppleScript
<BLOCKQUOTE><font size="1" face="XYZ">quote
聽來,真兄似乎狂玩 AppleScript 呢!發表一些心得吧! [img]images/smiles/icon_biggrin.gif[/img]我發現是另外的問題作怪…
OS X 10.1.2下的AppleScript
沒有很多心得耶,只是玩玩greeting、bye等,嚇嚇Wintel同事。其他的不外乎做一些Windows上很簡單,已經是全自動,但Mac上要自己寫AppleScript才行的事了吧,如上網後,自己叫出ICQ、Mail等(當 然,這些缺陷不會讓他們知! [img]images/smiles/icon_razz.gif[/img] )
投訴反而有,如為何Application中沒有Hide command的? [img]images/smiles/icon_mad.gif[/img] Window中又沒有Minimize command? [img]images/smiles/icon_mad.gif[/img] Network又只有configure可以改,但竟不能叫OS X改用 Airport connect! [img]images/smiles/icon_mad.gif[/img]也不能知道現在的status? [img]images/smiles/icon_mad.gif[/img]
希望Apple會令AppleScript更齊全。可以如Unix的 script一般,幾乎沒有事情是做不到的。
[ 12-25-2001: 留言編輯者: 真理士 ]
投訴反而有,如為何Application中沒有Hide command的? [img]images/smiles/icon_mad.gif[/img] Window中又沒有Minimize command? [img]images/smiles/icon_mad.gif[/img] Network又只有configure可以改,但竟不能叫OS X改用 Airport connect! [img]images/smiles/icon_mad.gif[/img]也不能知道現在的status? [img]images/smiles/icon_mad.gif[/img]
希望Apple會令AppleScript更齊全。可以如Unix的 script一般,幾乎沒有事情是做不到的。
[ 12-25-2001: 留言編輯者: 真理士 ]
OS X 10.1.2下的AppleScript
悲兄:
強呀!無怪乎我反轉本AppleScript In A Nutshell也找不到!不過現在process放在Legacy suite內,會不會命不久焉? [img]images/smiles/icon_sad.gif[/img]
要寫log才知status也想出來,悲兄真的study了AppleScript很久了! [img]images/smiles/icon_eek.gif[/img]
強呀!無怪乎我反轉本AppleScript In A Nutshell也找不到!不過現在process放在Legacy suite內,會不會命不久焉? [img]images/smiles/icon_sad.gif[/img]
要寫log才知status也想出來,悲兄真的study了AppleScript很久了! [img]images/smiles/icon_eek.gif[/img]
OS X 10.1.2下的AppleScript
真理士兄:
about "不過現在process放在Legacy suite內,會不會命不久焉?", well, it's unknown. But you can use system events to simulate the effect :
tell application "System Events"
-- keep the following code in one line
set visible of (every process whose visible is true and frontmost is false) to false
-- keep the above code in one line
end tell
remark : same effect if you run it from script menu; hide other applications if you run by script editor.
about "Network又只有configure可以改,但竟不能叫OS X改用 Airport connect!"
though the system preferences is not scriptable; there would be two work around:
--pseudo code 1
a preference file "com.apple.internetconnect.plist" is in your preferences folder
path to preferences folder
write the necessary change to this file, save it & connect.
--pseudo code 2
change the setting in network, copy the above mentioned preferneces file to another folder.
for example you have 3 dummy preference files for 3 settings :
pre 1 -- dial by internal modem
pre 2 -- using airport
pre 3 -- using PPPoE
if connected, disconnect
rename file "pre 1"( or pre 2 or pre 3 ) to "com.apple.internetconnect.plist", move it to preferences folder replacing yes
connect
remark : guess only, try with caution.
about "嚇嚇Wintel同事"
did you show them the speech recognition?
[ 12-26-2001: 留言編輯者: 悲 ]
about "不過現在process放在Legacy suite內,會不會命不久焉?", well, it's unknown. But you can use system events to simulate the effect :
tell application "System Events"
-- keep the following code in one line
set visible of (every process whose visible is true and frontmost is false) to false
-- keep the above code in one line
end tell
remark : same effect if you run it from script menu; hide other applications if you run by script editor.
about "Network又只有configure可以改,但竟不能叫OS X改用 Airport connect!"
though the system preferences is not scriptable; there would be two work around:
--pseudo code 1
a preference file "com.apple.internetconnect.plist" is in your preferences folder
path to preferences folder
write the necessary change to this file, save it & connect.
--pseudo code 2
change the setting in network, copy the above mentioned preferneces file to another folder.
for example you have 3 dummy preference files for 3 settings :
pre 1 -- dial by internal modem
pre 2 -- using airport
pre 3 -- using PPPoE
if connected, disconnect
rename file "pre 1"( or pre 2 or pre 3 ) to "com.apple.internetconnect.plist", move it to preferences folder replacing yes
connect
remark : guess only, try with caution.
about "嚇嚇Wintel同事"
did you show them the speech recognition?
[ 12-26-2001: 留言編輯者: 悲 ]
OS X 10.1.2下的AppleScript
Hi 真理士,
try :
about "如為何Application中沒有Hide command的?" :
tell application "Finder"
activate
-- keep the following code in one line
set visible of (every process whose visible is true and frontmost is false) to false
-- keep the above code in one line
end tell
about "Window中又沒有Minimize command?" :
tell application "Finder"
try
set collapsed of every window to true
end try
end tell
for other applications, need to check their dictionaries, in order to find out if they support this event or not.
about "Network又只有configure可以改,但竟不能叫OS X改用 Airport connect!"
well, the system preferences is not scriptable at this moment. However, if the current configuration is using Airport, you can:
tell application "Internet Connect" to connect
about "也不能知道現在的status?"
analyse the log of Internet Connect, if you are using PPPoE or Airport, the log may be different, amend the script to fit your need :
tell application "Internet Connect"
set iLog to log
end tell
if paragraph -2 of iLog contains "disconnected" then
say "idle"
else if paragraph -2 of iLog contains "secondary DNS address" then
say "connected"
end if
Best Wishes
悲 [img]images/smiles/icon_sad.gif[/img]
try :
about "如為何Application中沒有Hide command的?" :
tell application "Finder"
activate
-- keep the following code in one line
set visible of (every process whose visible is true and frontmost is false) to false
-- keep the above code in one line
end tell
about "Window中又沒有Minimize command?" :
tell application "Finder"
try
set collapsed of every window to true
end try
end tell
for other applications, need to check their dictionaries, in order to find out if they support this event or not.
about "Network又只有configure可以改,但竟不能叫OS X改用 Airport connect!"
well, the system preferences is not scriptable at this moment. However, if the current configuration is using Airport, you can:
tell application "Internet Connect" to connect
about "也不能知道現在的status?"
analyse the log of Internet Connect, if you are using PPPoE or Airport, the log may be different, amend the script to fit your need :
tell application "Internet Connect"
set iLog to log
end tell
if paragraph -2 of iLog contains "disconnected" then
say "idle"
else if paragraph -2 of iLog contains "secondary DNS address" then
say "connected"
end if
Best Wishes
悲 [img]images/smiles/icon_sad.gif[/img]
OS X 10.1.2下的AppleScript
Thanks for your help. I learned something more. haven't tried yet.
In order to demostrate the speech recognization, a mic is requeired. The PowerMac G4/450 in my office does not have one. I have to bring my PowerBook back office to show it.
You know, for best effect of shocking, I have to done it as intuitive as I could. There is no chance to show it without too much artificially.
The text-to-speech has done its job already. I had hard time to make them believe that has been included in Mac OS 7 years ago. [img]images/smiles/icon_biggrin.gif[/img]
In order to demostrate the speech recognization, a mic is requeired. The PowerMac G4/450 in my office does not have one. I have to bring my PowerBook back office to show it.
You know, for best effect of shocking, I have to done it as intuitive as I could. There is no chance to show it without too much artificially.
The text-to-speech has done its job already. I had hard time to make them believe that has been included in Mac OS 7 years ago. [img]images/smiles/icon_biggrin.gif[/img]