小编ALX*_*ALX的帖子

将一个字符串拆分为多个变量 AppleScript

我如何将用户在 AppleScript 中输入的句子转换为每个单词的单独变量。例如,Lorem ipsum dolor sit amet会被空间分割成不同的变量,例如。var1 = lorem, var2 = ipsum等等。以下是我到目前为止的想法,但我显然一无所获。

set TestString to "1-2-3-5-8-13-21"
set myArray to my theSplit(TestString, "-")
on theSplit(theString, theDelimiter)
    -- save delimiters to restore old settings
    set oldDelimiters to AppleScript's text item delimiters
    -- set delimiters to delimiter to be used
    set AppleScript's text item delimiters to theDelimiter
    -- create the array
    set theArray to every text item of theString
    -- restore the old setting
    set AppleScript's text item delimiters …
Run Code Online (Sandbox Code Playgroud)

string variables applescript

5
推荐指数
1
解决办法
4687
查看次数

用applescript检测电池百分比

我如何检测我的计算机电池百分比是多少并使用applescript将其设置为变量?类似问题的所有答案都说要安装其他软件,但我想用纯苹果脚本来做.这可能吗?我也试过在applescript库中搜索没有成功.

applescript osx-yosemite

3
推荐指数
1
解决办法
978
查看次数

标签 统计

applescript ×2

osx-yosemite ×1

string ×1

variables ×1