导出Library.scpt:执行错误:未定义变量ndx。 (-2753)它和#34;本地"行作为两个RECOGNIZED变量

时间:2017-02-01 16:00:10

标签: applescript

以下是相关代码:我相信错误正在"重复"阻止在最后。用于运行程序的命令行是:" osascript Export \ Library.scpt / Users / bryandunphy / Development / iTunesLibraryConsolidator Testing.xml"。

on run (clp)
    if clp's length is not 2 then error "Incorrect Parameters"
    local destination, libraryName, ndx
    set destination to clp's item 1
    set libraryName to clp's item 2
    menuClick({"iTunes", "File", "Library", "Export Library…"})
    tell application "System Events" to set the value of text field "Save As:" of window "iTunes" of process "iTunes" to libraryName
    tell pop up button 1 of group 1 of window "iTunes" of process "iTunes" of application "System Events" to click
    ndx = 1
    repeat
        if the title of menu item ndx is "" then
            select menu item (ndx - 1)
            exit repeat
        else
            ndx = ndx + 1
        end if
    end repeat
    my switchDir(destination, "iTunes", "iTunes", true, false)
    tell button "Save" of window "iTunes" to click
    return (destination & "/" & libraryName & ".xml")
end run

1 个答案:

答案 0 :(得分:0)

语言语义混乱。

sudo systemctl reload apache2语句声明变量但不定义(赋值)它(如在C中)。

声明

local

比较(当前未定义)变量ndx = 1 和1,

ndx

将值1赋值给变量set ndx to 1 (定义它)。

相若方式

ndx

行[{1}}后面的所有内容都必须位于set ndx to ndx + 1 告诉记录块