Help us understand the problem. What is going on with this article?

AppleScriptでブラウザ(Safari)で開いているリンクとタイトルを取得

More than 5 years have passed since last update.

肝はこの辺・・・

配列の定義と要素追加
--定義
set linkArray to {}

--要素の追加
set the end of linkArray to {urlTitle:tabName, urlLink:tabURL}
アプリケーション(Safari)に指示を出す
tell application "Safari"

end tell
1つのウインドウ内にあるタブの数
-- tell application "Safari"内で・・・
set tabcount to number of tabs in window inWindowNumber
指定回数のループ
--1〜タブ数までループ、変数yがインクリメントされる
repeat with y from 1 to タブ数

end repeat
コード全体
-- ========================================
-- 戻り値:配列
--   key : urlTitle
--   key : urlLink
-- ========================================
to tellSafariToGetURLsOfWindowByWindowNumber(inWindowNumber)
    set linkArray to {}
    tell application "Safari"
        set tabcount to number of tabs in window inWindowNumber
        try
            set tabcount to number of tabs in window inWindowNumber

            repeat with y from 1 to tabcount
                --Get Tab Name & URL
                set tabName to name of tab y of window inWindowNumber
                set tabURL to URL of tab y of window inWindowNumber
                set the end of linkArray to {urlTitle:tabName, urlLink:tabURL}
            end repeat
        end try
    end tell
    return linkArray
end tellSafariToGetURLsOfWindowByWindowNumber
実行
tellSafariToGetURLsOfWindowByWindowNumber(1)
結果

qiitaのページをタブで2つ開いたウインドウの結果

{{urlTitle:"ホーム - Qiita", urlLink:"http://qiita.com/"}, {urlTitle:"ホーム - Qiita", urlLink:"http://qiita.com/"}}
Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away