« 2012年12月 | トップページ | 2013年2月 »

[AppleScripts]GoogleMapのURLからBridge用のGPS用の値を作る【その4】

XMPファイルを作成保存するまえに
環境やらを調べておきます。


20130131_232613

 
デフォルトアプリケーションを調べて
XMPとBridgeが紐づいている事を確認して

Bridgeのバージョンチェックと

XMPファイルの保存先までです
 
 
  
 
 

---------------/tmpにダミーでXMPファイルを作成します
do shell script "date > /tmp/ApplicationChk.xmp"

set theTmpXmpFile to (the path to startup disk as string) & "tmp:ApplicationChk.xmp" as alias
log "作ったダミーのXMPファイルのパスをエイリアスで取得→" & theTmpXmpFile

set theFileInfo to default application of (info for theTmpXmpFile) as text
log "ファイルインフォのデフォルトアプリケーションを取得→" & theFileInfo

if (theFileInfo contains "Bridge") is false then
---------------デフォルトアプリケーションがBridge以外ならここまで
display alert "XMPファイルがAdobe Bridgeに関連づけられていません"

else if (theFileInfo contains "Bridge") is true then
---------------デフォルトアプリがならAdobe Bridge処理を進める

---------------Bridgeのバージョン判定(ここでは判定だけ)
if (theFileInfo contains "CS6.app") is true then
log "Adobe Bridge CS6"

else if (theFileInfo contains "CS5.app") is true then
log "Adobe Bridge CS5"

else if (theFileInfo contains "CS4.app") is true then
log "Adobe Bridge CS4"

end if
---------------ダミーでXMPファルの保存先を開くだけにしておきます
set theSaveXmpPath to (the path to application support from user domain as text) & "Adobe:XMP:Metadata Templates:"
tell application "Finder"
activate
open folder theSaveXmpPath
end tell
end if

 
 
 
 
 
「GoogleMap2Bridgev4.rtf」をダウンロード


「GoogleMap2Bridgev4.scpt.zip」をダウンロード

|

[AppleScripts]GoogleMapのURLからBridge用のGPS用の値を作る【その3】

その3です。

検索語句を後にXMPファイルのファイル名にするので
検索語句を取得しておきます。
 
  
 
20130130_174356
 
  
 

URLで言う所の
赤い線か青い線の所のエンコードされた文字列を取得して
読める形にデコードします。
 
  
 

まずはその2と同じ要領で
q=以降の文字列を取得して
 
  
 
20130130_174504
 
  
 
&までの文字を取り出します。
 
  
 
20130130_174609
 
  
 
取り出したら
phpを使って文字列に戻します。
 
  
 
20130130_174755

 
20130130_174838

 
  
 

set theOrgGoogleMapUrl to "https://maps.google.com/maps?q=%E6%9D%B1%E4%BA%AC%E3%82%BF%E3%83%AF%E3%83%BC&hl=en&ie=UTF8&ll=35.659284,139.745879&spn=0.034276,0.030127&hq=%E6%9D%B1%E4%BA%AC%E3%82%BF%E3%83%AF%E3%83%BC&t=m&z=15" as text
log "GoogleMapからコピーしたURL" & theOrgGoogleMapUrl

--------変数のq=から後ろを取り出すコマンドラインを整形
set theAwkComLL to "echo " & quoted form of theOrgGoogleMapUrl & "| awk -F \"q=\" '{print($2)}' " as text

set theGoogleLlNo to do shell script theAwkComLL as text
log "変数のq=から後ろを取り出す→" & theGoogleLlNo

--------取り出した部分の&までを変数として取得するコマンドラインを整形
set theAwkComLL to "echo " & quoted form of theGoogleLlNo & " |awk -F \"&\" '{print($1)}' " as text

set theGoogleLlNo to do shell script theAwkComLL as text
log "取り出した部分の&までを変数として取得→" & theGoogleLlNo



set thePhpScpt to "php -r 'echo urldecode(\"" & theGoogleLlNo & "\");'" as text
return do shell script thePhpScpt

「GoogleMap2Bridgev3.rtf」をダウンロード


「GoogleMap2Bridgev3.scpt.zip」をダウンロード


つづく

|

[AppleScripts]GoogleMapのURLからBridge用のGPS用の値を作る【その2】


その1に続いて
順番が逆になりましたが
URLの整形部になります。

GoogleMapのURLは↓この部分を使います。
  
Website_image20130128_233223


URLの↓この部分が欲しいわけです。

20130129_174607


実際には1行で書けますが
2回にわけて書くと

20130129_175826


変数ll以降をまず取得して

値の終わりの&までに整形します

20130129_175924


Website_image20130129_181213

 
 
  
 

set theOrgGoogleMapUrl to "https://maps.google.com/maps?q=%E6%9D%B1%E4%BA%AC%E3%82%BF%E3%83%AF%E3%83%BC&hl=en&ie=UTF8&ll=35.659284,139.745879&spn=0.034276,0.030127&hq=%E6%9D%B1%E4%BA%AC%E3%82%BF%E3%83%AF%E3%83%BC&t=m&z=15" as text
log "GoogleMapからコピーしたURL" & theOrgGoogleMapUrl

--------変数のll=から後ろを取り出すコマンドラインを整形
set theAwkComLL to "echo " & quoted form of theOrgGoogleMapUrl & "| awk -F \"&ll=\" '{print($2)}' "

set theGoogleLlNo to do shell script theAwkComLL as text
log "変数のll=から後ろを取り出す→" & theGoogleLlNo

--------取り出した部分の&までを変数として取得するコマンドラインを整形
set theAwkComLL to "echo " & quoted form of theGoogleLlNo & " |awk -F \"&\" '{print($1)}' "

set theGoogleLlNo to do shell script theAwkComLL as text
log "取り出した部分の&までを変数として取得→" & theGoogleLlNo

--------,」で区切ってリスト形式で格納
set AppleScript's text item delimiters to {","}
set theGoogleLlNoList to every text item of theGoogleLlNo as list


「GoogleMap2Bridgev2.rtf」をダウンロード

「GoogleMap2Bridgev2.scpt.zip」をダウンロード

続く

|

[AppleScripts]GoogleMapのURLからBridge用のGPS用の値を作る【その1】

ブリッジのここの値です

  
Website_image20130128_234421


流れはこんな感じ
  
Website_image20130128_225737


GoogleMapのURLは↓この部分を使います。
  

Website_image20130128_233223


まずは
URLの60進数処理の所を
ねっとりとScriptだけで処理します。

Website_image20130128_235005


set theGoogleLlNoList to every text item of {"35.658595", "139.745439"} as list
log "GoogleMapURLの変数llから" & theGoogleLlNoList

set theLatitude to item 1 of theGoogleLlNoList as text
log "GoogleMapの値のリスト形式の最初のアイテムを取得→" & theLatitude

set theIntegerLatitude to theLatitude div 1 as text
log "整数部のみを取得する→" & theIntegerLatitude

set theLatitude to (text 2 thru 8 of (((theLatitude mod 1) as string) & "000000") as string)
log "小数点以下を6桁に揃える→" & theLatitude

set theLatitude to theIntegerLatitude & theLatitude
log "整数部と少数部を並べて桁揃えが出来た値→" & theLatitude

set theDecimalLatitudeA to (((theLatitude as number) - (theIntegerLatitude as number)) as number) * 60
log "まずは小数点以下に60かけて→" & theDecimalLatitudeA

set theIntegerDecimalLatitudeA to theDecimalLatitudeA div 1 as text
log "60かけた値の整数部だけを取り出す→" & theIntegerDecimalLatitudeA

set theDecimalLatitudeB to (((theDecimalLatitudeA as number) - (theIntegerDecimalLatitudeA as number)) as number) * 100 as integer
log "小数点に60かけた値の少数部を100倍した値を作る→" & theDecimalLatitudeB

set theLatitude to theIntegerLatitude & "," & theIntegerDecimalLatitudeA & "." & theDecimalLatitudeB & "N" as text
log "最後に並べてNを最後につけます→" & theLatitude

 

 
 
 
「GoogleMap2Bridge.rtf」をダウンロード

「GoogleMap2Bridge.scpt.zip」をダウンロード

|

Frank DeLoupe

ちょっぴり老眼にやさしいかも…苦笑

【Frank DeLoupe   Your New Color-Picking Friend for OS X】

|

Adobe Acrobat XI SDK

Acrobat XI SDK


|

SimpleFTP


:::::::: ON-CORE -----products / shareware ::::::::


Mac App Store - SimpleFTP


|

[AppleScript]ドロップレットの作法を考える その6 (ドロップレットを途中終了させる)

ドロップレットでちょっと困るのが
途中で処理をキャンセルさせる事
Xcodeでアプリケーションを作る場合には
「プログレスバー」を出せば途中キャンセルも可能ですが
AppleSxript単体だとチョイ難しかったりします。

そこで
こんな風に考えてみました

Website_image20130114_145601
 
 
上記の図で言う
stop2dropletについては
内包して配布する事で解決出来ます
 
 
Website_image20130114_145625

 
 
元のアプリケーションからは
シェルを使ってオープンします
 
 

Website_image20130114_150132
 
 
 


------------------------------------------------■■■■ ダブルクリックの始まり
on run
------------------------------------------------ダイアログを出して選択されたファイルは「open」に渡す
open (choose file)
end run

----------------------------------------------■■■■ openドロップの始まり
on open DropObj

-----------------------------------------------キャンセル用の別アプリを起動する
----実行したアプリケーションのパスを求めて
set theMyPath to path to current application as string
----キャンセル用swf2img.appのパスを加えて
set theStopAppPath to theMyPath & "Contents:Assistants:stop2droplet.app" as Unicode text
-----UNIXパスに整形
set theStopAppPosPath to POSIX path of theStopAppPath
--------コマンドラインを整形
set theKillPsComLine to "open " & theStopAppPosPath as text
-----キャンセル用のアプリを開く
do shell script theKillPsComLine


repeat

------ここに本処理
delay 20
end repeat
end open

 
 
 

 

処理を中断させるために
呼び出す別アプリ

 
  
Website_image20130114_150518
 
 
 



-------対象になるアプリケーション
set theNameOfApp to "OpenStopDroplet.app"


display alert ¬
"実行中のドロップレットをキャンセルします" message ¬
"ドロップレットが終了したら閉じてください" buttons {"ドロップレットを中止する", "このウィンドを閉じる"} ¬
default button 1 as informational

--------ダイアログの実行結果で処理を分岐
if button returned of the result is "このウィンドを閉じる" then
--------ウィンドを閉じるを選択した場合は何もしない
else if button returned of the result is "ドロップレットを中止する" then
-------------プロセスIDを取得するコマンドラインの整形
set theComLine to "ps -A | grep -v grep | grep " & quoted form of theNameOfApp & " | grep '/droplet' | awk '{print($1)}'" as text
-------------コマンドの実行
set thePsId to do shell script theComLine as text
-------------プロセスIDを取得できたか?で処理を分岐
if thePsId is "" then
-----プロセスIDを取得出来なかったら何もしない
else
--------取得したプロセスIDでコマンドラインを整形
set theKillPsComLine to "kill " & quoted form of thePsId as text
--------プロセスの終了を実行
do shell script theKillPsComLine
end if
end if


 

 

「OpenStopDroplet.app.zip」をダウンロード
「OpenStopDroplet.rtf」をダウンロード

 
 

 
「stop2droplet.app.zip」をダウンロード
「stop2droplet.rtf」をダウンロード


 


|

iColors (Xcodeな人にちょっと便利なカラーピッカー)

OSX標準のカラーピッカーに
各種カラーコードを取得するための
リンクを追加して起動します。
Xcodeな人にはちょっと便利に使える場面もあるかもしれませんね


iColors — The Designer's Color Selection Software for Mac OS X


|

FingerPDF

【FingerPDF app】


Source:【FingerPDF app】

|

[AppleScript]ドロップレットの作法を考える その5 (エイリアスの処理に悩む)

その1で書いたように
on run で選んだファイル(フォルダでも良いが)は
書類情報 info forの結果等から、不要なファイルへの排他が出来る

Website_image20130108_00339

一方
ドロップされたファイル(フォルダ)については
こちらの記事で書いたように
『エイリアス』の処理が悩ましい

Website_image20130108_02728


そこで
最初に考えたのが
ドロップされたディレクトリで判断するもの

Website_image20130108_05542

 

考えたが
Macではこのようなファイルの選択が可能で
違うディレクトリからドロップする事が可能だ


Website_image20130108_05410

じゃぁ
ファイルを別に集めてから処理すれば?

Website_image20130108_10649


って
方法があるが
処理時間や
処理後のファイルと
元ファイルが2重になるので
ファイル数が多い処理の場合は
利用者に利点より面倒が多い

さ〜困った


|

[AppleScript]ドロップレットの作法を考える その4 (ドロップされたファイルはエイリアスか?)

ドロップレット形式のAppleScriptsは
on openで処理がはじまるので
エイリアスがドロップされると
エイリアスを『オープン』する
その結果
エイリアスの参照先である
『実体』を「オープン」するから
ドロップされたファイルが
「エイリアス」

「ファイル」

はドロップレットに限っては判定出来ない。

『エイリアス』に対して処理が必要な場合は
ドロップレットは向かない

昔からこの動作だったかな?

Website_image20130106_163514


こちらの記事で書いたが
Finder内でエイリアスのinfoを要求すると

Website_image20130106_164921

このように
-10004エラーになる
Finder以外からファイル情報は呼び出すようにした方が良いかもしれない


Website_image20130106_165122


|

[AppleScripts]ドロップレットの作法を考える その3 エラーログを作成する

その2でダイアログによるエラー通知を組み込みましたが
必要か?は微妙wですが
ログをファイルにする事を考えてみました。

Website_image20130106_72652
 
 

 
 

------------------------------------------------■■■■ ダブルクリック起動の始まり
on run
------------------------------------------------【設定項目】ファイル選択ダイアログのデフォルトのディレクトリ
---set theDefLoc to path to shared documents from user domain
set theDefLoc to POSIX file "/Users/Shared/Downloads"
------------------------------------------------【設定項目】Uniform Type Identifier指定
------------------------------------------------詳しくは http://goo.gl/6jAQa Uniform Type Identifierを見てください
set theFileType to "public.png,public.jpeg" as text
---簡素の記述も出来ますPDFの場合---set theFileType to "PDF" as text
---ムービーファイルの場合---set theFileType to "public.movie,com.adobe.flash-video" as text
------------------------------------------------のファイルタイプをリスト形式に整形する
set AppleScript's text item delimiters to {","}
set theFileTypeList to every text item of theFileType
------------------------------------------------【設定項目】プロンプトの文言改行が使えます\nを入れます
------------------------------------------------Uniform Type Identifierとメッセージ
set theWithPrompt to theFileType & "\nファイルをえらんでください\n"
------------------------------------------------残りのメッセージ
set theWithPromptMes to "ファイルをドロップしても\n動作します"
------------------------------------------------ダイアログを出して選択されたファイルは「open」に渡す
open (choose file default location theDefLoc ¬
with prompt theWithPrompt & theWithPromptMes ¬
of type theFileTypeList ¬
invisibles true ¬
with multiple selections allowed without showing package contents)
end run



----------------------------------------------■■■■ openドロップ起動の始まり
on open theDropObj
----------------------------------------------IF文でエラー処理が無かった(正常終了)した場合の終了メッセージ
set theErrorPlaceMes to "処理が終了しました" as text
----------------------------------------------ログファイル名=アプリケーション名にするためにアプリケーション名を取得
set theApplicationName to name of current application as string
----------------------------------------------ログファイルの名前に日付時間を使うために今の時間を整形する
set theDateTime to (do shell script "date +'%Y%m%d_%H_%M_%S'" as string)
set theLogFileName to (theApplicationName & "_" & theDateTime & ".txt") as text
---------------------------------------------ファインダーを呼び出す
tell application "Finder"
----------------------------------------------■■■■ 繰り返しの始まり
repeat with theObjFiles in theDropObj
----------------------------------------------処理1
try
-----------------------◆◆◆ここに処理1
-----------------------エラーサンプル用のerror number -10004になる処理(これはOn Errorにならないので処理を中断しない)
do shell script "touch /tmp/test1.txt"
----------------------------------------------最初にメッセージを書き込む
my theLogEvent("\nこのファイルは削除しても大丈夫です\n\n", "処理1は正常終了しました", theLogFileName)


on error theErrorMsg number theErrorNum
----------------------------------------------【設定項目】ここの処理でエラーになった場合のエラーコード
set theErrorPlaceMes to "Er0001"
----------------------------------------------エラーの内容をログにかき出すサブルーチンを呼び出す
my theLogEvent(theErrorPlaceMes & ":" & theErrorMsg & ":" & theErrorNum, theLogFileName)
----------------------------------------------ダイアログを出してユーザーに知らせる
activate
display dialog (theErrorMsg & "" & theErrorNum & "\n" & "メールで↓のメッセージをお伝え下さい") ¬
default answer (theErrorPlaceMes & "" & theErrorMsg & "" & theErrorNum) ¬
with icon 1 default button 2
----------------------------------------------最後のダイアログ用にメッセージを整形
set theErrorPlaceMes to "エラーが発生して処理を中断しました:" & theErrorPlaceMes
end try
----------------------------------------------処理2
try
-----◆◆◆ここに処理2
-----------------------エラーサンプル用のerror number 1エラーになる処理
tell current application
do shell script "rm /tmp/test2.txt"
end tell



on error theErrorMsg number theErrorNum
----------------------------------------------【設定項目】ここの処理でエラーになった場合のエラーコード
set theErrorPlaceMes to "Er0002"
----------------------------------------------エラーの内容をログにかき出すサブルーチンを呼び出す
my theLogEvent("", theErrorPlaceMes & ":" & theErrorMsg & ":" & theErrorNum, theLogFileName)
----------------------------------------------ログファイルのあるフォルダを開く
open (folder "AppleScripts" of folder "Logs" of (path to library folder from user domain))
----------------------------------------------ダイアログを出してユーザーに知らせる
activate
display dialog (theErrorMsg & "" & theErrorNum & "\n" & "メールで↓のメッセージをお伝え下さい") ¬
default answer (theErrorPlaceMes & "" & theErrorMsg & "" & theErrorNum) ¬
with icon 1 default button 2
----------------------------------------------最後のダイアログ用にメッセージを整形
set theErrorPlaceMes to "エラーが発生して処理を中断しました:" & theErrorPlaceMes
end try
end repeat
----------------------------------------------処理終了ダイアログ 自動終了する
activate
display alert theErrorPlaceMes message "" as informational giving up after 1
end tell
end open



----------------------------------------------■■■■ログファイル書き込みのサブルーチン
on theLogEvent(theFirstMessage, theLogMessage, theLogFile)
----------------------------------------------ログファイルの格納先ディレクトリを作成
-----------既にフォルダがあるとnumber -48でエラーになる
try
tell application "Finder"
make new folder at folder "Logs" of (path to library folder from user domain) with properties {name:"AppleScripts"}
end tell
end try
-----------の処理が好みでは無い場合はdo shell script の方がスマート
------do shell script "mkdir -p ~/Library/Logs/AppleScripts"
----------------------------------------------ログファイルを作る
-----------既にファイルがあるとnumber -48でエラーになる
try
tell application "Finder"
make new file at (folder "AppleScripts" of folder "Logs" of (path to library folder from user domain)) with properties {name:theLogFile}
end tell
end try
-----------の処理が好みでは無い場合はdo shell script の方がスマート
------do shell script "touch -f ~/Library/Logs/AppleScripts/" & quoted form of (theLogFile)
----------------------------------------------利用者が削除して良いか?を判断出来るようにファイルを作っておく
------------既にファイルがあるとnumber -48でエラーになる
try
tell application "Finder"
make new file at (folder "AppleScripts" of folder "Logs" of (path to library folder from user domain)) with properties {name:"_このフォルダは削除しても大丈夫です.txt"}
end tell
end try
-----------の処理が好みでは無い場合はdo shell script の方がスマート
------do shell script "touch -f ~/Library/Logs/AppleScripts/" & "_このフォルダは削除しても大丈夫です.txt"
----------------------------------------------最初にメッセージを書き込む
do shell script "echo " & quoted form of (theFirstMessage & "\n") & " >> ~/Library/Logs/AppleScripts/" & quoted form of (theLogFile)
----------------------------------------------ログを書き込む
do shell script "echo " & quoted form of (theLogMessage & "\n") & " >> ~/Library/Logs/AppleScripts/" & quoted form of (theLogFile)
end theLogEvent


 
 
 

「log.app.zip」をダウンロード

「log.scpt.zip」をダウンロード

「log.rtf」をダウンロード

|

[AppleScripts]ドロップレットの作法を考える その2 on error

環境の違い等でエラーになった場合に備えるのが
エラー制御

エラーが発生するのを前提に考えるわけですが
「考え過ぎ」は
スクリプトが複雑になったり、処理が重くなったりと
弊害もあるので
「案配」や「程度」も大事ですね。

ドロップレットでの処理の場合
スクリプトエディタ上で実行するように
イベントログやエラーメッセージを確認しにくい
そこをなんとかしたい


Website_image20130106_02308


ポイントは
◆エラーが発生した箇所が特定出来る事
◆エラーの内容を取得出来る事


------------------------------------------------■■■■ ダブルクリック起動の始まり
on run
------------------------------------------------【設定項目】ファイル選択ダイアログのデフォルトのディレクトリ
---set theDefLoc to path to shared documents from user domain
set theDefLoc to POSIX file "/Users/Shared/Downloads"
------------------------------------------------【設定項目】Uniform Type Identifier指定
------------------------------------------------詳しくは http://goo.gl/6jAQa Uniform Type Identifierを見てください
set theFileType to "public.png,public.jpeg" as text
---簡素の記述も出来ますPDFの場合---set theFileType to "PDF" as text
---ムービーファイルの場合---set theFileType to "public.movie,com.adobe.flash-video" as text
------------------------------------------------のファイルタイプをリスト形式に整形する
set AppleScript's text item delimiters to {","}
set theFileTypeList to every text item of theFileType
------------------------------------------------【設定項目】プロンプトの文言改行が使えます\nを入れます
------------------------------------------------Uniform Type Identifierとメッセージ
set theWithPrompt to theFileType & "\nファイルをえらんでください\n"
------------------------------------------------残りのメッセージ
set theWithPromptMes to "ファイルをドロップしても\n動作します"
------------------------------------------------ダイアログを出して選択されたファイルは「open」に渡す
open (choose file default location theDefLoc ¬
with prompt theWithPrompt & theWithPromptMes ¬
of type theFileTypeList ¬
invisibles true ¬
with multiple selections allowed without showing package contents)
end run



----------------------------------------------■■■■ openドロップ起動の始まり
on open theDropObj
----------------------------------------------IF文でエラー処理が無かった(正常終了)した場合の終了メッセージ
set theErrorPlaceMes to "処理が終了しました" as text
tell application "Finder"
----------------------------------------------■■■■ 繰り返しの始まり
repeat with theObjFiles in theDropObj
----------------------------------------------処理1
try
-----------------------◆◆◆ここに処理1
-----------------------エラーサンプル用のerror number -10004になる処理(これはOn Errorにならないので処理を中断しない)
do shell script "touch /tmp/test1.txt"


on error theErrorMsg number theErrorNum
----------------------------------------------【設定項目】ここの処理でエラーになった場合のエラーコード
set theErrorPlaceMes to "Er0001"
----------------------------------------------ダイアログを出してユーザーに知らせる
activate
display dialog (theErrorMsg & "" & theErrorNum & "\n" & "メールで↓のメッセージをお伝え下さい") ¬
default answer (theErrorPlaceMes & "" & theErrorMsg & "" & theErrorNum) ¬
with icon 1 default button 2
----------------------------------------------最後のダイアログ用にメッセージを整形
set theErrorPlaceMes to "エラーが発生して処理を中断しました:" & theErrorPlaceMes
end try
----------------------------------------------処理2
try
-----◆◆◆ここに処理2
-----------------------エラーサンプル用のerror number 1エラーになる処理
tell current application
do shell script "rm /tmp/test2.txt"
end tell



on error theErrorMsg number theErrorNum
----------------------------------------------【設定項目】ここの処理でエラーになった場合のエラーコード
set theErrorPlaceMes to "Er0002"
----------------------------------------------ダイアログを出してユーザーに知らせる
activate
display dialog (theErrorMsg & "" & theErrorNum & "\n" & "メールで↓のメッセージをお伝え下さい") ¬
default answer (theErrorPlaceMes & "" & theErrorMsg & "" & theErrorNum) ¬
with icon 1 default button 2
----------------------------------------------最後のダイアログ用にメッセージを整形
set theErrorPlaceMes to "エラーが発生して処理を中断しました:" & theErrorPlaceMes
end try
end repeat
----------------------------------------------処理終了ダイアログ 自動終了する
activate
display alert theErrorPlaceMes message "" as informational giving up after 1
end tell
end open

 

  
「error.app.zip」をダウンロード

「error.rtf」をダウンロード


「error_scpt.zip」をダウンロード


処理中のエラーの場合は
display alertでは無くdisplay dialogを使う事で
エラーコード等をコピー出来るようにしています。


Website_image20130106_63239


|

[AppleScripts]error number -10004

error number -10004

–10004 A privilege violation occurred.
Apple Events特権違反エラー

ただし、処理を中断〜途中終了するようなエラーではありません。

Error_number10004_20130105_02


10.6からこうなったようです。(気がつきませんでしたw)

【AppleScript Release Notes: 10.6 Changes】


Source:【AppleScript Release Notes: 10.6 Changes】

Source:AppleScript Release Notes: 10.6 Changes


  

 

 

tell application "Finder"から呼び出すとエラーになるので

tell current applicationで実行している事がわかります

 

do shell script で処理を実行する場合のセキュリティへ上の配慮ですかね?

 

 

このサンプルの場合なら

以下のようにする事でエラーにりません。

 

 

Error_number10004_20130105_01

 
Finderや他のアプリケーションからsshを呼び出さないようにする事で
エラーになりません。

別にするパターン

Website_image20130105_172138


tell application "Finder"内で
FInderではなく
tell current applicationで実行させる

Website_image20130105_172150
 
 

エラーになりませんね。
  

tell application "Finder"
-------前処理


tell current application
do shell script "touch /tmp/test.txt"
end tell



--------後処理
end tell


 

error number -10004は
処理を中断〜途中終了するようなエラーではありません。
try
on error
の中で発生しても、処理は継続されます。

Website_image20130105_173409

tell application "Finder"
-------前処理


try
do shell script "touch /tmp/test.txt"
on error theErrorMsg number theErrorNum
activate
display alert (theErrorMsg & "" & theErrorNum) as informational
end try



--------後処理
end tell

|

[AppleScripts]ドロップレットの作法を考える その1 open (choose file)

ちょっとAppleScriptのドロップレット作ってくれ!と頼まれたので
AppleScriptsのドロップレット形式のAppファイルの作法を考えてみました。

Force4ucocologniftycom_20130105_02


こんな感じで
ダブルクリックでもドロップでも
動作する方法にして提供した。
この方法だと
スクリプトメニュー(メニューバーのアレね)

Website_image20130105_145832

からも呼び出せるので
デスクトップ等にも配置しなくて良いのわけなので
利用者の使い方(好みの問題)も選べるから
良いなぁと…
ちょっとひと手間かけてみた


ポイントは

1:of type を指定して処理の対象になるファイルタイプを選択させる

ぐらいでしょうか?
 
 
 
open (choose file)で選択されたファイルは
open theDropObjに渡されて
theDropObjに格納(定義?)されるって事になります。

 
 
 

------------------------------------------------■■■■ ダブルクリック起動の始まり
on run
------------------------------------------------【設定項目】ファイル選択ダイアログのデフォルトのディレクトリ
---set theDefLoc to path to shared documents from user domain
set theDefLoc to POSIX file "/Users/Shared/Downloads"
------------------------------------------------【設定項目】Uniform Type Identifier指定
------------------------------------------------詳しくは http://goo.gl/6jAQa Uniform Type Identifierを見てください
---png jpg画像ファイルの場合---set theFileType to "public.png,public.jpeg" as text
---簡素の記述も出来ますPDFの場合---set theFileType to "PDF" as text
set theFileType to "public.movie,com.adobe.flash-video" as text
------------------------------------------------のファイルタイプをリスト形式に整形する
set AppleScript's text item delimiters to {","}
set theFileTypeList to every text item of theFileType
------------------------------------------------【設定項目】プロンプトの文言改行が使えます\nを入れます
------------------------------------------------Uniform Type Identifierとメッセージ
set theWithPrompt to theFileType & "\nファイルをえらんでください\n"
------------------------------------------------残りのメッセージ
set theWithPromptMes to "ファイルをドロップしても\n動作します"
------------------------------------------------ダイアログを出して選択されたファイルは「open」に渡す
open (choose file default location theDefLoc ¬
with prompt theWithPrompt & theWithPromptMes ¬
of type theFileTypeList ¬
invisibles true ¬
with multiple selections allowed without showing package contents)
end run



----------------------------------------------■■■■ openドロップ起動の始まり
on open theDropObj
tell application "Finder"
----------------------------------------------■■■■ 繰り返しの始まり
repeat with theObjFiles in theDropObj


-------ここに本処理


end repeat
end tell
end open


「on_run.app.zip」をダウンロード


↑のスクリプト
「on_run.scpt.zip」をダウンロード


「on_run.rtf」をダウンロード

|

[swf2image]File Juice


File Juicer - Extract images from PDF, PowerPoint, Word, Excel and other Files on Mac OS X

File JuicerはSWFに対応している。
セキュリティ設定が無い場合はswfに埋め込まれている(呼び出しでは無い)場合は
8割程度の確率でかき出し出来た。

|

iTunes旧バージョン

7.3.0.54
http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iTunes7/Mac/061-3018.20070629.60NoI/iTunes.dmg
266a60d260eb82ce9d489b64713af61012d98d31

7.3.1.3
http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iTunes7/Mac/061-3550.20070711.B72nt/iTunes.dmg
cd29af8373fc21424558cd302f806ddb57d9b169

7.3.2.6
http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iTunes7/Mac/061-3608.20070802.im8t3/iTunes7.3.2.dmg
bce60930813741667c6db59f6f41bc0cf6691b0b

7.4.0.26
http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iTunes7/Mac/061-3602.20070905.mUy57/iTunes7.4.dmg
4422396fee3323cceab7d0ae83f47f7bedb21033

7.4.1.2
http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iTunes7/Mac/061-3889-20070907.ItU741/iTunes7.4.1.dmg
24e11dbc7498ef5d51b629e3caa202c0633b75ac

7.4.2.4
http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iTunes7/Mac/061-3873.20070917.Rg7Vw/iTunes7.4.2.dmg
b0471389ab987bc98d5f6ae1122a4f780048d930

7.5.0.19
http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iTunes7/Mac/061-3899.20071105.Vg7Tg/iTunes7.5.dmg
b7057a5d13d4ff5b1bb0faa5af5d9e203db4cca9

7.6.0.29
http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iTunes7/Mac/061-3983.20080115.i7gnh/iTunes.dmg
f3d68cd00043933a5d1192a39113d21b89e43842

7.6.1.9
http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iTunes7/Mac/061-4265.20080221.MscTs/iTunes.dmg
74844cfb88003535e396fa0437e2df285c909614

7.6.2.9
http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iTunes7/Mac/061-4474.20080402.1Swef/iTunes.dmg
d01c28611f6e23b277b338ee8a594b1d8955aa25

7.7.0.43
http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iTunes7/Mac/061-5099.20080710.frt56/iTunes.dmg
f37043528c43b94451ce53c676647d0a441486a8

7.7.1.11
http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iTunes7/Mac/061-5123.20080730.fr4Ym/iTunes.dmg
3fdaf990a103799255112dccb0e0c01f28d64937

8.0.0.35
http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iTunes8/061-4744.20080909.5Ty6li/iTunes8.dmg
af54727e4b2e0e6bb0c367b34ae5075f36096aef

8.0.1.?
http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iTunes8/061-5553.20081002.kjy65/iTunes801.dmg
722f5603bd12808d895cf822f3c4267febc56b74

8.0.1.11
http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iTunes8/061-5633.20081003.Njki0/iTunes801.dmg
ab5604e2b7492d3f0cf4e2d06520553ed5153039

8.0.1.12
http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iTunes8/061-5649.20081008.hji9O/iTunes801.dmg
35c736471228e0b47a0fb54a52447ec8ff11681f

8.0.2.20
http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iTunes8/061-5810.20081120.wm3n4/iTunes802.dmg
ad1d027ec850af8c70a3af39eb3c47e1192067df

8.1.0.50
http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iTunes8/061-5641.20090311.Cfe4r/iTunes81.dmg
6c9ee64741158c9f45417b965b38b01ea3b51af1

8.1.1.10
http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iTunes8/061-6171.20090406.i98u7/iTunes811.dmg
447933eee85feca7b8a2335e441202794c19b966

8.2.0.23
http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iTunes8/061-6183.20090601.Pldj3/iTunes8.2.dmg
a07c4fb0dfd94ba238024cf8d448165da24e5be5


8.2.1.6
http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iTunes8/061-6715.20090715.cfR54/iTunes8.2.1.dmg
f6d1e5453b7c2ae9a85fe61a7d0eaf972e4d7266

9.0.0.70
http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iTunes9/061-6350.20090909.tnzs2/iTunes9.dmg
eb436fbe738bfa9682805d7ea76bd03c72736e89

9.0.1.8
http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iTunes9/061-7191.20090922.P6uhj/iTunes9.0.1.dmg
eea9dbc34e395a44bfa821501827ea3c5b4c24a9

9.0.2.25
http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iTunes9/061-7197.20091029.tnz9f/iTunes9.0.2.dmg
9ea11cc2ffb54a3779f3d6042756a48f945d2594

9.0.3.15
http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iTunes9/061-7752.20100201.Tz39N/iTunes9.0.3.dmg
980568d7429b1093eff092e8fe68115151c2bb22

9.1.0.79
http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iTunes9/061-7203.20100330.XswP8/iTunes9.1.dmg
cbfe7da9ccc2934395e27ee99ab400c3fdea0595

9.1.1.11
http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iTunes9/061-8084.2010.04.27.6lQSu/iTunes9.1.1.dmg
d240d0326941592b21b0303a65c8a266092c6faa

9.1.1.12
http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iTunes9/061-8202.20100427.5vfkH/iTunes9.1.1.dmg
4d766a400590fa0e11fc28827d4cbc1e8e5802f7

9.2.0.61
http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iTunes9/061-8440.20100616.Tnzs2/iTunes9.2.dmg
fc0cd72f63ce2a39ae24ccc6cdd00c921a8a542e

9.2.1.4
http://appldnld.apple.com/iTunes9/061-8601.20100719.nhy5R/iTunes9.2.1.dmg
96b8d985867f7bdeb440db81303d151d5b94d1d0

9.2.1.5
http://appldnld.apple.com/iTunes9/061-8725.20100722.Bhnyt/iTunes9.2.1.dmg
adc7ca871aace3361575dd78e0f69bcbeca186c8

10.0.0.67
http://appldnld.apple.com/iTunes10/061-8247.20100901.Ktjyt/iTunes10.dmg
936a24a8897d024bddaeab1ef771d8b6e678f1f9

10.0.0.67
http://appldnld.apple.com/iTunes10/061-9183.20100902.X2ndX/iTunes10.dmg
a21838677e073c3888bad217dc375b6989f881cd

10.0.1.22
http://appldnld.apple.com/iTunes10/061-9207.20100924.Nzse2/iTunes10.0.1.dmg
4c12b51e2a2b08a93687fdee0a79390c192117eb

10.0.1.22
http://appldnld.apple.com/iTunes10/061-9447.20100929.Bhny5/iTunes10.0.1.dmg
328ba2970062902e54147082c1c2722ce1d0ab9d


10.1.0.54
http://appldnld.apple.com/iTunes10/061-9530.20101112.MSakc/iTunes10.1.dmg
e8fec05f2bf414585fdcebf52163c8c189779a6f

10.1.1.4
http://appldnld.apple.com/iTunes10/041-0027.20101215.AzsL3/iTunes10.1.1.dmg
69f1f89455c5550e4e6c78dc041ede2242bd7e06

10.1.2.17
http://appldnld.apple.com/iTunes10/061-9991.20110127.ZxsE3/iTunes10.1.2.dmg
75304d4f16f8a790f5a819b04a59b98b563a062f

10.2.0.34
http://appldnld.apple.com/iTunes10/061-9637.20110302.Tnz2t/iTunes10.2.dmg
35da52c03a478d7ff325e67d589e48afd195c9ab

10.2.1.1
http://appldnld.apple.com/iTunes10/041-0475.20110308.mAcaz/iTunes10.2.1.dmg
27fa797873c68b44017a6769b9057e8428d54da8

10.2.2.12
http://appldnld.apple.com/iTunes10/041-0533.20110418.AqP4r/iTunes10.2.2.dmg
7b94065174927dbce71182c89a00b3966021ceb8

10.3.0.54
http://appldnld.apple.com/iTunes10/041-0271.20110606.O0tc5/iTunes10.3.dmg
cdad2cc9c5aa11f3ea23650eab6fe0ae929aab9a

10.3.1.55
http://appldnld.apple.com/iTunes10/041-1632.20110607.SUch3/iTunes10.3.1.dmg
a4707d61a4d0b2d3a76b77b57a6a56f2eef9a5c1

10.4.0.80
http://appldnld.apple.com/iTunes10/041-0717.20110720.MP6Y2/iTunes10.4.dmg
2082404e19bdc1f22033be5ae5a41cf997cb1ce1

10.4.0.80
http://appldnld.apple.com/iTunes10/041-1988.20110720.Rt5Yp/iTunes10.4.dmg
1a0e914a906222004dd0c9b3aac0130584d092ca

10.4.0.80
http://appldnld.apple.com/iTunes10/041-2057.20110726.1WEPD/iTunes10.4.dmg
58c28ed2f98fbd7f5e860fd8968cb3c87d0495a2

10.4.1.10
http://appldnld.apple.com/iTunes10/041-2072.20110822.frk45/iTunes10.4.1.dmg
18c12446addcb7783cfa2954b514705c621fd674

10.5.0.141
http://appldnld.apple.com/iTunes10/041-2597.20111011.PigVe/iTunes10.5.dmg
d6ecdd767b31b6c4661ef97a6a1a1234d2f695d1


10.5.1.42
http://appldnld.apple.com/iTunes10/041-3230.20111114.bNft5/iTunes10.5.1.dmg
08f8ebe3f75d7b98a215750c08b7d6eff7c9ceb9


10.5.2.11
http://appldnld.apple.com/iTunes10/041-3446.20111212.Tgjr4/iTunes10.5.2.dmg
29fbe3c2220ac882276dfd194bc1b8ef6f912a6e


10.5.3.3
http://appldnld.apple.com/iTunes10/041-3779.20120119.Bgty5/iTunes10.5.3.dmg
f27c4e65282f92726aae28d8759dbe4334c7f7ea


10.6.0.40
http://appldnld.apple.com/iTunes10/041-3540.20120307.Defjr/iTunes10.6.dmg
989eae5442d64dfc6dd4ce3ced38eba3fa9609c3


10.6.1.7
http://appldnld.apple.com/iTunes10/041-4792.20120328.fRhny/iTunes10.6.1.dmg
e9067bd7b8add8ef6bba0799df1e5a245c6c8187

10.6.3.25
http://appldnld.apple.com/iTunes10/041-6244.20120611.BbHi8/iTunes10.6.3.dmg
e673e5cbd2955130efbc92a788fff178e66bd155


10.7.0.21
http://appldnld.apple.com/iTunes10/041-7195.20120912.d3uzQ/iTunes10.7.dmg
0ff7c404f87122f89d49ed6c411b3692f1016e0a


11.0.0.163
http://appldnld.apple.com/iTunes11/041-1848.20121129.JoqqW/iTunes11.dmg
4346abd7f532a7f1869feee4437dd318a0b6f532


11.0.1.12
http://appldnld.apple.com/iTunes11/041-8973.20121213.T1fc2/iTunes11.0.1.dmg
83e703e3ab604fdc1f8eba492e153f4d81c5e94f


|

中納言(Ex:現代日本語書き言葉均衡コーパス)


KOTONOHA「現代日本語書き言葉均衡コーパス」 少納言


|

[証明書]Apple Time Stamp

20130103_000428


Apple Intermediate Certificates

Apple - Root Certificate Authority


Apple - Root Certificate Authority[LINK]新しいウィンドで開きます


|

« 2012年12月 | トップページ | 2013年2月 »