簡體   English   中英

Applescript進度條不起作用

[英]Applescript progress bar not working

我有一個正常工作的進度條形碼但是當我把它與一些任務混合,比如在這里復制文件時,它會給我錯誤並且不會增加,它會在第一次復制后停止,任何想法問題在哪里?

這是代碼:

tell application "Finder"
    set selected_items to selection
    set fileCount to length of selected_items
end tell

set progress total steps to fileCount
set progress completed steps to 0
set progress description to "Processing Images..."
set progress additional description to "Preparing to process."
set a to 1

tell application "Finder"
    set theFolder to POSIX file "/Users/graphics/Desktop/1"
    repeat with x in selected_items
        set progress additional description to "Processing image " & a & " of " & fileCount
        duplicate x to theFolder
        set progress completed steps to a + 1
        set a to a + 1
    end repeat
end tell

這是腳本, 請閱讀以下注釋

tell application "Finder"
    set selected_items to selection
    set fileCount to count of selected_items
end tell

set progress total steps to fileCount
set progress completed steps to 0
set progress description to "Processing Images..."
set progress additional description to "Preparing to process."
set a to 1

repeat with x in selected_items
    set progress additional description to "Processing image " & a & " of " & fileCount
    tell application "Finder"
        set theFolder to (path to desktop folder as string) & "1:"
        duplicate x to theFolder with replacing
    end tell
    tell me to set progress completed steps to a + 1
    set a to a + 1
end repeat

我將set progress...處理程序移出了tell application "Finder" -Block,因為應用程序“Finder”不知道進度條,並更正了目標文件夾以匹配任何桌面文件夾。 如果 ,它現在完美地工作

  • 腳本保存為Applet
  • Applet通過Dock啟動

這是因為

  • 在腳本編輯器中運行時,腳本編輯器無法處理用於更新進度條的不同線程

  • 如果你通過在Finder中雙擊啟動Applet,Applet本身就成了選擇,只因為你點擊它! 從碼頭開始解決了這個問題!

玩得開心,邁克爾/漢堡

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM