2016-10-27 11 views
0

Appleスクリプトを使用してすべてのSafariタブを再ロードしていますが、再読み込み時に開かれたタブの1つを無視します。以下は、開いているタブを再読み込みするための私のコードです。AppleScriptを使用してSafariで自動再読み込みの1つのタブを無視する

tell application "Safari" 
     repeat 
      repeat with i from (count of tabs of window 1) to 1 by -1 
       set thisTab to tab i of window 1 
       set current tab of window 1 to thisTab 
       tell application "System Events" 
        keystroke "r" using {command down} 
       end tell 
       delay 10 
      end repeat 
     end repeat 
    end tell 

答えて

0

あなたは、インデックスでフィルタをかけることができます(タブ4以外のすべてをリロード)

tell application "Safari" 
    repeat 
     repeat with i from (count of tabs of window 1) to 1 by -1 
      if i is not 4 then 
       set thisTab to tab i of window 1 
       set current tab of window 1 to thisTab 
       tell application "System Events" 
        keystroke "r" using {command down} 
       end tell 
       delay 10 
      end if 
     end repeat 
    end repeat 
end tell 

またはURLによって

tell application "Safari" 
    repeat 
     repeat with i from (count of tabs of window 1) to 1 by -1 
      set thisTab to tab i of window 1 
      if URL of thisTab does not contain "myServer" then 
       set current tab of window 1 to thisTab 
       tell application "System Events" 
        keystroke "r" using {command down} 
       end tell 
       delay 10 
      end if 
     end repeat 
    end repeat 
end tell 
(URL "myServerという" を含まないすべてのタブをリロード)

関連する問題