Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- global stack --スタック
- global stackP --スタックポインタ
- on run
- set stack to {} ---スタックを初期化---
- set stackP to 1 ------------------------
- exposeUIElements(application "System Events")
- end run
- on exposeUIElements(source)
- tell application "System Events"
- set stack to stack & {source} --引数をスタックに追加
- set uiList to UI elements of source
- if (count uiList) is 0 then
- display dialog "No UI Elements."
- return source
- end if
- -- choose from listに表示する文字列リストを作成
- set nameList to {}
- repeat with i from 1 to count uiList
- set elem to item i of uiList
- if i < 10 then -- iが一桁のとき頭に0つけてるだけ
- set num to "0" & i as string
- else
- set num to i as string
- end if
- set nameList to nameList & (num & ": " & "[" & class of elem & "]" & space & name of elem & " (" & ((count (UI elements of elem)) as string) & " item)")
- end repeat
- -- choose from listを表示、次のオブジェクトを決定、スタックポインタを変更
- tell application "Finder" to choose from list nameList with title ("(" & (class of source) & ") " & (name of source)) with prompt "Expose UI Elements in selected object."
- if result is not false then
- set target to (word 1 of item 1 of result) as number
- set next to item target of uiList
- set stackP to stackP + 1
- else
- set stackP to stackP - 1
- if stackP is 0 then
- return false
- end if
- set stack to items 1 thru stackP of stack
- set next to last item of stack
- end if
- -- 再帰
- my exposeUIElements(next)
- end tell
- end exposeUIElements
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement