2011-12-05 29 views
0

我有一個簡短的腳本別人一些AppleScript的代碼問我來編輯:的AppleScript:「預期線的終點,但發現標識」

repeat with i from 1 to nDirs 
    set impf to folder i of importFolder 
    my convertFolder(impf,exportFolder,userValue) 
end repeat 

每當我試着將它保存或編譯它,不過, AppleScript編輯器告訴我「Syntax error:expected end of line but found identifier」,同時指向小'i'。我的impf綁定語法不正確嗎?我怎樣才能得到這個腳本編譯?

回答

0

變化folder變爲item

我假設你只想「轉換」的文件夾,因此調用convertFolder前加「錯誤檢查」(在這種情況下,文件夾檢查)...

if (impf as string) ends with ":" then my convertFolder(impg, exportFolder, uservalue) 
--Alias references ending with a ':' indicate that the item is a folder 
+0

OK,但我有已經將nDirs設置爲只有目錄的數量。那麼不會因爲它檢查文件夾中的所有項目而不僅僅是目錄而忽略這些次數? – esennesh

+0

@ user1080700否...?你看過劇本和評論嗎?我添加了文件夾/目錄檢查,所以你應該很好。 – fireshadow52