2ちゃんねる スマホ用 ■掲示板に戻る■ 全部 1- 最新50    

■ このスレッドは過去ログ倉庫に格納されています

AppleScript アップルスクリプト 質問、発表 6

1 :名称未設定:2013/12/21(土) 21:50:45.07 ID:1PJJFexL0.net
質問、発表どっちでもスレ。

■注意
安直なスクリプト作成依頼、丸投げ、「こういうの作ってください!」はお断り。
わからない点、エラーが解決できない点についてはスクリプト片を添えて質問すること。
OSバージョンも忘れずに。

■参考
AppleScript Language Guide
https://developer.apple.com/library/mac/documentation/AppleScript/Conceptual/AppleScriptLangGuide/
TN2065: do shell script
https://developer.apple.com/library/mac/technotes/tn2065/
AppleScript: The Language of Automation
http://www.macosxautomation.com/applescript/
MacWiki - AppleScript
http://macwiki.sourceforge.jp/wiki/index.php/AppleScript
鳶嶋工房 / AppleScript
http://tonbi.jp/AppleScript/
AS Hole(AppleScriptの穴)
http://piyocast.com/as/
■過去スレ
1 http://pc11.2ch.net/test/read.cgi/mac/1174045850/
2 http://pc11.2ch.net/test/read.cgi/mac/1197443062/
3 http://pc11.2ch.net/test/read.cgi/mac/1223026902/
4 http://anago.2ch.net/test/read.cgi/mac/1256127156/
5 http://anago.2ch.net/test/read.cgi/mac/1330350325/

211 :名称未設定:2014/05/30(金) 16:41:48.89 ID:w2GSLBfm0.net
上記で質問した者ですが、とりあえず解決できたっぽいです

参照ページ ttp://macscripter.net/viewtopic.php?id=42087
参照スクリプト ttp://macosxautomation.com/lion/applescript.html の Applet with Progress Window

再現スクリプトを下記のように分割し、修正します
main.scptの内容
on run
set mySubScpt to my subScpt's alloc()'s init()
tell mySubScpt
setWake()
putNotification()
end tell
end run
(続く)

212 :名称未設定:2014/05/30(金) 16:42:24.82 ID:w2GSLBfm0.net
sub.scptの内容(CocoaAppletAppDelegate.scptと同じ階層に置きます)
script subScpt
on wake:aNotification
NSLog("%@", "wake_")
end wake:
on setWake()
tell my NSWorkspace's sharedWorkspace()'s notificationCenter()
addObserver_selector_name_object_(me, "wake:", "NSWorkspaceDidWakeNotification", missing value)
end tell
end setWake
on putNotification()
set uNotification to my NSUserNotification's alloc()'s init()
tell uNotification
setTitle_("Title")
setSubtitle_("Subtitle")
end tell
tell my NSUserNotificationCenter's defaultUserNotificationCenter()
setDelegate_(me)
deliverNotification_(uNotification)
end tell
end putNotification
on userNotificationCenter:aCenter didActivateNotification:aNotification
NSLog("%@", "activate")
end userNotificationCenter:didActivateNotification:
on NSLog(fmg, msg)
do shell script "syslog -s -l Notice " & msg
end NSLog
end script

(以上)

213 :名称未設定:2014/06/07(土) 06:47:40.02 ID:K4QUfk3I0.net
なんかさ、お手製のASOCアプリで、テキストファイル(具体的にはHTMLファイル)を
動的に作成しているんだけど、おなじみのカタカナ濁点問題でsqliteからデータがヒット
しなかったため、do shell script iconvで文字コード変換する仕組みを試したら、
その後、そのマシンでは全部文字化け???????とかするようになってしまった。
元に戻したつもりだが、それでも文字化けしっぱなし。他のマシンで動かすと
普通に表示される。これ、何がおかしくなってしまったのだろう? 皆目検討がつかない。

214 :名称未設定:2014/06/07(土) 16:24:00.67 ID:zIxkH1WO0.net
>>213
>>そのマシンでは全部文字化け???????とかするようになってしまった。
なにが文字化けしたのか、テキストファイルなのか、ブラウザなのか、UIとかテキストが使われている所すべてなのか?

作成したHTMLの文字コードは、確認した?

カタカナ濁点はis inとか使って、どうにかしたような気がする

215 :名称未設定:2014/06/10(火) 14:31:45.38 ID:TLtyEFvp0.net
OSX 10.10にはJavaScriptのOSA componentが追加される。
JavaScript for Automation Release Notes
https://developer.apple.com/library/prerelease/mac/releasenotes/InterapplicationCommunication/RN-JavaScriptForAutomation/index.html
これってScript Debuggerを出してるLate Night Softwareが以前配布してたJavaScript
OSAの焼き直しだね。Objective-C Bridge機能は新しいけど。
以前はAppleScript以外にもOSA componentはいくつもあったのに廃れてしまったけど、
これを機にまた色々出ると良いね。

216 :名称未設定:2014/06/11(水) 22:21:00.84 ID:WohYruh00.net
SwiftってASOCに影響あるんだろうか?

217 :名称未設定:2014/06/12(木) 22:47:56.02 ID:5DhLMxc40.net
全く無いと思うよ

218 :名称未設定:2014/06/13(金) 00:37:42.31 ID:5iWW/8Q60.net
影響は無いだろう。ただ、Swift Script Editorが提供されiOSで動く事に・・

219 :名称未設定:2014/06/13(金) 01:29:06.16 ID:BH+9QlRy0.net
個人的にはVB VCとかObj-Cとか扱えないからSwiftは助かるわ。
なんかビジュアル的にどうのこうのするのは苦手。

プログラムは手打ちだろjk

220 :名称未設定:2014/06/13(金) 23:16:46.98 ID:7WuVEZau0.net
質問です
OSは10.9で、実行環境はAutomatorによるサービス内の「AppleScriptを実行する」です。

以下のようなスクリプトで、選択したテキストをSafariで開いたページ(hoge)のテキストフィールドに入力しようとしています。
しかし、テキストに改行が含まれているとうまくいきません。解決法を教えてください。

on run {input, parameters}
tell application "Safari"
make new document with properties {URL:"hoge"}
(省略)
do JavaScript "document.getElementsByName('text')[0].value = '" & input & "'" in document 1
end tell
return input

総レス数 1008
389 KB
新着レスの表示

掲示板に戻る 全部 前100 次100 最新50
read.cgi ver 2014.07.20.01.SC 2014/07/20 D ★