AppleScript名:インターネット接続確認 |
— Created 2015-12-16 by Takaaki Naganoya — 2015 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" set aRes to hasInternetConnection() of me –> true on hasInternetConnection() set aURL to current application’s |NSURL|’s alloc()’s initWithString:"http://www.google.com" set aReq to current application’s NSURLRequest’s alloc()’s initWithURL:aURL cachePolicy:(current application’s NSURLRequestReloadIgnoringLocalCacheData) timeoutInterval:5.0 set urlRes to (current application’s NSURLConnection’s sendSynchronousRequest:aReq returningResponse:(missing value) |error|:(missing value)) if urlRes = missing value then return false else return true end if end hasInternetConnection |
More from my site
(Visited 30 times, 1 visits today)