AppleScript名:shellの出力結果をスペースでparseする |
— Created 2016-03-11 by Takaaki Naganoya — 2016 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" set a to "3 0x4248387 1920×1200 0 0 -1920 -1200 0 [main]" set aStr to (current application’s NSString’s stringWithString:a) –> (NSString) "3 0x4248387 1920×1200 0 0 -1920 -1200 0 [main]" set aLine to (aStr’s componentsSeparatedByString:" ") –> (NSArray) {"3", "", "0x4248387", "", "", "", "", "1920×1200", "", "", "", "", "", "0", "", "", "", "", "0", "", "-1920", "", "-1200", "", "", "", "", "", "0", "", "", "", "[main]"} ( aLine’s removeObject:"")–> (NSArray) {"3", "0x4248387", "1920×1200", "0", "0", "-1920", "-1200", "0", "[main]"} set bList to aLine as list –> {"3", "0x4248387", "1920×1200", "0", "0", "-1920", "-1200", "0", "[main]"} |
More from my site
(Visited 32 times, 1 visits today)