0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

初めてのAppleScript。ダイアログとプログレスバーで遊ぶ

Posted at

Apr-09-2022 20-22-01.gif

実に可能性を感じるアプリを作りました。

この記事について

AppleScriptを学び始めて1hでこんなアプリができたのでそのメモ

コード

display dialog "実行しますか?"
display dialog "...本当に実行しますか?"
set progress total steps to 10
set progress completed steps to 0
set progress description to "実行します。"

repeat with a from 1 to 10
	set progress completed steps to a
	if a = 2 then
		set progress description to "ざわ.."
	else if a = 3 then
		set progress description to "ざわ..ざわ.."
	else if a = 5 then
		set progress description to "ざわ..ざわ..ざわ.."
	else if a = 7 then
		set progress description to "くるぞ.."
	else if a = 9 then
		set progress description to "うおおおおおおおおおおお"
	end if
	delay 1
end repeat

-- Reset the progress information
set progress total steps to 0
set progress completed steps to 0
set progress description to ""

display dialog "🌸🌸🌸🌸🌸🌸開花🌸🌸🌸🌸🌸🌸"

AppleScriptでのAppの作り方

スクリーンショット 2022-04-09 20.46.23.png

macにデフォルトで入っているスクリプトエディタを起動

スクリーンショット 2022-04-09 20.47.27.png

 こんな画面が出てくる

ここに上記のコードを貼って、Command + S で保存する。
その際にアプリケーションを選択すればできる

スクリーンショット 2022-04-09 20.48.25.png

コードのポイント

ダイアログを表示する

display dialog "実行しますか?"

スクリーンショット 2022-04-09 20.50.08.png

プログレスバーを表示する

参考にも貼っているここからとってきてる。

アプリの起動の仕方によってプログレスバーの表示の仕方が違うことに注意。

プロパティー 内容
progress total steps プログレスバーの値の最大値 (Integer)
progress completed steps プログレスバーの値 (Integer)
progress description プログレス中に表示する文言 (String)

参考

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?