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

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

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

1 :名称未設定:2017/04/01(土) 12:42:51.78 ID:F8/5NUFI0.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.osdn.jp/wiki/index.php/AppleScript
鳶嶋工房 / AppleScript
http://tonbi.jp/AppleScript/
AS Hole(AppleScriptの穴)
http://piyocast.com/as/
■過去スレ直近5つ
6 http://potato.2ch.net/test/read.cgi/mac/1387630245/
5 http://anago.2ch.net/test/read.cgi/mac/1330350325/
4 http://anago.2ch.net/test/read.cgi/mac/1256127156/
3 http://pc11.2ch.net/test/read.cgi/mac/1223026902/
2 http://pc11.2ch.net/test/read.cgi/mac/1197443062/

81 :名称未設定:2017/08/31(木) 17:37:16.14 ID:uv9FJb930.net
キーボードが壊れていてControlが常に押された状態になっているのです

82 :名称未設定:2017/08/31(木) 17:49:27.84 ID:TbHNu8N70.net
なんだそのクソみたいな便乗

83 :名称未設定:2017/08/31(木) 17:56:00.69 ID:p9bPGsK+0.net
ビンジョー

84 :名称未設定:2017/08/31(木) 17:58:14.24 ID:8crVxHW10.net
システム環境設定のキーボードのところに
修飾キーっていうボタンがあるから
そこをクリックして
コントロールをアクション無しに設定すれば
コントロールキーを無効に出来るよ
壊れてるなら使えなくしても問題ないでしょ

85 :名称未設定:2017/08/31(木) 18:01:47.65 ID:8crVxHW10.net
よく考えたら>>81は本人じゃないのか

86 :名称未設定:2017/08/31(木) 23:50:33.84 ID:q7binzaZ0.net
俺が本人なんだが

87 :名称未設定:2017/09/01(金) 19:59:35.86 ID:AsewW5Hc0.net
真の>>77だけどw
理由は、アプリ起動にショートカット付ける系のアプリでcontrolキーが割り当てられなかったりするから

まあどうしても割り当てたかったら、スクリプト実行するだけの.appバンドルを自分で作ればいいんだけど
できればアプリ形式でそのままできたほうがいいなーと思って

88 :名称未設定:2017/09/23(土) 00:28:29.83 ID:qrnvJJOc0.net
A
set lst to 2
if lst = 2 then
display dialog "中止"
end if

B
set lst to {1, 2}
repeat with i in lst
display dialog "中止"
end repeat

C
set lst to {1, 2}
repeat with i in lst
if i = 2 then
display dialog "中止"
end if
end repeat
--ここからメインの処理

質問です
A,Bは機能するのにCが動かないのはなぜでしょうか?

それとメインの処理の前にリストをチェックしてリストにあった場合処理を中止したいのですが、
Cでdisplay dialog でキャンセルを押せば中止されるのですが
中止する前に別なダイアログを表示させてから中止するような場合はどうすればいいでしょうか?
よろしくお願いします。

89 :名称未設定:2017/09/23(土) 01:51:01.56 ID:oE2fSdGf0.net
>>88
repeat内にiが2かどうか判断する処理しかないじゃない。
end repeatをメインの処理より後にしないと。

display alert
なら「OK」ボタンしかでないからその後に
returnとか

repeat with i in {1, 2, 3, 4}
if i as integer = 3 then
display alert "中止"
return
end if
--メイン処理
display dialog "メイン処理"
end repeat

90 :名称未設定:2017/09/23(土) 04:17:22.60 ID:m1CA2BF10.net
https://developer.apple.com/library/content/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_control_statements.html#//apple_ref/doc/uid/TP40000983-CH6g-128481
AppleScript Language Guide > Control Statements Reference > repeat Statements
> repeat with loopVariable (in list) から

> the value of the variable is a reference to the first item in list, in the second iteration, it is a reference to the second item in list, and so on.
→ ループ中、変数はリストの項目のreferenceである。
> To access the actual value of an item in the list, rather than a reference to the item, use the contents of property:
→ 値を利用するには contents of とする。→ contents of i
> This technique is especially important when performing a comparison, as you typically want to test whether the value of a list item matches another value.
→ 比較を行うときに特に重要。
> You can also use list variables directly in expressions, which may result in an implicit coercion from an object reference to a specific data type.
→ 式の中では特定のデータ型に変換され直接使える。 i + 0 とか

総レス数 1001
395 KB
新着レスの表示

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