/* openselectionurl.ahk 選択範囲内の全てのリンクされていないURLを新しいタブで開く [Hotclick Popup Menu] Item, "選択テキスト内のURLを全て開く" = Copy & Execute program, "C:\ahk\AutoHotkey.exe", "C:\ahk\openselectionurl.ahk" */ #NoTrayIcon IfWinNotActive, ahk_class OpWindow Exit position = 1 urls = Loop { url_match := RegExMatch( Clipboard, "(h?t?t?p?s?:?//|www)((ja.wikipedia.org/wiki/[^\s]+)|([-_.!~*'()a-zA-Z0-9;/?:@&=+$,`%#]+))", $, position ) ;マッチしなかったら終了 If url_match = 0 Exit ;次の検索開始位置を設定 StringLen, length, $ position += length If $1 = www $2 = %$1%%$2% ;重複防止 IfInString, urls, <%$2%> Continue Run, C:\Opera\Opera.exe http://%$2% urls = %urls%<%$2%> ;for SDI ;Clipboard = http://%$1% ;wait( 10 ) ;Send, {LCtrl Down}t{LCtrl Up} ;新しいタブ ;wait( 40 ) ;Send, {LCtrl Down}b{LCtrl Up} ;貼り付けて移動 ;wait( 40 ) } wait( time ) { begin := A_TickCount Loop { if A_TickCount - begin > time break } }