2016-08-25 7 views
-1

文字を別の文字に置き換えるApple Automatorでサービスを作成したいとします。例えば、私は電話番号の形式変換したい場合:AutomatorでAppleScriptを使用して文字を置換する

+ X(XXX)XXX-XX-XX => XXXXXXXXXX

感謝を。ここで

+0

正確には、何が問題なのですか?あなたが投稿したのは一般的な声明です。 –

答えて

0

はあなたのAutomatorに置くことができるシンプルなAppleScriptのコードであり、それは完全な番号= XXXXXXXXXX

on run {input, parameters} 
    set inputNumber to input as text 
    set outputNumber to "" 
    if inputNumber begins with "+" then 
     -- The Number begins with a + so convert number 
     set noParts to the number of words of inputNumber 
     repeat with cPart from 3 to noParts 
      set outputNumber to outputNumber & word cPart of inputNumber 
     end repeat 
    end if 
    return outputNumber 
end run 

・ホープこのことができますように、出力を返します!

+0

ありがとうMacMan!それは素晴らしい作品です。 – Yuri

+0

問題ありません – Lucasware

関連する問題