0

私の質問がばかげているように見えたら、私は初心者の申し訳ありません。

現在、すべての.webarchiveを.htmlに変換するスクリプトを作成しようとしているため、「iCab」というアプリケーションを使用して.webarchiveを開き、.htmlに保存することになります。

これが、すべての.webarchiveを保存フォルダーに置いた質問です。すべてを1つずつ開くにはループが必要なので、このコードのフラグメントをループ内に配置できます。

tell application "iCab" to open file file_name
tell application "iCab" to activate
delay 1
tell application "System Events"
    tell process "iCab"
        click menu item "Save As…" of menu "File" of menu bar 1
        key code 76
        click menu item "Close Window" of menu "File" of menu bar 1
    end tell
end tell

前もって感謝します

4

2 に答える 2

7

また、ファイルをFinderファイルオブジェクトからエイリアスに変換する必要があります。

tell application "Finder"
    set fl to files of folder POSIX file "/Users/username/Folder/" as alias list
end tell
repeat with f in fl
    tell application "iCab"
        open f
        activate
    end tell
    tell application "System Events"
        tell process "iCab"
            click menu item "Save As…" of menu "File" of menu bar 1
            keystroke return
            click menu item "Close Window" of menu "File" of menu bar 1
        end tell
    end tell
end repeat
于 2013-01-18T15:17:53.647 に答える
1

試す:

tell application "Finder" to set myFiles to every file of folder "Mac OS X:Users:Angeloid:Desktop:yourFolder"
repeat with aFile in myFiles
    --insert your code here
end repeat

フォルダーの選択を含めるように編集します。

tell application "Finder" to set myFiles to every file of (choose folder)
repeat with aFile in myFiles
    tell application "iCab"
        open file file_name
        activate
    end tell
    delay 1
    tell application "System Events"
        tell process "iCab"
            click menu item "Save As…" of menu "File" of menu bar 1
            key code 76
            click menu item "Close Window" of menu "File" of menu bar 1
        end tell
    end tell
end repeat
于 2013-01-18T15:04:29.463 に答える