2012-02-11 4 views
0

次のAppleScriptコードはコンパイルされません。コンパイラは "case"をハイライト表示し、 "Syntax Error:予想されるアプリケーション定数または考慮されていますが、見つかったプロパティ"と表示します。私はcasetell application "Microsoft Word"という文脈で特別な意味を持つと思います。どうすればうまくいくのですか?ApplescriptでMicrosoft Wordに対処しているときに "検討中のケース"を使用する方法

tell application "Microsoft Word" 
    set c to content of character 1 of selection as string 
    considering case 
     if (c is "a") then 
      set content of text object of selection to "A" 
     end if 
    end considering 
end tell 
+2

「考慮」ブロックを外部に貼り付け、他のすべてのものを取り囲むようにしてください。 – fireshadow52

答えて

1

は、それが他のすべてを包含するように外部へconsideringブロックを移動してみてくださいです。

caseはMicrosoft Wordの予約語なので、tellブロック内の別のコンテキストでその単語を使用すると、コンパイラが混乱して構文エラーになることがあります。

1

fireshadow52権利である...私はどうなるのか

considering case 
tell application "Microsoft Word" 
    set c to content of character 1 of selection as string 
    if (c is "a") then 
     set content of text object of selection to "A" 
    end if 
end tell 
end considering 
関連する問題