1

クリップボードの内容を変数に設定したい。私は以前にこれを行ったことがあり、それは十分に単純なはずですが、エラーが発生します。

on checkiPadFinished()
    set tempiPadSerial to "b"
    tell application "System Events"
        tell process "iTunes"
            keystroke "c" using {command down}
            set tempiPadSerial to the clipboard as string
            if firstiPadSerial is tempiPadSerial then
                return true
            else if firstiPadSerial is "a" then
                set firstiPadSerial to the clipboard as string
            end if
        end tell
    end tell
    return false
end checkiPadFinished

コードの前半で、グローバル変数を宣言します

グローバルXXX、yyy、zzz、firstiPadSerialはfirstiPadSerialを「a」に設定します

checkiPadFinished()の呼び出しは次のようになります。

set doneiPads to my checkiPadFinished()

私が知る限り、すべてが機能するはずですが、代わりに不可解なエラーメッセージが表示されます。

編集:実行中のものを変更せずに。私は途方に暮れています。エラーメッセージを書き留めておけばよかったのに。でも、10回目に行くボタンを押すとうまくいったので、メッセージが何だったのかさえ言えません。

4

1 に答える 1

1

試す:

  activate application "iTunes"
tell application "System Events"
    tell process "iTunes"
        select row 15 of outline 1 of scroll area 2 of window "iTunes"
        keystroke "c" using {command down}
        delay 0.5 -- jackjr300's suggestion
        set xxx to the clipboard
    end tell
end tell

ここに画像の説明を入力してください

于 2012-06-12T21:56:11.193 に答える