AppleScript名:ネットワーク使用状況を取得 |
— Created 2017-12-17 by Takaaki Naganoya — 2017 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" set nRes to networkUsage() of me –> {inPacket:4904085, inSize:"5444M", outPacket:3426539, outSize:"396M"} on networkUsage() set nRes to (do shell script "top -l 1 | head -10 | grep ’Networks: packets:’") set nList to words of nRes set inPackNum to (contents of item 3 of nList) as integer set inSizeNum to (contents of item 4 of nList) set outPackNum to (contents of item 6 of nList) as integer set outSizeNum to (contents of item 7 of nList) return {inPacket:inPackNum, inSize:inSizeNum, outPacket:outPackNum, outSize:outSizeNum} end networkUsage |
More from my site
(Visited 68 times, 1 visits today)