AppleScript QR Decode

QRバーコードデコード (QRコードファイルの内容をテキストにする) ちょっと修正


【スクリプトエディタで開く】|

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use framework "CoreImage"
use scripting additions

property refMe : a reference to current application

set appFileManager to refMe's NSFileManager's defaultManager()

###################################
#####ダイアログ
###################################a
tell current application
  set strName to name as text
end tell
if strName is "osascript" then
  tell application "Finder" to activate
else
  tell current application to activate
end if
###ダイアログのデフォルト
set ocidUserDesktopPath to (appFileManager's URLsForDirectory:(refMe's NSDesktopDirectory) inDomains:(refMe's NSUserDomainMask))
set aliasDefaultLocation to ocidUserDesktopPath as alias
set listChooseFileUTI to {"public.image"}
set strPromptText to "QRコードファイルを選んでください" as text
set listAliasFilePath to (choose file with prompt strPromptText default location (aliasDefaultLocation) of type listChooseFileUTI with invisibles and showing package contents without multiple selections allowed) as list
###################################
#パス処理
###################################
###エリアス
set aliasFilePath to item 1 of listAliasFilePath as alias
set strFilePath to (POSIX path of aliasFilePath) as text
set ocidFilePath to refMe's NSString's stringWithString:(strFilePath)
set ocidFilePathURL to refMe's NSURL's alloc()'s initFileURLWithPath:(ocidFilePath) isDirectory:false

###################################
####CIイメージに読み込み
set ocidCiImageInput to (refMe's CIImage's imageWithContentsOfURL:(ocidFilePathURL) options:(missing value))

###################################
# option のDict
set ocidOptionDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
ocidOptionDict's setObject:(refMe's CIDetectorAccuracyHigh) forKey:("CIDetectorAccuracy")
#CIContextのoptionのDict
set ocidContextDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
# kCIContextHighQualityDownsample をセット
ocidContextDict's setObject:(refMe's kCIContextHighQualityDownsample) forKey:("CIContextOption")
# CIContextを初期化
set ocidContext to refMe's CIContext's alloc()'s initWithOptions:(ocidContextDict)
#CIDetector を初期化
set ocidDetector to refMe's CIDetector's detectorOfType:(refMe's CIDetectorTypeQRCode) context:(ocidContext) options:(ocidOptionDict)
####格納用の可変Array
# set ocidFeaturesArray to refMe's NSMutableArray's alloc()'s initWithCapacity:0
#Detectorでの調査して 調査結果をArrayに格納
set ocidFeaturesArray to ocidDetector's featuresInImage:(ocidCiImageInput)
#読み取り結果の数
set numCntFearues to (count of ocidFeaturesArray) as integer
#読み取り結果=0なら戻り値がない
if numCntFearues = 0 then
  set strOutPutText to "読み取り不良 または QRコードが含まれていない"
else if numCntFearues = 1 then
  #####シングルArrayなので1コ目のデータが読み取り結果
  set ocidIQRCodeFeature to ocidFeaturesArray's firstObject()
  #####読み取り結果のテキスト
  set strOutPutText to ("") as text
  set ocidQrCodeMessageString to ocidIQRCodeFeature's messageString()
  set strOutPutText to ocidQrCodeMessageString as text
  #QRコードの画像サイズが欲しい時は
  # log ocidIQRCodeFeature's |bounds|() as list
else
  ##1ファイルに複数バーコードがある場合
  set strOutPutText to ("") as text
  repeat with itemArray in ocidFeaturesArray
    set ocidQrCodeMessageString to itemArray's messageString()
    set strOutPutText to (strOutPutText & ocidQrCodeMessageString & "\n") as text
  end repeat
  
end if


###################################
##### ダイアログ
###################################
set aliasIconPath to POSIX file "/System/Applications/Preview.app/Contents/Resources/AppIcon.icns" as alias
set strDefaultAnswer to strOutPutText as text
set strFilePath to ocidFilePath as text
try
  set strMes to ("戻り値です\r" & strFilePath) as text
  
  set recordResult to (display dialog strMes with title "bundle identifier" default answer strOutPutText buttons {"クリップボードにコピー", "キャンセル", "ファイル書出"} default button "ファイル書出" cancel button "キャンセル" giving up after 20 with icon aliasIconPath without hidden answer)
on error
log "エラーしました"
return "エラーしました"
  error number -128
end try
if true is equal to (gave up of recordResult) then
return "時間切れですやりなおしてください"
  error number -128
end if
if "ファイル書出" is equal to (button returned of recordResult) then
  ###################################
  #####保存ダイアログ
  ###################################
  ###ファイル名
  set strPrefixName to ocidPrefixName as text
  ###拡張子変える場合
  set strFileExtension to "txt"
  ###ダイアログに出すファイル名
  set strDefaultName to (strPrefixName & ".output." & strFileExtension) as text
  set strPromptText to "名前を決めてください"
  ###選んだファイルの同階層をデフォルト
  set aliasDefaultLocation to ocidContainerDirPathURL as alias
  ####ファイル名ダイアログ
  ####実在しない『はず』なのでas «class furl»で
  set aliasSaveFilePath to (choose file name default location aliasDefaultLocation default name strDefaultName with prompt strPromptText) as «class furl»
  ####UNIXパス
  set strSaveFilePath to POSIX path of aliasSaveFilePath as text
  ####ドキュメントのパスをNSString
  set ocidSaveFilePath to refMe's NSString's stringWithString:strSaveFilePath
  ####ドキュメントのパスをNSURLに
  set ocidSaveFilePathURL to refMe's NSURL's fileURLWithPath:ocidSaveFilePath
  ###拡張子取得
  set strFileExtensionName to ocidSaveFilePathURL's pathExtension() as text
  ###ダイアログで拡張子を取っちゃった時対策
  if strFileExtensionName is not strFileExtension then
    set ocidSaveFilePathURL to ocidSaveFilePathURL's URLByAppendingPathExtension:strFileExtension
  end if
  
  set boolFileWrite to (ocidQrCodeMessageString's writeToURL:ocidSaveFilePathURL atomically:false encoding:(refMe's NSUTF8StringEncoding) |error|:(reference))
else if button returned of recordResult is "クリップボードにコピー" then
  try
    set strText to text returned of recordResult as text
    ####ペーストボード宣言
    set appPasteboard to refMe's NSPasteboard's generalPasteboard()
    set ocidText to (refMe's NSString's stringWithString:(strText))
appPasteboard's clearContents()
appPasteboard's setString:(ocidText) forType:(refMe's NSPasteboardTypeString)
  on error
    tell application "Finder"
      set the clipboard to strTitle as text
    end tell
  end try
return "処理終了"
  
else
log "エラーしました"
return "エラーしました"
  error number -128
end if


|

[json]QRコードのイメージファイルをデコードする


【スクリプトエディタで開く】|

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#om.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use scripting additions

property refMe : a reference to current application


#####デフォルトロケーション
tell application "Finder"
  set aliasDefaultLocation to (path to desktop folder from user domain) as alias
end tell

#####ファイル選択のダイアログ
tell current application
  set strName to name as text
end tell
####スクリプトメニューから実行したら
if strName is "osascript" then
  tell application "Finder" to activate
else
  tell current application to activate
end if
#
set aliasFilePath to (choose file with prompt "QRコードのイメージファイルを選んでください" default location (aliasDefaultLocation) of type {"public.image"} with invisibles and showing package contents without multiple selections allowed) as alias
#####戻り値をパスに
set strFilePath to (POSIX path of aliasFilePath) as text

#####コマンドライン整形
set strCommandText to "/usr/bin/curl -X POST -H \"Content-Type: multipart/form-data\" -F \"file=@" & strFilePath & "\" \"http://api.qrserver.com/v1/read-qr-code/\" "
#####コマンド実行 戻り値はJSON
set jsonResponse to (do shell script strCommandText) as text
#####JSONの値を格納
set ocidJsonResponse to (refMe's NSJSONSerialization's JSONObjectWithData:((refMe's NSString's stringWithString:(jsonResponse))'s dataUsingEncoding:(refMe's NSUTF8StringEncoding)) options:0 |error|:(missing value))
#####値を取り出す
set recodeCenters to (ocidJsonResponse's symbol)'s valueForKey:"data"
#####ダイアログを出す
tell current application
  set strName to name as text
end tell
####スクリプトメニューから実行したら
if strName is "osascript" then
  tell application "Finder" to activate
else
  tell current application to activate
end if
set aliasIconPath to POSIX file "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/BookmarkIcon.icns" as alias
display dialog "QRバーコードの内容・デコード結果" with title "グローバル情報" default answer (recodeCenters as text) buttons {"OK", "キャンセル"} default button "OK" cancel button "キャンセル" with icon aliasIconPath giving up after 10 without hidden answer

log (recodeCenters as text)

|

[VCARD]カレンダー、イベント、連絡先QRバーコードのデコード(読み取り+各ファイル作成)


【スクリプトエディタで開く】|

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use framework "AppKit"
use framework "CoreImage"
use scripting additions

property refMe : a reference to current application

set objFileManager to refMe's NSFileManager's defaultManager()

###################################
#####ダイアログ
###################################
tell current application
  set strName to name as text
end tell
if strName is "osascript" then
  tell application "Finder" to activate
else
  tell current application to activate
end if
###ダイアログのデフォルト
set ocidUserDesktopPath to (objFileManager's URLsForDirectory:(refMe's NSDesktopDirectory) inDomains:(refMe's NSUserDomainMask))
set aliasDefaultLocation to ocidUserDesktopPath as alias
set listChooseFileUTI to {"public.image"}
set strPromptText to "QRコードファイルを選んでください" as text
set listAliasFilePath to (choose file with prompt strPromptText default location (aliasDefaultLocation) of type listChooseFileUTI with invisibles and showing package contents without multiple selections allowed) as list
###################################
#####パス処理
###################################
###エリアス
set aliasFilePath to item 1 of listAliasFilePath as alias
###UNIXパス
set strFilePath to POSIX path of aliasFilePath as text
###String
set ocidFilePath to refMe's NSString's stringWithString:strFilePath
###NSURL
set ocidFilePathURL to refMe's NSURL's alloc()'s initFileURLWithPath:ocidFilePath isDirectory:false
####ファイル名を取得
set ocidFileName to ocidFilePathURL's lastPathComponent()
####拡張子を取得
set ocidFileExtension to ocidFilePathURL's pathExtension()
####ファイル名から拡張子を取っていわゆるベースファイル名を取得
set ocidPrefixName to ocidFileName's stringByDeletingPathExtension
####コンテナ
set ocidContainerDirPathURL to ocidFilePathURL's URLByDeletingLastPathComponent()


###################################
##### QRコードイメージファイル読み込み 
###################################
####CIイメージに読み込み
set ocidCiImageInput to (refMe's CIImage's imageWithContentsOfURL:(ocidFilePathURL) options:(missing value))
########################
####CIDetectorを定義 CIDetectorTypeQRCode
set ocidDetector to refMe's CIDetector's detectorOfType:(refMe's CIDetectorTypeQRCode) context:(missing value) options:{CIDetectorAccuracy:(refMe's CIDetectorAccuracyHigh)}
#####ocidDetectorを通して結果をArrayに格納
set ocidFeaturesArray to ocidDetector's featuresInImage:(ocidCiImageInput)
if (count of ocidFeaturesArray) = 0 then
return "読み取り不良"
end if
####messageString格納用のArray
set ocidOutPutArrayM to refMe's NSMutableArray's alloc()'s initWithCapacity:(0)
####Featuresの数だけ繰り返し
repeat with itemFeaturesArray in ocidFeaturesArray
  #####読み取り結果のテキスト messageString
  log itemFeaturesArray's type() as text
  log className() of itemFeaturesArray as text
  log itemFeaturesArray's |bounds|() as list
  set ocidMessageString to itemFeaturesArray's messageString()
(ocidOutPutArrayM's addObject:(ocidMessageString))
end repeat
####複数見つかった場合はエラーで止める
if (ocidOutPutArrayM's |count|()) > 1 then
return "読み取り結果が複数見つかりました"
else
  set ocidQRdecodeText to ocidOutPutArrayM's firstObject()
  set strQRdecodeText to ocidQRdecodeText as text
end if
log strQRdecodeText
###################################
##### 読み取り結果整形
###################################
if strQRdecodeText starts with "BEGIN:VCARD" then
  
  ###拡張子
  set strFileExtension to "vcf" as text
  ###ダイアログに出すファイル名
  set strDefaultName to ("VCARD" & "." & strFileExtension) as text
else if strQRdecodeText starts with "BEGIN:VEVENT" then
  set strQRdecodeText to "BEGIN:VCALENDAR\n" & strQRdecodeText & "\nEND:VCALENDAR" as text
  ###拡張子
  set strFileExtension to "ics" as text
  ###ダイアログに出すファイル名
  set strDefaultName to ("VEVENT" & "." & strFileExtension) as text
else if strQRdecodeText starts with "BEGIN:VCALENDAR" then
  
  
  ###拡張子
  set strFileExtension to "ics" as text
  ###ダイアログに出すファイル名
  set strDefaultName to ("VCALENDAR" & "." & strFileExtension) as text
else
return "読み取り不良 バーコードが見つかりません"
end if


###################################
##### ダイアログ
###################################
#####ダイアログを前面に
tell current application
  set strName to name as text
end tell
####スクリプトメニューから実行したら
if strName is "osascript" then
  tell application "Finder" to activate
else
  tell current application to activate
end if
set aliasIconPath to POSIX file "/System/Applications/Preview.app/Contents/Resources/AppIcon.icns" as alias

try
  set recordResponse to (display dialog "コピーしてください" with title "QRコード読み取り結果" default answer strQRdecodeText buttons {"クリップボードにコピー", "終了", "ファイル出力"} default button "ファイル出力" cancel button "終了" with icon aliasIconPath giving up after 30 without hidden answer)
  
on error
  log "エラーしました"
return "エラーしました"
  error number -128
end try
if true is equal to (gave up of recordResponse) then
return "時間切れですやりなおしてください"
  error number -128
end if

if "終了" is equal to (button returned of recordResponse) then
return "処理終了"
else if button returned of recordResponse is "クリップボードにコピー" then
  try
    set strText to text returned of recordResponse as text
    ####ペーストボード宣言
    set appPasteboard to refMe's NSPasteboard's generalPasteboard()
    set ocidText to (refMe's NSString's stringWithString:(strText))
appPasteboard's clearContents()
appPasteboard's setString:(ocidText) forType:(refMe's NSPasteboardTypeString)
return "処理終了"
  on error
    tell application "Finder"
      set the clipboard to strText as text
    end tell
return "エラーしました"
  end try
  
end if

###################################
#####保存ダイアログ
###################################
#####ダイアログを前面に
tell current application
  set strName to name as text
end tell
####スクリプトメニューから実行したら
if strName is "osascript" then
  tell application "Finder" to activate
else
  tell current application to activate
end if

set strPromptText to "名前を決めてください"
###選んだファイルの同階層をデフォルト
set aliasDefaultLocation to ocidContainerDirPathURL as alias
####ファイル名ダイアログ
####実在しない『はず』なのでas «class furl»で
set aliasSaveFilePath to (choose file name default location aliasDefaultLocation default name strDefaultName with prompt strPromptText) as «class furl»
####UNIXパス
set strSaveFilePath to POSIX path of aliasSaveFilePath as text
####ドキュメントのパスをNSString
set ocidSaveFilePath to refMe's NSString's stringWithString:strSaveFilePath
####ドキュメントのパスをNSURLに
set ocidSaveFilePathURL to refMe's NSURL's fileURLWithPath:ocidSaveFilePath
###拡張子取得
set strFileExtensionName to ocidSaveFilePathURL's pathExtension() as text
###ダイアログで拡張子を取っちゃった時対策
if strFileExtensionName is not strFileExtension then
  set ocidSaveFilePathURL to ocidSaveFilePathURL's URLByAppendingPathExtension:(strFileExtension)
end if

###################################
##### ファイルに書き出し
###################################
set ocidContents to refMe's NSString's stringWithString:(strQRdecodeText)

set listDone to (ocidContents's writeToURL:(ocidSaveFilePathURL) atomically:false encoding:(refMe's NSUTF8StringEncoding) |error|:(reference))

#####################
### Finderで保存先を開く
set appSharedWorkspace to refMe's NSWorkspace's sharedWorkspace()
set boolDone to appSharedWorkspace's selectFile:(ocidSaveFilePathURL's |path|()) inFileViewerRootedAtPath:(ocidContainerDirPathURL's |path|())



################################
# 日付 doGetDateNo(argDateFormat,argCalendarNO)
# argCalendarNO 1 NSCalendarIdentifierGregorian 西暦
# argCalendarNO 2 NSCalendarIdentifierJapanese 和暦
################################
to doGetDateNo({argDateFormat, argCalendarNO})
  ##渡された値をテキストで確定させて
  set strDateFormat to argDateFormat as text
  set intCalendarNO to argCalendarNO as integer
  ###日付情報の取得
  set ocidDate to current application's NSDate's |date|()
  ###日付のフォーマットを定義(日本語)
  set ocidFormatterJP to current application's NSDateFormatter's alloc()'s init()
  ###和暦 西暦 カレンダー分岐
  if intCalendarNO = 1 then
    set ocidCalendarID to (current application's NSCalendarIdentifierGregorian)
  else if intCalendarNO = 2 then
    set ocidCalendarID to (current application's NSCalendarIdentifierJapanese)
  else
    set ocidCalendarID to (current application's NSCalendarIdentifierISO8601)
  end if
  set ocidCalendarJP to current application's NSCalendar's alloc()'s initWithCalendarIdentifier:(ocidCalendarID)
  set ocidTimezoneJP to current application's NSTimeZone's alloc()'s initWithName:("Asia/Tokyo")
  set ocidLocaleJP to current application's NSLocale's alloc()'s initWithLocaleIdentifier:("ja_JP_POSIX")
  ###設定
ocidFormatterJP's setTimeZone:(ocidTimezoneJP)
ocidFormatterJP's setLocale:(ocidLocaleJP)
ocidFormatterJP's setCalendar:(ocidCalendarJP)
  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterNoStyle)
  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterShortStyle)
  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterMediumStyle)
  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterLongStyle)
ocidFormatterJP's setDateStyle:(current application's NSDateFormatterFullStyle)
  ###渡された値でフォーマット定義
ocidFormatterJP's setDateFormat:(strDateFormat)
  ###フォーマット適応
  set ocidDateAndTime to ocidFormatterJP's stringFromDate:(ocidDate)
  ###テキストで戻す
  set strDateAndTime to ocidDateAndTime as text
return strDateAndTime
end doGetDateNo



|

[WIFI]WIFI接続用QRバーコードのデコード(読み取り+mobileconfigファイル作成)


【スクリプトエディタで開く】|

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use framework "AppKit"
use framework "CoreImage"
use scripting additions

property refMe : a reference to current application

set objFileManager to refMe's NSFileManager's defaultManager()

###################################
#####ダイアログ
###################################
tell current application
  set strName to name as text
end tell
if strName is "osascript" then
  tell application "Finder" to activate
else
  tell current application to activate
end if
###ダイアログのデフォルト
set ocidUserDesktopPath to (objFileManager's URLsForDirectory:(refMe's NSDesktopDirectory) inDomains:(refMe's NSUserDomainMask))
set aliasDefaultLocation to ocidUserDesktopPath as alias
set listChooseFileUTI to {"public.image"}
set strPromptText to "QRコードファイルを選んでください" as text
set listAliasFilePath to (choose file with prompt strPromptText default location (aliasDefaultLocation) of type listChooseFileUTI with invisibles and showing package contents without multiple selections allowed) as list
###################################
#####パス処理
###################################
###エリアス
set aliasFilePath to item 1 of listAliasFilePath as alias
###UNIXパス
set strFilePath to POSIX path of aliasFilePath as text
###String
set ocidFilePath to refMe's NSString's stringWithString:strFilePath
###NSURL
set ocidFilePathURL to refMe's NSURL's alloc()'s initFileURLWithPath:ocidFilePath isDirectory:false
####ファイル名を取得
set ocidFileName to ocidFilePathURL's lastPathComponent()
####拡張子を取得
set ocidFileExtension to ocidFilePathURL's pathExtension()
####ファイル名から拡張子を取っていわゆるベースファイル名を取得
set ocidPrefixName to ocidFileName's stringByDeletingPathExtension
####コンテナ
set ocidContainerDirPathURL to ocidFilePathURL's URLByDeletingLastPathComponent()


###################################
##### QRコードイメージファイル読み込み 
###################################
####CIイメージに読み込み
set ocidCiImageInput to (refMe's CIImage's imageWithContentsOfURL:(ocidFilePathURL) options:(missing value))
########################
####CIDetectorを定義 CIDetectorTypeQRCode
set ocidDetector to refMe's CIDetector's detectorOfType:(refMe's CIDetectorTypeQRCode) context:(missing value) options:{CIDetectorAccuracy:(refMe's CIDetectorAccuracyHigh)}
#####ocidDetectorを通して結果をArrayに格納
set ocidFeaturesArray to ocidDetector's featuresInImage:(ocidCiImageInput)
if (count of ocidFeaturesArray) = 0 then
return "読み取り不良"
end if
####messageString格納用のArray
set ocidOutPutArrayM to refMe's NSMutableArray's alloc()'s initWithCapacity:(0)
####Featuresの数だけ繰り返し
repeat with itemFeaturesArray in ocidFeaturesArray
  #####読み取り結果のテキスト messageString
  log itemFeaturesArray's type() as text
  log className() of itemFeaturesArray as text
  log itemFeaturesArray's |bounds|() as list
  set ocidMessageString to itemFeaturesArray's messageString()
(ocidOutPutArrayM's addObject:(ocidMessageString))
end repeat
####複数見つかった場合はエラーで止める
if (ocidOutPutArrayM's |count|()) > 1 then
return "読み取り結果が複数見つかりました"
else
  set ocidQRdecodeText to ocidOutPutArrayM's firstObject()
  set strQRdecodeText to ocidQRdecodeText as text
end if
log strQRdecodeText
###################################
##### WIFIバーコード 読み取り結果整形
###################################
if strQRdecodeText starts with "WIFI:" then
  set ocidQRdecodeArray to ocidQRdecodeText's componentsSeparatedByString:(";")
  repeat with itemQRdecodeString in ocidQRdecodeArray
    set ocidItemQRdecodeArray to (itemQRdecodeString's componentsSeparatedByString:(":"))
    set boolPreFix to ((ocidItemQRdecodeArray's firstObject())'s hasPrefix:("WIFI"))
    log boolPreFix
    log ocidItemQRdecodeArray as list
    if boolPreFix = true then
      if ((ocidItemQRdecodeArray's objectAtIndex:(1))'s hasPrefix:("S")) = true then
set strSSID to (ocidItemQRdecodeArray's objectAtIndex:(2)) as text
      else if ((ocidItemQRdecodeArray's objectAtIndex:(1))'s hasPrefix:("P")) = true then
set strPW to (ocidItemQRdecodeArray's objectAtIndex:(2)) as text
      else if ((ocidItemQRdecodeArray's objectAtIndex:(1))'s hasPrefix:("T")) = true then
set strEnc to (ocidItemQRdecodeArray's objectAtIndex:(2)) as text
      end if
    else if ((ocidItemQRdecodeArray's firstObject())'s hasPrefix:("S")) = true then
      set strSSID to (ocidItemQRdecodeArray's lastObject()) as text
    else if ((ocidItemQRdecodeArray's firstObject())'s hasPrefix:("P")) = true then
      set strPW to (ocidItemQRdecodeArray's lastObject()) as text
    else if ((ocidItemQRdecodeArray's firstObject())'s hasPrefix:("T")) = true then
      set strEnc to (ocidItemQRdecodeArray's lastObject()) as text
    end if
  end repeat
else
return "読み取り不良 WIFIバーコードが見つかりません"
end if
###################################
##### WIFIバーコード 読み取り結果整形
###################################
set ocidPlistDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
###PayloadDisplayName
set strSetValue to ("WIFI." & strSSID) as text
ocidPlistDict's setValue:(strSetValue) forKey:("PayloadDisplayName")
###PayloadIdentifier
set ocidUUID to refMe's NSUUID's alloc()'s init()
set strUUID to ocidUUID's UUIDString()
set strSetValue to ("WIFI." & strUUID) as text
ocidPlistDict's setValue:(strUUID) forKey:("PayloadIdentifier")
###PayloadUUID
ocidPlistDict's setValue:(strUUID) forKey:("PayloadUUID")
###PayloadType
ocidPlistDict's setValue:("Configuration") forKey:("PayloadType")
###PayloadType
ocidPlistDict's setValue:("User") forKey:("PayloadScope")
###PayloadVersion
set strDateNO to doGetDateNo({"yyyyMMdd", 1})
ocidPlistDict's setValue:(refMe's NSNumber's numberWithInteger:strDateNO) forKey:("PayloadVersion")
##################
set ocidPayloadDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
###AutoJoin
ocidPayloadDict's setValue:(refMe's NSNumber's numberWithBool:true) forKey:("AutoJoin")
###HIDDEN_NETWORK
ocidPayloadDict's setValue:(refMe's NSNumber's numberWithBool:false) forKey:("HIDDEN_NETWORK")
###HIDDEN_NETWORK
ocidPayloadDict's setValue:(strPW) forKey:("Password")
###HIDDEN_NETWORK
ocidPayloadDict's setValue:(strEnc) forKey:("EncryptionType")
###HIDDEN_NETWORK
ocidPayloadDict's setValue:(strSSID) forKey:("SSID_STR")
###PayloadDisplayName
set strSetValue to ("WIFI." & strSSID) as text
ocidPayloadDict's setValue:(strSetValue) forKey:("PayloadDisplayName")
###PayloadIdentifier
set ocidUUID to refMe's NSUUID's alloc()'s init()
set strUUID to ocidUUID's UUIDString()
set strSetValue to ("com.apple.wifi.managed." & strUUID) as text
ocidPayloadDict's setValue:(strSetValue) forKey:("PayloadIdentifier")
###PayloadUUID
ocidPayloadDict's setValue:(strUUID) forKey:("PayloadUUID")
###PayloadType
ocidPayloadDict's setValue:("com.apple.wifi.managed") forKey:("PayloadType")
###PayloadVersion
ocidPayloadDict's setValue:(refMe's NSNumber's numberWithInteger:strDateNO) forKey:("PayloadVersion")
##################
set ocidPayloadArray to refMe's NSMutableArray's alloc()'s initWithCapacity:(0)
ocidPayloadArray's addObject:(ocidPayloadDict)
ocidPlistDict's setObject:(ocidPayloadArray) forKey:("PayloadContent")
###
set ocidFromat to refMe's NSPropertyListXMLFormat_v1_0
set listPlistEditData to refMe's NSPropertyListSerialization's dataWithPropertyList:(ocidPlistDict) format:(ocidFromat) options:0 |error|:(reference)
set ocidPlistEditData to item 1 of listPlistEditData


###################################
##### ダイアログ
###################################
#####ダイアログを前面に
tell current application
  set strName to name as text
end tell
####スクリプトメニューから実行したら
if strName is "osascript" then
  tell application "Finder" to activate
else
  tell current application to activate
end if
set aliasIconPath to POSIX file "/System/Applications/Preview.app/Contents/Resources/AppIcon.icns" as alias

try
  set recordResponse to (display dialog "コピーしてください" with title "QRコード読み取り結果" default answer strQRdecodeText buttons {"クリップボードにコピー", "終了", "ファイル出力"} default button "ファイル出力" cancel button "終了" with icon aliasIconPath giving up after 30 without hidden answer)
  
on error
  log "エラーしました"
return "エラーしました"
  error number -128
end try
if true is equal to (gave up of recordResponse) then
return "時間切れですやりなおしてください"
  error number -128
end if

if "終了" is equal to (button returned of recordResponse) then
return "処理終了"
else if button returned of recordResponse is "クリップボードにコピー" then
  try
    set strText to text returned of recordResponse as text
    ####ペーストボード宣言
    set appPasteboard to refMe's NSPasteboard's generalPasteboard()
    set ocidText to (refMe's NSString's stringWithString:(strText))
appPasteboard's clearContents()
appPasteboard's setString:(ocidText) forType:(refMe's NSPasteboardTypeString)
return "処理終了"
  on error
    tell application "Finder"
      set the clipboard to strText as text
    end tell
return "エラーしました"
  end try
  
end if

###################################
#####保存ダイアログ
###################################
#####ダイアログを前面に
tell current application
  set strName to name as text
end tell
####スクリプトメニューから実行したら
if strName is "osascript" then
  tell application "Finder" to activate
else
  tell current application to activate
end if
###ファイル名
set strPrefixName to ocidPrefixName as text
set strFileExtension to "mobileconfig" as text
###ダイアログに出すファイル名
set strDefaultName to ("WIFI." & strPrefixName & ".mobileconfig") as text
set strPromptText to "名前を決めてください"
###選んだファイルの同階層をデフォルト
set aliasDefaultLocation to ocidContainerDirPathURL as alias
####ファイル名ダイアログ
####実在しない『はず』なのでas «class furl»で
set aliasSaveFilePath to (choose file name default location aliasDefaultLocation default name strDefaultName with prompt strPromptText) as «class furl»
####UNIXパス
set strSaveFilePath to POSIX path of aliasSaveFilePath as text
####ドキュメントのパスをNSString
set ocidSaveFilePath to refMe's NSString's stringWithString:strSaveFilePath
####ドキュメントのパスをNSURLに
set ocidSaveFilePathURL to refMe's NSURL's fileURLWithPath:ocidSaveFilePath
###拡張子取得
set strFileExtensionName to ocidSaveFilePathURL's pathExtension() as text
###ダイアログで拡張子を取っちゃった時対策
if strFileExtensionName is not strFileExtension then
  set ocidSaveFilePathURL to ocidSaveFilePathURL's URLByAppendingPathExtension:(strFileExtension)
end if

###################################
##### ファイルに書き出し
###################################
set boolDone to ocidPlistEditData's writeToURL:(ocidSaveFilePathURL) options:0 |error|:(reference)
log item 1 of boolDone as boolean

#####################
### Finderで保存先を開く
set appSharedWorkspace to refMe's NSWorkspace's sharedWorkspace()
set boolDone to appSharedWorkspace's selectFile:(ocidSaveFilePathURL's |path|()) inFileViewerRootedAtPath:(ocidContainerDirPathURL's |path|())






################################
# 日付 doGetDateNo(argDateFormat,argCalendarNO)
# argCalendarNO 1 NSCalendarIdentifierGregorian 西暦
# argCalendarNO 2 NSCalendarIdentifierJapanese 和暦
################################
to doGetDateNo({argDateFormat, argCalendarNO})
  ##渡された値をテキストで確定させて
  set strDateFormat to argDateFormat as text
  set intCalendarNO to argCalendarNO as integer
  ###日付情報の取得
  set ocidDate to current application's NSDate's |date|()
  ###日付のフォーマットを定義(日本語)
  set ocidFormatterJP to current application's NSDateFormatter's alloc()'s init()
  ###和暦 西暦 カレンダー分岐
  if intCalendarNO = 1 then
    set ocidCalendarID to (current application's NSCalendarIdentifierGregorian)
  else if intCalendarNO = 2 then
    set ocidCalendarID to (current application's NSCalendarIdentifierJapanese)
  else
    set ocidCalendarID to (current application's NSCalendarIdentifierISO8601)
  end if
  set ocidCalendarJP to current application's NSCalendar's alloc()'s initWithCalendarIdentifier:(ocidCalendarID)
  set ocidTimezoneJP to current application's NSTimeZone's alloc()'s initWithName:("Asia/Tokyo")
  set ocidLocaleJP to current application's NSLocale's alloc()'s initWithLocaleIdentifier:("ja_JP_POSIX")
  ###設定
ocidFormatterJP's setTimeZone:(ocidTimezoneJP)
ocidFormatterJP's setLocale:(ocidLocaleJP)
ocidFormatterJP's setCalendar:(ocidCalendarJP)
  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterNoStyle)
  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterShortStyle)
  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterMediumStyle)
  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterLongStyle)
ocidFormatterJP's setDateStyle:(current application's NSDateFormatterFullStyle)
  ###渡された値でフォーマット定義
ocidFormatterJP's setDateFormat:(strDateFormat)
  ###フォーマット適応
  set ocidDateAndTime to ocidFormatterJP's stringFromDate:(ocidDate)
  ###テキストで戻す
  set strDateAndTime to ocidDateAndTime as text
return strDateAndTime
end doGetDateNo



|

[URL]URLリンク、MailtoリンクのQRバーコードのデコード(読み取り+WEBLOCファイル作成)


【スクリプトエディタで開く】|

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use framework "AppKit"
use framework "CoreImage"
use scripting additions

property refMe : a reference to current application

set objFileManager to refMe's NSFileManager's defaultManager()

###################################
#####ダイアログ
###################################
tell current application
  set strName to name as text
end tell
if strName is "osascript" then
  tell application "Finder" to activate
else
  tell current application to activate
end if
###ダイアログのデフォルト
set ocidUserDesktopPath to (objFileManager's URLsForDirectory:(refMe's NSDesktopDirectory) inDomains:(refMe's NSUserDomainMask))
set aliasDefaultLocation to ocidUserDesktopPath as alias
set listChooseFileUTI to {"public.image"}
set strPromptText to "QRコードファイルを選んでください" as text
set listAliasFilePath to (choose file with prompt strPromptText default location (aliasDefaultLocation) of type listChooseFileUTI with invisibles and showing package contents without multiple selections allowed) as list
###################################
#####パス処理
###################################
###エリアス
set aliasFilePath to item 1 of listAliasFilePath as alias
###UNIXパス
set strFilePath to POSIX path of aliasFilePath as text
###String
set ocidFilePath to refMe's NSString's stringWithString:strFilePath
###NSURL
set ocidFilePathURL to refMe's NSURL's alloc()'s initFileURLWithPath:ocidFilePath isDirectory:false
####ファイル名を取得
set ocidFileName to ocidFilePathURL's lastPathComponent()
####拡張子を取得
set ocidFileExtension to ocidFilePathURL's pathExtension()
####ファイル名から拡張子を取っていわゆるベースファイル名を取得
set ocidPrefixName to ocidFileName's stringByDeletingPathExtension
####コンテナ
set ocidContainerDirPathURL to ocidFilePathURL's URLByDeletingLastPathComponent()


###################################
##### QRコードイメージファイル読み込み 
###################################
####CIイメージに読み込み
set ocidCiImageInput to (refMe's CIImage's imageWithContentsOfURL:(ocidFilePathURL) options:(missing value))
########################
####CIDetectorを定義 CIDetectorTypeQRCode
set ocidDetector to refMe's CIDetector's detectorOfType:(refMe's CIDetectorTypeQRCode) context:(missing value) options:{CIDetectorAccuracy:(refMe's CIDetectorAccuracyHigh)}
#####ocidDetectorを通して結果をArrayに格納
set ocidFeaturesArray to ocidDetector's featuresInImage:(ocidCiImageInput)
if (count of ocidFeaturesArray) = 0 then
return "読み取り不良"
end if
####messageString格納用のArray
set ocidOutPutArrayM to refMe's NSMutableArray's alloc()'s initWithCapacity:(0)
####Featuresの数だけ繰り返し
repeat with itemFeaturesArray in ocidFeaturesArray
  #####読み取り結果のテキスト messageString
  log itemFeaturesArray's type() as text
  log className() of itemFeaturesArray as text
  log itemFeaturesArray's |bounds|() as list
  set ocidMessageString to itemFeaturesArray's messageString()
(ocidOutPutArrayM's addObject:(ocidMessageString))
end repeat
####複数見つかった場合はエラーで止める
if (ocidOutPutArrayM's |count|()) > 1 then
return "読み取り結果が複数見つかりました"
else
  set ocidQRdecodeText to ocidOutPutArrayM's firstObject()
  set strQRdecodeText to ocidQRdecodeText as text
end if
log strQRdecodeText
###################################
##### 読み取り結果整形
###################################
if strQRdecodeText starts with "http" then
  set ocidURLText to refMe's NSString's stringWithString:(strQRdecodeText)
  set ocidURL to refMe's NSURL's URLWithString:(ocidURLText)
  set strURL to ocidURL's absoluteString() as text
  set strHostName to (ocidURL's |host|()) as text
  set strFileExtension to "webloc" as text
  ###ファイル名
  set strPrefixName to ocidPrefixName as text
  ###ダイアログに出すファイル名
  set strDefaultName to ("QR." & strHostName & "." & strFileExtension) as text
else if strQRdecodeText starts with "mailto:" then
  set ocidURLText to refMe's NSString's stringWithString:(strQRdecodeText)
  set ocidURL to refMe's NSURL's URLWithString:(ocidURLText)
  set strURL to ocidURL's absoluteString() as text
  ###Emailアドレスを取り出すにはコンポーネントに分割してから
  set ocidComponent to refMe's NSURLComponents's componentsWithURL:(ocidURL) resolvingAgainstBaseURL:(false)
  set strEmailAdd to (ocidComponent's |path|()) as text
  log strEmailAdd
  set strFileExtension to "mailloc" as text
  ###ファイル名
  set strPrefixName to ocidPrefixName as text
  ###ダイアログに出すファイル名
  set strDefaultName to ("QR." & strEmailAdd & "." & strFileExtension) as text
else
return "読み取り不良 WIFIバーコードが見つかりません"
end if


###################################
##### ダイアログ
###################################
#####ダイアログを前面に
tell current application
  set strName to name as text
end tell
####スクリプトメニューから実行したら
if strName is "osascript" then
  tell application "Finder" to activate
else
  tell current application to activate
end if
set aliasIconPath to POSIX file "/System/Applications/Preview.app/Contents/Resources/AppIcon.icns" as alias

try
  set recordResponse to (display dialog "コピーしてください" with title "QRコード読み取り結果" default answer strQRdecodeText buttons {"クリップボードにコピー", "終了", "ファイル出力"} default button "ファイル出力" cancel button "終了" with icon aliasIconPath giving up after 30 without hidden answer)
  
on error
  log "エラーしました"
return "エラーしました"
  error number -128
end try
if true is equal to (gave up of recordResponse) then
return "時間切れですやりなおしてください"
  error number -128
end if

if "終了" is equal to (button returned of recordResponse) then
return "処理終了"
else if button returned of recordResponse is "クリップボードにコピー" then
  try
    set strText to text returned of recordResponse as text
    ####ペーストボード宣言
    set appPasteboard to refMe's NSPasteboard's generalPasteboard()
    set ocidText to (refMe's NSString's stringWithString:(strText))
appPasteboard's clearContents()
appPasteboard's setString:(ocidText) forType:(refMe's NSPasteboardTypeString)
return "処理終了"
  on error
    tell application "Finder"
      set the clipboard to strText as text
    end tell
return "エラーしました"
  end try
  
end if

###################################
#####保存ダイアログ
###################################
#####ダイアログを前面に
tell current application
  set strName to name as text
end tell
####スクリプトメニューから実行したら
if strName is "osascript" then
  tell application "Finder" to activate
else
  tell current application to activate
end if

set strPromptText to "名前を決めてください"
###選んだファイルの同階層をデフォルト
set aliasDefaultLocation to ocidContainerDirPathURL as alias
####ファイル名ダイアログ
####実在しない『はず』なのでas «class furl»で
set aliasSaveFilePath to (choose file name default location aliasDefaultLocation default name strDefaultName with prompt strPromptText) as «class furl»
####UNIXパス
set strSaveFilePath to POSIX path of aliasSaveFilePath as text
####ドキュメントのパスをNSString
set ocidSaveFilePath to refMe's NSString's stringWithString:strSaveFilePath
####ドキュメントのパスをNSURLに
set ocidSaveFilePathURL to refMe's NSURL's fileURLWithPath:ocidSaveFilePath
###拡張子取得
set strFileExtensionName to ocidSaveFilePathURL's pathExtension() as text
###ダイアログで拡張子を取っちゃった時対策
if strFileExtensionName is not strFileExtension then
  set ocidSaveFilePathURL to ocidSaveFilePathURL's URLByAppendingPathExtension:(strFileExtension)
end if

###################################
##### ファイルに書き出し
###################################
###NSMutableDictionaryにセット
set ocidPlistDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
ocidPlistDict's setValue:(strQRdecodeText) forKey:("URL")
###plist初期化
set ocidFromat to refMe's NSPropertyListXMLFormat_v1_0
set listPlistEditData to refMe's NSPropertyListSerialization's dataWithPropertyList:(ocidPlistDict) format:(ocidFromat) options:0 |error|:(reference)
set ocidPlistEditData to item 1 of listPlistEditData
###保存
set boolDone to ocidPlistEditData's writeToURL:(ocidSaveFilePathURL) options:0 |error|:(reference)
log item 1 of boolDone as boolean

#####################
### Finderで保存先を開く
set appSharedWorkspace to refMe's NSWorkspace's sharedWorkspace()
set boolDone to appSharedWorkspace's selectFile:(ocidSaveFilePathURL's |path|()) inFileViewerRootedAtPath:(ocidContainerDirPathURL's |path|())

################################
# 日付 doGetDateNo(argDateFormat,argCalendarNO)
# argCalendarNO 1 NSCalendarIdentifierGregorian 西暦
# argCalendarNO 2 NSCalendarIdentifierJapanese 和暦
################################
to doGetDateNo({argDateFormat, argCalendarNO})
  ##渡された値をテキストで確定させて
  set strDateFormat to argDateFormat as text
  set intCalendarNO to argCalendarNO as integer
  ###日付情報の取得
  set ocidDate to current application's NSDate's |date|()
  ###日付のフォーマットを定義(日本語)
  set ocidFormatterJP to current application's NSDateFormatter's alloc()'s init()
  ###和暦 西暦 カレンダー分岐
  if intCalendarNO = 1 then
    set ocidCalendarID to (current application's NSCalendarIdentifierGregorian)
  else if intCalendarNO = 2 then
    set ocidCalendarID to (current application's NSCalendarIdentifierJapanese)
  else
    set ocidCalendarID to (current application's NSCalendarIdentifierISO8601)
  end if
  set ocidCalendarJP to current application's NSCalendar's alloc()'s initWithCalendarIdentifier:(ocidCalendarID)
  set ocidTimezoneJP to current application's NSTimeZone's alloc()'s initWithName:("Asia/Tokyo")
  set ocidLocaleJP to current application's NSLocale's alloc()'s initWithLocaleIdentifier:("ja_JP_POSIX")
  ###設定
ocidFormatterJP's setTimeZone:(ocidTimezoneJP)
ocidFormatterJP's setLocale:(ocidLocaleJP)
ocidFormatterJP's setCalendar:(ocidCalendarJP)
  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterNoStyle)
  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterShortStyle)
  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterMediumStyle)
  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterLongStyle)
ocidFormatterJP's setDateStyle:(current application's NSDateFormatterFullStyle)
  ###渡された値でフォーマット定義
ocidFormatterJP's setDateFormat:(strDateFormat)
  ###フォーマット適応
  set ocidDateAndTime to ocidFormatterJP's stringFromDate:(ocidDate)
  ###テキストで戻す
  set strDateAndTime to ocidDateAndTime as text
return strDateAndTime
end doGetDateNo



|

[GEO]地図用GEOコードQRバーコードのデコード(読み取り)


【スクリプトエディタで開く】|

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use framework "AppKit"
use framework "CoreImage"
use scripting additions

property refMe : a reference to current application

set objFileManager to refMe's NSFileManager's defaultManager()

###################################
#####ダイアログ
###################################
tell current application
  set strName to name as text
end tell
if strName is "osascript" then
  tell application "Finder" to activate
else
  tell current application to activate
end if
###ダイアログのデフォルト
set ocidUserDesktopPath to (objFileManager's URLsForDirectory:(refMe's NSDesktopDirectory) inDomains:(refMe's NSUserDomainMask))
set aliasDefaultLocation to ocidUserDesktopPath as alias
set listChooseFileUTI to {"public.image"}
set strPromptText to "QRコードファイルを選んでください" as text
set listAliasFilePath to (choose file with prompt strPromptText default location (aliasDefaultLocation) of type listChooseFileUTI with invisibles and showing package contents without multiple selections allowed) as list
###################################
#####パス処理
###################################
###エリアス
set aliasFilePath to item 1 of listAliasFilePath as alias
###UNIXパス
set strFilePath to POSIX path of aliasFilePath as text
###String
set ocidFilePath to refMe's NSString's stringWithString:strFilePath
###NSURL
set ocidFilePathURL to refMe's NSURL's alloc()'s initFileURLWithPath:ocidFilePath isDirectory:false
####ファイル名を取得
set ocidFileName to ocidFilePathURL's lastPathComponent()
####拡張子を取得
set ocidFileExtension to ocidFilePathURL's pathExtension()
####ファイル名から拡張子を取っていわゆるベースファイル名を取得
set ocidPrefixName to ocidFileName's stringByDeletingPathExtension
####コンテナ
set ocidContainerDirPathURL to ocidFilePathURL's URLByDeletingLastPathComponent()


###################################
##### QRコードイメージファイル読み込み 
###################################
####CIイメージに読み込み
set ocidCiImageInput to (refMe's CIImage's imageWithContentsOfURL:(ocidFilePathURL) options:(missing value))
########################
####CIDetectorを定義 CIDetectorTypeQRCode
set ocidDetector to refMe's CIDetector's detectorOfType:(refMe's CIDetectorTypeQRCode) context:(missing value) options:{CIDetectorAccuracy:(refMe's CIDetectorAccuracyHigh)}
#####ocidDetectorを通して結果をArrayに格納
set ocidFeaturesArray to ocidDetector's featuresInImage:(ocidCiImageInput)
if (count of ocidFeaturesArray) = 0 then
return "読み取り不良"
end if
####messageString格納用のArray
set ocidOutPutArrayM to refMe's NSMutableArray's alloc()'s initWithCapacity:(0)
####Featuresの数だけ繰り返し
repeat with itemFeaturesArray in ocidFeaturesArray
  #####読み取り結果のテキスト messageString
  log itemFeaturesArray's type() as text
  log className() of itemFeaturesArray as text
  log itemFeaturesArray's |bounds|() as list
  set ocidMessageString to itemFeaturesArray's messageString()
(ocidOutPutArrayM's addObject:(ocidMessageString))
end repeat
####複数見つかった場合はエラーで止める
if (ocidOutPutArrayM's |count|()) > 1 then
return "読み取り結果が複数見つかりました"
else
  set ocidQRdecodeText to ocidOutPutArrayM's firstObject()
  set strQRdecodeText to ocidQRdecodeText as text
end if
log strQRdecodeText
###################################
##### 読み取り結果整形
###################################
if strQRdecodeText starts with "GEO" then
  set ocidQRdecodeText to refMe's NSString's stringWithString:(strQRdecodeText)
  ###置換
  set ocidQRdecodeTextM to refMe's NSMutableString's alloc()'s initWithCapacity:(0)
ocidQRdecodeTextM's setString:(ocidQRdecodeText)
  set ocidLength to ocidQRdecodeTextM's |length|()
  set ocidRange to refMe's NSMakeRange(0, ocidLength)
  set ocidOption to (refMe's NSCaseInsensitiveSearch)
ocidQRdecodeTextM's replaceOccurrencesOfString:("GEO:") withString:("") options:(ocidOption) range:(ocidRange)
  ###値をArrayに
  set ocidGeoLLArray to ocidQRdecodeTextM's componentsSeparatedByString:(",")
  set strLatitude to (ocidGeoLLArray's objectAtIndex:0) as text
  set strLongitude to (ocidGeoLLArray's objectAtIndex:1) as text
  set strZoom to (ocidGeoLLArray's objectAtIndex:2) as text
  set strURL to "https://www.google.com/maps/@" & strLatitude & "," & strLongitude & "," & strZoom & "z/"
  ###拡張子
  set strFileExtension to "webloc" as text
  ###ダイアログに出すファイル名
  set strDefaultName to ("GEO." & strLatitude & "x" & strLongitude & "." & strFileExtension) as text
else
return "読み取り不良 GEOバーコードが見つかりません"
end if
###################################
##### ダイアログ
###################################
#####ダイアログを前面に
tell current application
  set strName to name as text
end tell
####スクリプトメニューから実行したら
if strName is "osascript" then
  tell application "Finder" to activate
else
  tell current application to activate
end if
set aliasIconPath to POSIX file "/System/Applications/Preview.app/Contents/Resources/AppIcon.icns" as alias

try
  set recordResponse to (display dialog "コピーしてください" with title "QRコード読み取り結果" default answer strQRdecodeText buttons {"クリップボードにコピー", "終了", "ファイル出力"} default button "ファイル出力" cancel button "終了" with icon aliasIconPath giving up after 30 without hidden answer)
  
on error
  log "エラーしました"
return "エラーしました"
  error number -128
end try
if true is equal to (gave up of recordResponse) then
return "時間切れですやりなおしてください"
  error number -128
end if

if "終了" is equal to (button returned of recordResponse) then
return "処理終了"
else if button returned of recordResponse is "クリップボードにコピー" then
  try
    set strText to text returned of recordResponse as text
    ####ペーストボード宣言
    set appPasteboard to refMe's NSPasteboard's generalPasteboard()
    set ocidText to (refMe's NSString's stringWithString:(strText))
appPasteboard's clearContents()
appPasteboard's setString:(ocidText) forType:(refMe's NSPasteboardTypeString)
return "処理終了"
  on error
    tell application "Finder"
      set the clipboard to strText as text
    end tell
return "エラーしました"
  end try
  
end if

###################################
#####保存ダイアログ
###################################
#####ダイアログを前面に
tell current application
  set strName to name as text
end tell
####スクリプトメニューから実行したら
if strName is "osascript" then
  tell application "Finder" to activate
else
  tell current application to activate
end if
####
set strPromptText to "名前を決めてください"
###選んだファイルの同階層をデフォルト
set aliasDefaultLocation to ocidContainerDirPathURL as alias
####ファイル名ダイアログ
####実在しない『はず』なのでas «class furl»で
set aliasSaveFilePath to (choose file name default location aliasDefaultLocation default name strDefaultName with prompt strPromptText) as «class furl»
####UNIXパス
set strSaveFilePath to POSIX path of aliasSaveFilePath as text
####ドキュメントのパスをNSString
set ocidSaveFilePath to refMe's NSString's stringWithString:strSaveFilePath
####ドキュメントのパスをNSURLに
set ocidSaveFilePathURL to refMe's NSURL's fileURLWithPath:ocidSaveFilePath
###拡張子取得
set strFileExtensionName to ocidSaveFilePathURL's pathExtension() as text
###ダイアログで拡張子を取っちゃった時対策
if strFileExtensionName is not strFileExtension then
  set ocidSaveFilePathURL to ocidSaveFilePathURL's URLByAppendingPathExtension:(strFileExtension)
end if
###################################
##### ファイルに書き出し
###################################
###NSMutableDictionaryにセット
set ocidPlistDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
ocidPlistDict's setValue:(strURL) forKey:("URL")
###plist初期化
set ocidFromat to refMe's NSPropertyListXMLFormat_v1_0
set listPlistEditData to refMe's NSPropertyListSerialization's dataWithPropertyList:(ocidPlistDict) format:(ocidFromat) options:0 |error|:(reference)
set ocidPlistEditData to item 1 of listPlistEditData
###保存
set boolDone to ocidPlistEditData's writeToURL:(ocidSaveFilePathURL) options:0 |error|:(reference)
log item 1 of boolDone as boolean

#####################
### Finderで保存先を開く
set appSharedWorkspace to refMe's NSWorkspace's sharedWorkspace()
set boolDone to appSharedWorkspace's selectFile:(ocidSaveFilePathURL's |path|()) inFileViewerRootedAtPath:(ocidContainerDirPathURL's |path|())



################################
# 日付 doGetDateNo(argDateFormat,argCalendarNO)
# argCalendarNO 1 NSCalendarIdentifierGregorian 西暦
# argCalendarNO 2 NSCalendarIdentifierJapanese 和暦
################################
to doGetDateNo({argDateFormat, argCalendarNO})
  ##渡された値をテキストで確定させて
  set strDateFormat to argDateFormat as text
  set intCalendarNO to argCalendarNO as integer
  ###日付情報の取得
  set ocidDate to current application's NSDate's |date|()
  ###日付のフォーマットを定義(日本語)
  set ocidFormatterJP to current application's NSDateFormatter's alloc()'s init()
  ###和暦 西暦 カレンダー分岐
  if intCalendarNO = 1 then
    set ocidCalendarID to (current application's NSCalendarIdentifierGregorian)
  else if intCalendarNO = 2 then
    set ocidCalendarID to (current application's NSCalendarIdentifierJapanese)
  else
    set ocidCalendarID to (current application's NSCalendarIdentifierISO8601)
  end if
  set ocidCalendarJP to current application's NSCalendar's alloc()'s initWithCalendarIdentifier:(ocidCalendarID)
  set ocidTimezoneJP to current application's NSTimeZone's alloc()'s initWithName:("Asia/Tokyo")
  set ocidLocaleJP to current application's NSLocale's alloc()'s initWithLocaleIdentifier:("ja_JP_POSIX")
  ###設定
ocidFormatterJP's setTimeZone:(ocidTimezoneJP)
ocidFormatterJP's setLocale:(ocidLocaleJP)
ocidFormatterJP's setCalendar:(ocidCalendarJP)
  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterNoStyle)
  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterShortStyle)
  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterMediumStyle)
  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterLongStyle)
ocidFormatterJP's setDateStyle:(current application's NSDateFormatterFullStyle)
  ###渡された値でフォーマット定義
ocidFormatterJP's setDateFormat:(strDateFormat)
  ###フォーマット適応
  set ocidDateAndTime to ocidFormatterJP's stringFromDate:(ocidDate)
  ###テキストで戻す
  set strDateAndTime to ocidDateAndTime as text
return strDateAndTime
end doGetDateNo



|

QRバーコードのデコード(読み取り)


【スクリプトエディタで開く】|

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use framework "CoreImage"
use scripting additions

property refMe : a reference to current application

set appFileManager to refMe's NSFileManager's defaultManager()

###################################
#####ダイアログ
###################################a
tell current application
  set strName to name as text
end tell
if strName is "osascript" then
  tell application "Finder" to activate
else
  tell current application to activate
end if
###ダイアログのデフォルト
set ocidUserDesktopPath to (appFileManager's URLsForDirectory:(refMe's NSDesktopDirectory) inDomains:(refMe's NSUserDomainMask))
set aliasDefaultLocation to ocidUserDesktopPath as alias
set listChooseFileUTI to {"public.image"}
set strPromptText to "QRコードファイルを選んでください" as text
set listAliasFilePath to (choose file with prompt strPromptText default location (aliasDefaultLocation) of type listChooseFileUTI with invisibles and showing package contents without multiple selections allowed) as list
###################################
#####パス処理
###################################
###エリアス
set aliasFilePath to item 1 of listAliasFilePath as alias
###UNIXパス
set strFilePath to POSIX path of aliasFilePath as text
###String
set ocidFilePath to refMe's NSString's stringWithString:(strFilePath)
###NSURL
set ocidFilePathURL to refMe's NSURL's alloc()'s initFileURLWithPath:(ocidFilePath) isDirectory:false
####ファイル名を取得
set ocidFileName to ocidFilePathURL's lastPathComponent()
####拡張子を取得
set ocidFileExtension to ocidFilePathURL's pathExtension()
####ファイル名から拡張子を取っていわゆるベースファイル名を取得
set ocidPrefixName to ocidFileName's stringByDeletingPathExtension
####コンテナ
set ocidContainerDirPathURL to ocidFilePathURL's URLByDeletingLastPathComponent()


###################################
##### QRコードイメージファイル読み込み 
###################################
####CIイメージに読み込み
set ocidCiImageInput to (refMe's CIImage's imageWithContentsOfURL:(ocidFilePathURL) options:(missing value))
########################
####CIDetectorを定義 CIDetectorTypeQRCode
set ocidDetector to refMe's CIDetector's detectorOfType:(refMe's CIDetectorTypeQRCode) context:(missing value) options:{CIDetectorAccuracy:(refMe's CIDetectorAccuracyHigh)}
#####ocidDetectorを通して結果をArrayに格納
set ocidFeaturesArray to ocidDetector's featuresInImage:(ocidCiImageInput)
if (count of ocidFeaturesArray) = 0 then
return "読み取り不良A"
end if
###読み取り結果の格納用テキスト
set strOutPutText to ("") as text
###ocidDetectorで見つかったARRAYの数だけ繰り返し
repeat with itemFeaturesArray in ocidFeaturesArray
  #####読み取り結果のテキスト
  log className() of itemFeaturesArray as text
  log itemFeaturesArray's |bounds|() as list
  set strReadText to itemFeaturesArray's messageString() as text
  ###QRバーコードが複数ある場合
  ## set strOutPutText to (strOutPutText & strReadText & "\n") as text
  ###QRバーコードが単体の場合
  set strOutPutText to (strOutPutText & strReadText & "") as text
  log itemFeaturesArray's type() as text
end repeat
###クリップボードに渡す用にテキストにしておく
set ocidQrCodeMessageString to refMe's NSString's stringWithString:(strOutPutText)

###################################
##### ダイアログ
###################################
###アイコンパス
set aliasIconPath to POSIX file "/System/Applications/Preview.app/Contents/Resources/AppIcon.icns" as alias
###ダイアログ表示用にテキストに確定させておく
set strDefaultAnswer to ocidQrCodeMessageString as text
try
  ###ダイアログのデフォルトアンサー用
  set strMes to ("戻り値です\r" & strOutPutText) as text
  ###ダイアログを前面に
  tell current application
    set strName to name as text
  end tell
  if strName is "osascript" then
    tell application "Finder" to activate
  else
    tell current application to activate
  end if
  set recordResult to (display dialog strMes with title "bundle identifier" default answer strOutPutText buttons {"クリップボードにコピー", "キャンセル", "ファイル書出"} default button "ファイル書出" cancel button "キャンセル" giving up after 20 with icon aliasIconPath without hidden answer)
on error
  log "エラーしました"
return "エラーしました"
  error number -128
end try
if true is equal to (gave up of recordResult) then
return "時間切れですやりなおしてください"
  error number -128
end if
if "ファイル書出" is equal to (button returned of recordResult) then
  ###ファイル名
  set strPrefixName to ocidPrefixName as text
  ###拡張子変える場合
  set strFileExtension to "txt"
  ###ダイアログに出すファイル名
  set strDefaultName to (strPrefixName & ".output." & strFileExtension) as text
  set strPromptText to "名前を決めてください"
  ###選んだファイルの同階層をデフォルト
  set aliasDefaultLocation to ocidContainerDirPathURL as alias
  ####ファイル名ダイアログ
  #####ダイアログを前面に
  tell current application
    set strName to name as text
  end tell
  ####スクリプトメニューから実行したら
  if strName is "osascript" then
    tell application "Finder" to activate
  else
    tell current application to activate
  end if
  ####実在しない『はず』なのでas «class furl»で
  set aliasSaveFilePath to (choose file name default location aliasDefaultLocation default name strDefaultName with prompt strPromptText) as «class furl»
  ####UNIXパス
  set strSaveFilePath to POSIX path of aliasSaveFilePath as text
  ####ドキュメントのパスをNSString
  set ocidSaveFilePath to refMe's NSString's stringWithString:strSaveFilePath
  ####ドキュメントのパスをNSURLに
  set ocidSaveFilePathURL to refMe's NSURL's fileURLWithPath:ocidSaveFilePath
  ###拡張子取得
  set strFileExtensionName to ocidSaveFilePathURL's pathExtension() as text
  ###ダイアログで拡張子を取っちゃった時対策
  if strFileExtensionName is not strFileExtension then
    set ocidSaveFilePathURL to ocidSaveFilePathURL's URLByAppendingPathExtension:strFileExtension
  end if
  ###ファイル保存
  set boolFileWrite to (ocidQrCodeMessageString's writeToURL:ocidSaveFilePathURL atomically:false encoding:(refMe's NSUTF8StringEncoding) |error|:(reference))
else if button returned of recordResult is "クリップボードにコピー" then
  try
    set strText to text returned of recordResult as text
    ####ペーストボード宣言
    set appPasteboard to refMe's NSPasteboard's generalPasteboard()
    set ocidText to (refMe's NSString's stringWithString:(strText))
appPasteboard's clearContents()
    ###NSPasteboardTypeStringでペーストボードに格納
appPasteboard's setString:(ocidText) forType:(refMe's NSPasteboardTypeString)
  on error
    tell application "Finder"
      set the clipboard to strTitle as text
    end tell
  end try
return "処理終了"
else
  log "エラーしました"
return "エラーしました"
  error number -128
end if


|

[QR]デコード

一部修正


【スクリプトエディタで開く】

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
#
#
#                       com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7

use AppleScript version "2.8"
use framework "Foundation"
use scripting additions

property refMe : a reference to current application

set objFileManager to refMe's NSFileManager's defaultManager()

###################################
#####ダイアログ
###################################a
###ダイアログのデフォルト
set ocidUserDesktopPath to (objFileManager's URLsForDirectory:(refMe's NSDesktopDirectory) inDomains:(refMe's NSUserDomainMask))
set aliasDefaultLocation to ocidUserDesktopPath as alias
tell application "Finder"
  ##  set aliasDefaultLocation to container of (path to me) as alias
end tell
set listChooseFileUTI to {"public.image"}
set strPromptText to "QRコードファイルを選んでください" as text
set listAliasFilePath to (choose file with prompt strPromptText default location (aliasDefaultLocation) of type listChooseFileUTI with invisibles and showing package contents without multiple selections allowed) as list
###################################
#####パス処理
###################################
###エリアス
set aliasFilePath to item 1 of listAliasFilePath as alias
###UNIXパス
set strFilePath to POSIX path of aliasFilePath as text
###String
set ocidFilePath to refMe's NSString's stringWithString:strFilePath
###NSURL
set ocidFilePathURL to refMe's NSURL's alloc()'s initFileURLWithPath:ocidFilePath isDirectory:false
####ファイル名を取得
set ocidFileName to ocidFilePathURL's lastPathComponent()
####拡張子を取得
set ocidFileExtension to ocidFilePathURL's pathExtension()
####ファイル名から拡張子を取っていわゆるベースファイル名を取得
set ocidPrefixName to ocidFileName's stringByDeletingPathExtension
####コンテナ
set ocidContainerDirPathURL to ocidFilePathURL's URLByDeletingLastPathComponent()



###################################
##### イメージファイル読み込み 
###################################
####CIDetectorを定義
set ocidDetector to refMe's CIDetector's detectorOfType:(refMe's CIDetectorTypeQRCode) context:(missing value) options:{CIDetectorAccuracy:(refMe's CIDetectorAccuracyHigh)}
####CIイメージに読み込み
set ocidCiImageInput to (refMe's CIImage's imageWithContentsOfURL:ocidFilePathURL options:(missing value))
####格納用の可変Array
set ocidFeaturesArray to refMe's NSMutableArray's alloc()'s initWithCapacity:0
#####ocidDetectorを通して結果をArrayに格納
set ocidFeaturesArray to ocidDetector's featuresInImage:ocidCiImageInput

if (count of ocidFeaturesArray) = 0 then
  return "読み取り不良"
end if
#####シングルArrayなので1コ目のデータが読み取り結果
set ocidIQRCodeFeature to item 1 of ocidFeaturesArray
#####読み取り結果のテキスト
set ocidQrCodeMessageString to ocidIQRCodeFeature's messageString()

set strFileExtension to "txt"


set strDateNO to doGetDateNo("yyyyMMddhhmmss") as text

###################################
##### WIFIバーコード判定
###################################
set ocidRangeOption to (refMe's NSAnchoredSearch as integer) + (refMe's NSCaseInsensitiveSearch as integer)
set ocidWIFIRange to ocidQrCodeMessageString's rangeOfString:"WIFI:" options:ocidRangeOption
if ocidWIFIRange = {location:0, |length|:5} then
  set strFileExtension to "mobileconfig" as text
  set strContents to doMakeURLfile(ocidQrCodeMessageString as text)
end if

###################################
##### Vcardバーコード判定
###################################
set ocidRangeOption to (refMe's NSAnchoredSearch as integer) + (refMe's NSCaseInsensitiveSearch as integer)
set ocidVCARDRange to ocidQrCodeMessageString's rangeOfString:"BEGIN:VCARD" options:ocidRangeOption
if ocidVCARDRange = {location:0, |length|:11} then
  set strFileExtension to "vcf" as text
  set strContents to ocidQrCodeMessageString as text
end if

###################################
##### カレンダーバーコード判定
###################################
set ocidRangeOption to (refMe's NSAnchoredSearch as integer) + (refMe's NSCaseInsensitiveSearch as integer)
set ocidVEVENTRange to ocidQrCodeMessageString's rangeOfString:"BEGIN:VEVENT" options:ocidRangeOption
if ocidVEVENTRange = {location:0, |length|:12} then
  set strFileExtension to "ics" as text
  set strContents to ocidQrCodeMessageString as text
  set strContents to "BEGIN:VCALENDAR\n" & strContents & "\nEND:VCALENDAR" as text
end if

###################################
##### SMSTOバーコード判定
###################################
set ocidRangeOption to (refMe's NSAnchoredSearch as integer) + (refMe's NSCaseInsensitiveSearch as integer)
set ocidSMSTORange to ocidQrCodeMessageString's rangeOfString:"SMSTO:" options:ocidRangeOption
if ocidSMSTORange = {location:0, |length|:6} then
  set strFileExtension to "url" as text
  set strContents to doMakeURLfile(ocidQrCodeMessageString as text)
end if
###################################
##### 電番バーコード判定
###################################
set ocidRangeOption to (refMe's NSAnchoredSearch as integer) + (refMe's NSCaseInsensitiveSearch as integer)
set ocidTELRange to ocidQrCodeMessageString's rangeOfString:"TEL:" options:ocidRangeOption
if ocidTELRange = {location:0, |length|:4} then
  set strFileExtension to "url" as text
  set strContents to doMakeURLfile(ocidQrCodeMessageString as text)
end if

###################################
##### メールバーコード判定
###################################
set ocidRangeOption to (refMe's NSAnchoredSearch as integer) + (refMe's NSCaseInsensitiveSearch as integer)
set ocidMAILTORange to ocidQrCodeMessageString's rangeOfString:"MAILTO:" options:ocidRangeOption
if ocidMAILTORange = {location:0, |length|:7} then
  set strFileExtension to "url" as text
  set strContents to doMakeURLfile(ocidQrCodeMessageString as text)
end if

###################################
##### GEOコード判定
###################################
set ocidRangeOption to (refMe's NSAnchoredSearch as integer) + (refMe's NSCaseInsensitiveSearch as integer)
set ocidGEORange to ocidQrCodeMessageString's rangeOfString:"GEO:" options:ocidRangeOption
if ocidGEORange = {location:0, |length|:4} then
  set strFileExtension to "url" as text
  #####区切り文字指定
  set ocidLineEndChrSet to refMe's NSCharacterSet's characterSetWithCharactersInString:":,"
  ###区切り文字でリストに
  set ocidGeoLLArray to ocidQrCodeMessageString's componentsSeparatedByCharactersInSet:ocidLineEndChrSet
  set strLatitude to (ocidGeoLLArray's objectAtIndex:1) as text
  set strLongitude to (ocidGeoLLArray's objectAtIndex:2) as text
  set strURL to "https://www.google.com/maps/@" & strLatitude & "," & strLongitude & ",17z/"
  set strContents to doMakeURLfile(strURL)
end if

###################################
##### HTTP リンク コード判定
###################################
set ocidRangeOption to (refMe's NSAnchoredSearch as integer) + (refMe's NSCaseInsensitiveSearch as integer)
set ocidHTTPSORange to ocidQrCodeMessageString's rangeOfString:"http:" options:ocidRangeOption

if ocidHTTPSORange = {location:0, |length|:5} then
  set strFileExtension to "url" as text
  set strContents to doMakeURLfile(ocidQrCodeMessageString as text)
end if

set ocidRangeOption to (refMe's NSAnchoredSearch as integer) + (refMe's NSCaseInsensitiveSearch as integer)
set ocidHTTPSORange to ocidQrCodeMessageString's rangeOfString:"https:" options:ocidRangeOption

if ocidHTTPSORange = {location:0, |length|:6} then
  set strFileExtension to "url" as text
  set strContents to doMakeURLfile(ocidQrCodeMessageString as text)
end if


###################################
#####保存ダイアログ
###################################
set ocidContents to refMe's NSString's stringWithString:strContents

###ファイル名
set strPrefixName to ocidPrefixName as text


###ダイアログに出すファイル名
set strDefaultName to (strPrefixName & ".output." & strFileExtension) as text
set strPromptText to "名前を決めてください"
###選んだファイルの同階層をデフォルト
set aliasDefaultLocation to ocidContainerDirPathURL as alias
####ファイル名ダイアログ
####実在しない『はず』なのでas «class furl»
set aliasSaveFilePath to (choose file name default location aliasDefaultLocation default name strDefaultName with prompt strPromptText) as «class furl»
####UNIXパス
set strSaveFilePath to POSIX path of aliasSaveFilePath as text
####ドキュメントのパスをNSString
set ocidSaveFilePath to refMe's NSString's stringWithString:strSaveFilePath
####ドキュメントのパスをNSURL
set ocidSaveFilePathURL to refMe's NSURL's fileURLWithPath:ocidSaveFilePath
###拡張子取得
set strFileExtensionName to ocidSaveFilePathURL's pathExtension() as text
###ダイアログで拡張子を取っちゃった時対策
if strFileExtensionName is not strFileExtension then
  set ocidSaveFilePathURL to ocidSaveFilePathURL's URLByAppendingPathExtension:strFileExtension
end if


###################################
##### テキストファイルに書き出し
###################################
set boolFileWrite to (ocidContents's writeToURL:ocidSaveFilePathURL atomically:false encoding:(refMe's NSUTF8StringEncoding) |error|:(reference))

###################################
##### ダイアログ
###################################
set aliasIconPath to POSIX file "/System/Library/CoreServices/Applications/Wireless Diagnostics.app/Contents/Resources/AppIcon.icns" as alias
set strDefaultAnswer to ocidQrCodeMessageString as text
try
  set recordResponse to (display dialog "コピーしてください" with title "QRコード読み取り結果" default answer strDefaultAnswer buttons {"OK", "キャンセル"} default button "OK" cancel button "キャンセル" with icon aliasIconPath giving up after 30 without hidden answer)
  
on error
  log "エラーしました"
  return "エラーしました"
  error number -128
end try
if true is equal to (gave up of recordResponse) then
  return "時間切れですやりなおしてください"
  error number -128
end if
if "OK" is equal to (button returned of recordResponse) then
  set theResponse to (text returned of recordResponse) as text
else
  log "エラーしました"
  return "エラーしました"
  error number -128
end if

###################################
##### make URL 2 FILE
###################################

to doMakeURLfile(argURL)
  ###受け取った値に
  set strURL to argURL as text
  ####必要なメタをつけて
  set strURLFileContents to ("[InternetShortcut]\r\nURL=" & strURL & "\r\n") as text
  ####戻す
  return strURLFileContents
end doMakeURLfile

###################################
##### ダイアログ
###################################

to doGetDateNo(strDateFormat)
  ####日付情報の取得
  set ocidDate to refMe's NSDate's |date|()
  ###日付のフォーマットを定義
  set ocidNSDateFormatter to refMe's NSDateFormatter's alloc()'s init()
  ocidNSDateFormatter's setLocale:(refMe's NSLocale's localeWithLocaleIdentifier:"en_US")
  ocidNSDateFormatter's setDateFormat:strDateFormat
  set ocidDateAndTime to ocidNSDateFormatter's stringFromDate:ocidDate
  set strDateAndTime to ocidDateAndTime as text
  return strDateAndTime
end doGetDateNo

|

[QR]QRバーコードのデコードとファイル化(途中)

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
#
#
#                       com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7

use AppleScript version "2.8"
use framework "Foundation"
use scripting additions

property refMe : a reference to current application

set objFileManager to refMe's NSFileManager's defaultManager()

###################################
#####ダイアログ
###################################a
###ダイアログのデフォルト
set ocidUserDesktopPath to (objFileManager's URLsForDirectory:(refMe's NSDesktopDirectory) inDomains:(refMe's NSUserDomainMask))
set aliasDefaultLocation to ocidUserDesktopPath as alias
tell application "Finder"
    ##    set aliasDefaultLocation to container of (path to me) as alias
end tell
set listChooseFileUTI to {"public.image"}
set strPromptText to "QRコードファイルを選んでください" as text
set listAliasFilePath to (choose file with prompt strPromptText default location (aliasDefaultLocation) of type listChooseFileUTI with invisibles and showing package contents without multiple selections allowed) as list
###################################
#####パス処理
###################################
###エリアス
set aliasFilePath to item 1 of listAliasFilePath as alias
###UNIXパス
set strFilePath to POSIX path of aliasFilePath as text
###String
set ocidFilePath to refMe's NSString's stringWithString:strFilePath
###NSURL
set ocidFilePathURL to refMe's NSURL's alloc()'s initFileURLWithPath:ocidFilePath isDirectory:false
####ファイル名を取得
set ocidFileName to ocidFilePathURL's lastPathComponent()
####拡張子を取得
set ocidFileExtension to ocidFilePathURL's pathExtension()
####ファイル名から拡張子を取っていわゆるベースファイル名を取得
set ocidPrefixName to ocidFileName's stringByDeletingPathExtension
####コンテナ
set ocidContainerDirPathURL to ocidFilePathURL's URLByDeletingLastPathComponent()



###################################
##### イメージファイル読み込み 
###################################
####CIDetectorを定義
set ocidDetector to refMe's CIDetector's detectorOfType:(refMe's CIDetectorTypeQRCode) context:(missing value) options:{CIDetectorAccuracy:(refMe's CIDetectorAccuracyHigh)}
####CIイメージに読み込み
set ocidCiImageInput to (refMe's CIImage's imageWithContentsOfURL:ocidFilePathURL options:(missing value))
####格納用の可変Array
set ocidFeaturesArray to refMe's NSMutableArray's alloc()'s initWithCapacity:0
#####ocidDetectorを通して結果をArrayに格納
set ocidFeaturesArray to ocidDetector's featuresInImage:ocidCiImageInput
#####シングルArrayなので1コ目のデータが読み取り結果
set ocidIQRCodeFeature to item 1 of ocidFeaturesArray
#####読み取り結果のテキスト
set ocidQrCodeMessageString to ocidIQRCodeFeature's messageString()

set strFileExtension to "txt"


set strDateNO to doGetDateNo("yyyyMMddhhmmss") as text

###################################
##### WIFIバーコード判定
###################################
set ocidRangeOption to (refMe's NSAnchoredSearch as integer) + (refMe's NSCaseInsensitiveSearch as integer)
set ocidWIFIRange to ocidQrCodeMessageString's rangeOfString:"WIFI:" options:ocidRangeOption
if ocidWIFIRange = {location:0, |length|:5} then
    set strFileExtension to "mobileconfig" as text
    set strContents to doMakeURLfile(ocidQrCodeMessageString as text)
end if
log ocidWIFIRange
###################################
##### Vcardバーコード判定
###################################
set ocidRangeOption to (refMe's NSAnchoredSearch as integer) + (refMe's NSCaseInsensitiveSearch as integer)
set ocidVCARDRange to ocidQrCodeMessageString's rangeOfString:"BEGIN:VCARD" options:ocidRangeOption
if ocidVCARDRange = {location:0, |length|:11} then
    set strFileExtension to "vcf" as text
    set strContents to ocidQrCodeMessageString as text
end if

###################################
##### カレンダーバーコード判定
###################################
set ocidRangeOption to (refMe's NSAnchoredSearch as integer) + (refMe's NSCaseInsensitiveSearch as integer)
set ocidVEVENTRange to ocidQrCodeMessageString's rangeOfString:"BEGIN:VEVENT" options:ocidRangeOption
if ocidVEVENTRange = {location:0, |length|:12} then
    set strFileExtension to "ics" as text
    set strContents to ocidQrCodeMessageString as text
    
    set strContents to "BEGIN:VCALENDAR\n" & strContents & "\nEND:VCALENDAR" as text
    
    
end if

###################################
##### SMSTOバーコード判定
###################################
set ocidRangeOption to (refMe's NSAnchoredSearch as integer) + (refMe's NSCaseInsensitiveSearch as integer)
set ocidSMSTORange to ocidQrCodeMessageString's rangeOfString:"SMSTO:" options:ocidRangeOption
if ocidSMSTORange = {location:0, |length|:6} then
    set strFileExtension to "url" as text
    set strContents to doMakeURLfile(ocidQrCodeMessageString as text)
end if
###################################
##### 電番バーコード判定
###################################
set ocidRangeOption to (refMe's NSAnchoredSearch as integer) + (refMe's NSCaseInsensitiveSearch as integer)
set ocidTELRange to ocidQrCodeMessageString's rangeOfString:"TEL:" options:ocidRangeOption
if ocidTELRange = {location:0, |length|:4} then
    set strFileExtension to "url" as text
    set strContents to doMakeURLfile(ocidQrCodeMessageString as text)
end if

###################################
##### メールバーコード判定
###################################
set ocidRangeOption to (refMe's NSAnchoredSearch as integer) + (refMe's NSCaseInsensitiveSearch as integer)
set ocidMAILTORange to ocidQrCodeMessageString's rangeOfString:"MAILTO:" options:ocidRangeOption
if ocidMAILTORange = {location:0, |length|:7} then
    set strFileExtension to "url" as text
    set strContents to doMakeURLfile(ocidQrCodeMessageString as text)
end if

###################################
##### GEOコード判定
###################################
set ocidRangeOption to (refMe's NSAnchoredSearch as integer) + (refMe's NSCaseInsensitiveSearch as integer)
set ocidGEORange to ocidQrCodeMessageString's rangeOfString:"GEO:" options:ocidRangeOption
if ocidGEORange = {location:0, |length|:4} then
    set strFileExtension to "url" as text
    #####区切り文字指定
    set ocidLineEndChrSet to refMe's NSCharacterSet's characterSetWithCharactersInString:":,"
    ###区切り文字でリストに
    set ocidGeoLLArray to ocidQrCodeMessageString's componentsSeparatedByCharactersInSet:ocidLineEndChrSet
    set strLatitude to (ocidGeoLLArray's objectAtIndex:1) as text
    set strLongitude to (ocidGeoLLArray's objectAtIndex:2) as text
    set strURL to "https://www.google.com/maps/@" & strLatitude & "," & strLongitude & ",17z/"
    set strContents to doMakeURLfile(strURL)
end if

###################################
##### HTTP リンク コード判定
###################################
set ocidRangeOption to (refMe's NSAnchoredSearch as integer) + (refMe's NSCaseInsensitiveSearch as integer)
set ocidHTTPSORange to ocidQrCodeMessageString's rangeOfString:"https:" options:ocidRangeOption

if ocidHTTPSORange = {location:0, |length|:6} then
    set strFileExtension to "url" as text
    set strContents to doMakeURLfile(ocidQrCodeMessageString as text)
end if


###################################
#####保存ダイアログ
###################################
set ocidContents to refMe's NSString's stringWithString:strContents

###ファイル名
set strPrefixName to ocidPrefixName as text


###ダイアログに出すファイル名
set strDefaultName to (strPrefixName & ".output." & strFileExtension) as text
set strPromptText to "名前を決めてください"
###選んだファイルの同階層をデフォルト
set aliasDefaultLocation to ocidContainerDirPathURL as alias
####ファイル名ダイアログ
####実在しない『はず』なのでas «class furl»
set aliasSaveFilePath to (choose file name default location aliasDefaultLocation default name strDefaultName with prompt strPromptText) as «class furl»
####UNIXパス
set strSaveFilePath to POSIX path of aliasSaveFilePath as text
####ドキュメントのパスをNSString
set ocidSaveFilePath to refMe's NSString's stringWithString:strSaveFilePath
####ドキュメントのパスをNSURLに
set ocidSaveFilePathURL to refMe's NSURL's fileURLWithPath:ocidSaveFilePath
###拡張子取得
set strFileExtensionName to ocidSaveFilePathURL's pathExtension() as text
###ダイアログで拡張子を取っちゃった時対策
if strFileExtensionName is not strFileExtension then
    set ocidSaveFilePathURL to ocidSaveFilePathURL's URLByAppendingPathExtension:strFileExtension
end if


###################################
##### テキストファイルに書き出し
###################################
set boolFileWrite to (ocidContents's writeToURL:ocidSaveFilePathURL atomically:false encoding:(refMe's NSUTF8StringEncoding) |error|:(reference))

###################################
##### ダイアログ
###################################
set aliasIconPath to POSIX file "/System/Library/CoreServices/Applications/Wireless Diagnostics.app/Contents/Resources/AppIcon.icns" as alias
set strDefaultAnswer to ocidQrCodeMessageString as text
try
    set recordResponse to (display dialog "コピーしてください" with title "QRコード読み取り結果" default answer strDefaultAnswer buttons {"OK", "キャンセル"} default button "OK" cancel button "キャンセル" with icon aliasIconPath giving up after 30 without hidden answer)
    
on error
    log "エラーしました"
    return "エラーしました"
    error number -128
end try
if true is equal to (gave up of recordResponse) then
    return "時間切れですやりなおしてください"
    error number -128
end if
if "OK" is equal to (button returned of recordResponse) then
    set theResponse to (text returned of recordResponse) as text
else
    log "エラーしました"
    return "エラーしました"
    error number -128
end if

###################################
##### make URL 2 FILE
###################################

to doMakeURLfile(argURL)
    ###受け取った値に
    set strURL to argURL as text
    ####必要なメタをつけて
    set strURLFileContents to ("[InternetShortcut]\r\nURL=" & strURL & "\r\n") as text
    ####戻す
    return strURLFileContents
end doMakeURLfile

###################################
##### ダイアログ
###################################

to doGetDateNo(strDateFormat)
    ####日付情報の取得
    set ocidDate to refMe's NSDate's |date|()
    ###日付のフォーマットを定義
    set ocidNSDateFormatter to refMe's NSDateFormatter's alloc()'s init()
    ocidNSDateFormatter's setLocale:(refMe's NSLocale's localeWithLocaleIdentifier:"en_US")
    ocidNSDateFormatter's setDateFormat:strDateFormat
    set ocidDateAndTime to ocidNSDateFormatter's stringFromDate:ocidDate
    set strDateAndTime to ocidDateAndTime as text
    return strDateAndTime
end doGetDateNo

|

[QR DECODE]バーコード読み取り結果判定(考え中)

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
#
#
#                       com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7

use AppleScript version "2.8"
use framework "Foundation"
use scripting additions

property refMe : a reference to current application

set objFileManager to refMe's NSFileManager's defaultManager()

###################################
#####ダイアログ
###################################a
###ダイアログのデフォルト
set ocidUserDesktopPath to (objFileManager's URLsForDirectory:(refMe's NSDesktopDirectory) inDomains:(refMe's NSUserDomainMask))
set aliasDefaultLocation to ocidUserDesktopPath as alias
tell application "Finder"
  ##  set aliasDefaultLocation to container of (path to me) as alias
end tell
set listChooseFileUTI to {"public.image"}
set strPromptText to "QRコードファイルを選んでください" as text
set listAliasFilePath to (choose file with prompt strPromptText default location (aliasDefaultLocation) of type listChooseFileUTI with invisibles and showing package contents without multiple selections allowed) as list
###################################
#####パス処理
###################################
###エリアス
set aliasFilePath to item 1 of listAliasFilePath as alias
###UNIXパス
set strFilePath to POSIX path of aliasFilePath as text
###String
set ocidFilePath to refMe's NSString's stringWithString:strFilePath
###NSURL
set ocidFilePathURL to refMe's NSURL's alloc()'s initFileURLWithPath:ocidFilePath isDirectory:false
####ファイル名を取得
set ocidFileName to ocidFilePathURL's lastPathComponent()
####拡張子を取得
set ocidFileExtension to ocidFilePathURL's pathExtension()
####ファイル名から拡張子を取っていわゆるベースファイル名を取得
set ocidPrefixName to ocidFileName's stringByDeletingPathExtension
####コンテナ
set ocidContainerDirPathURL to ocidFilePathURL's URLByDeletingLastPathComponent()

###################################
#####保存ダイアログ
###################################
###ファイル名
set strPrefixName to ocidPrefixName as text
###拡張子
###同じ拡張子の場合
##set strFileExtension to ocidFileExtension as text
###拡張子変える場合
set strFileExtension to "txt"
###ダイアログに出すファイル名
set strDefaultName to (strPrefixName & ".output." & strFileExtension) as text
set strPromptText to "名前を決めてください"
###選んだファイルの同階層をデフォルト
set aliasDefaultLocation to ocidContainerDirPathURL as alias
####ファイル名ダイアログ
####実在しない『はず』なのでas «class furl»
set aliasSaveFilePath to (choose file name default location aliasDefaultLocation default name strDefaultName with prompt strPromptText) as «class furl»
####UNIXパス
set strSaveFilePath to POSIX path of aliasSaveFilePath as text
####ドキュメントのパスをNSString
set ocidSaveFilePath to refMe's NSString's stringWithString:strSaveFilePath
####ドキュメントのパスをNSURL
set ocidSaveFilePathURL to refMe's NSURL's fileURLWithPath:ocidSaveFilePath
###拡張子取得
set strFileExtensionName to ocidSaveFilePathURL's pathExtension() as text
###ダイアログで拡張子を取っちゃった時対策
if strFileExtensionName is not strFileExtension then
  set ocidSaveFilePathURL to ocidSaveFilePathURL's URLByAppendingPathExtension:strFileExtension
end if

###################################
##### イメージファイル読み込み 
###################################
####CIDetectorを定義
set ocidDetector to refMe's CIDetector's detectorOfType:(refMe's CIDetectorTypeQRCode) context:(missing value) options:{CIDetectorAccuracy:(refMe's CIDetectorAccuracyHigh)}
####CIイメージに読み込み
set ocidCiImageInput to (refMe's CIImage's imageWithContentsOfURL:ocidFilePathURL options:(missing value))
####格納用の可変Array
set ocidFeaturesArray to refMe's NSMutableArray's alloc()'s initWithCapacity:0
#####ocidDetectorを通して結果をArrayに格納
set ocidFeaturesArray to ocidDetector's featuresInImage:ocidCiImageInput
#####シングルArrayなので1コ目のデータが読み取り結果
set ocidIQRCodeFeature to item 1 of ocidFeaturesArray
#####読み取り結果のテキスト
set ocidQrCodeMessageString to ocidIQRCodeFeature's messageString()


###################################
##### WIFIバーコード判定
###################################
set ocidRangeOption to (refMe's NSAnchoredSearch as integer) + (refMe's NSCaseInsensitiveSearch as integer)
-->9
set ocidWIFIRange to ocidQrCodeMessageString's rangeOfString:"WIFI:" options:ocidRangeOption
log ocidWIFIRange
-->(*location:0, length:5*)ならWIFIバーコード


###################################
##### Vcardバーコード判定
###################################
set ocidRangeOption to (refMe's NSAnchoredSearch as integer) + (refMe's NSCaseInsensitiveSearch as integer)
-->9
set ocidVcardRange to ocidQrCodeMessageString's rangeOfString:"BEGIN:VCARD" options:ocidRangeOption
log ocidVcardRange
-->(*location:0, length:11*)ならVcard

###################################
##### カレンダーバーコード判定
###################################
set ocidRangeOption to (refMe's NSAnchoredSearch as integer) + (refMe's NSCaseInsensitiveSearch as integer)
-->9
set ocidVcardRange to ocidQrCodeMessageString's rangeOfString:"BEGIN:VEVENT" options:ocidRangeOption
log ocidVcardRange
-->(*location:0, length:12*)ならVEVENT


###################################
##### SMSTOバーコード判定
###################################
set ocidRangeOption to (refMe's NSAnchoredSearch as integer) + (refMe's NSCaseInsensitiveSearch as integer)
-->9
set ocidSMSTORange to ocidQrCodeMessageString's rangeOfString:"SMSTO:" options:ocidRangeOption
log ocidSMSTORange
-->(*location:0, length:6*)ならショートメッセージ

###################################
##### 電番バーコード判定
###################################
set ocidRangeOption to (refMe's NSAnchoredSearch as integer) + (refMe's NSCaseInsensitiveSearch as integer)
-->9
set ocidSMSTORange to ocidQrCodeMessageString's rangeOfString:"TEL:" options:ocidRangeOption
log ocidSMSTORange
-->(*location:0, length:4*)なら電話バーコード


###################################
##### メールバーコード判定
###################################
set ocidRangeOption to (refMe's NSAnchoredSearch as integer) + (refMe's NSCaseInsensitiveSearch as integer)
-->9
set ocidSMSTORange to ocidQrCodeMessageString's rangeOfString:"MAILTO:" options:ocidRangeOption
log ocidSMSTORange
-->(*location:0, length:7*)ならメールバーコード


###################################
##### GEOコード判定
###################################
set ocidRangeOption to (refMe's NSAnchoredSearch as integer) + (refMe's NSCaseInsensitiveSearch as integer)
-->9
set ocidSMSTORange to ocidQrCodeMessageString's rangeOfString:"GEO:" options:ocidRangeOption
log ocidSMSTORange
-->(*location:0, length:4*)ならGEOバーコード

###################################
##### HTTP リンク コード判定
###################################
set ocidRangeOption to (refMe's NSAnchoredSearch as integer) + (refMe's NSCaseInsensitiveSearch as integer)
-->9
set ocidSMSTORange to ocidQrCodeMessageString's rangeOfString:"HTTPS:" options:ocidRangeOption
log ocidSMSTORange
-->(*location:0, length:6*)ならHTTPリンクバーコード

###################################
##### テキストファイルに書き出し
###################################
set boolFileWrite to (ocidQrCodeMessageString's writeToURL:ocidSaveFilePathURL atomically:false encoding:(refMe's NSUTF8StringEncoding) |error|:(reference))


###################################
##### ダイアログ
###################################
set aliasIconPath to POSIX file "/System/Library/CoreServices/Applications/Wireless Diagnostics.app/Contents/Resources/AppIcon.icns" as alias
set strDefaultAnswer to ocidQrCodeMessageString as text
try
  set recordResponse to (display dialog "コピーしてください" with title "QRコード読み取り結果" default answer strDefaultAnswer buttons {"OK", "キャンセル"} default button "OK" cancel button "キャンセル" with icon aliasIconPath giving up after 30 without hidden answer)
  
on error
  log "エラーしました"
  return "エラーしました"
  error number -128
end try
if true is equal to (gave up of recordResponse) then
  return "時間切れですやりなおしてください"
  error number -128
end if
if "OK" is equal to (button returned of recordResponse) then
  set theResponse to (text returned of recordResponse) as text
else
  log "エラーしました"
  return "エラーしました"
  error number -128
end if




|

その他のカテゴリー

Acrobat Acrobat Annotation Acrobat Dialog Acrobat Form Acrobat JS Acrobat Open Acrobat Plugin Acrobat python Acrobat Reader Acrobat Sequ Acrobat Stamps Admin Admin Account Admin Apachectl Admin configCode Admin Device Management Admin LaunchServices Admin Locationd Admin loginitem Admin Maintenance Admin Permission Admin Pkg Admin Power Management Admin Printer Admin SetUp Admin SMB Admin System Information Admin Tools Admin Users Admin Volumes Adobe Apple AppleScript AppleScript Guide AppleScript Accessibility AppleScript AppKit AppleScript Applications AppleScript AppStore AppleScript Archive AppleScript Attributes AppleScript Automator AppleScript AVAsset AppleScript AVconvert AppleScript AVFoundation AppleScript AVURLAsset AppleScript BackUp AppleScript Barcode AppleScript Bash AppleScript Basic AppleScript Basic Path AppleScript Bluetooth AppleScript BOX AppleScript Browser AppleScript Calendar AppleScript CD/DVD AppleScript Choose AppleScript Chrome AppleScript CIImage AppleScript CloudStorage AppleScript Color AppleScript com.apple.LaunchServices.OpenWith AppleScript Console AppleScript Contacts AppleScript CotEditor AppleScript CURL AppleScript current application AppleScript Date&Time AppleScript delimiters AppleScript Desktop AppleScript Device AppleScript Disk AppleScript do shell script AppleScript Dock AppleScript DropBox AppleScript eMail AppleScript Encode Decode AppleScript Error AppleScript EXIFData AppleScript ffmpeg AppleScript File AppleScript Finder AppleScript Firefox AppleScript Folder AppleScript Fonts AppleScript GIF AppleScript HTML AppleScript Icon AppleScript Illustrator AppleScript Image Events AppleScript Image2PDF AppleScript ImageOptim Applescript iWork AppleScript Javascript AppleScript Jedit AppleScript Json AppleScript Label AppleScript List AppleScript locationd AppleScript LRC AppleScript LSSharedFileList AppleScript m3u8 AppleScript MakePDF AppleScript Map AppleScript Math AppleScript Microsoft AppleScript Microsoft Edge AppleScript Microsoft Excel AppleScript Mobileconfig AppleScript Mouse AppleScript Movie AppleScript Music AppleScript NetWork AppleScript Notes AppleScript NSArray AppleScript NSBitmapImageRep AppleScript NSBundle AppleScript NSCFBoolean AppleScript NSCharacterSet AppleScript NSColor AppleScript NSColorList AppleScript NSData AppleScript NSDictionary AppleScript NSError AppleScript NSEvent AppleScript NSFileAttributes AppleScript NSFileManager AppleScript NSFont AppleScript NSFontManager AppleScript NSImage AppleScript NSIndex AppleScript NSKeyedArchiver AppleScript NSKeyedUnarchiver AppleScript NSLocale AppleScript NSMutableArray AppleScript NSMutableDictionary AppleScript NSMutableString AppleScript NSNotFound AppleScript NSNumber AppleScript NSOpenPanel AppleScript NSPasteboard AppleScript NSPDFImageRep AppleScript NSpoint AppleScript NSPredicate AppleScript NSRange AppleScript NSRegularExpression AppleScript NSRunningApplication AppleScript NSScreen AppleScript NSSize AppleScript NSString AppleScript NSStringCompareOptions AppleScript NSTask AppleScript NSTimeZone AppleScript NSURL AppleScript NSURL File AppleScript NSURLBookmark AppleScript NSURLComponents AppleScript NSURLResourceKey AppleScript NSUserDefaults AppleScript NSUUID AppleScript NSView AppleScript NSWorkspace AppleScript Numbers AppleScript OAuth AppleScript ObjC AppleScript OneDrive AppleScript Osax AppleScript PDF AppleScript PDFAnnotationWidget AppleScript PDFContext AppleScript PDFDisplayBox AppleScript PDFDocumentPermissions AppleScript PDFKit AppleScript PDFnUP AppleScript PDFOutline AppleScript Photos AppleScript Photoshop AppleScript Plist System Events AppleScript PostScript AppleScript prefPane AppleScript Preview AppleScript Python AppleScript QR AppleScript QR Decode AppleScript QuickLook AppleScript QuickTime AppleScript record AppleScript Regular Expression AppleScript Reminders AppleScript ReName AppleScript Repeat AppleScript RTF AppleScript Safari AppleScript SaveFile AppleScript ScreenCapture AppleScript ScreenSaver AppleScript Script Editor AppleScript Script Menu AppleScript Shortcuts AppleScript Shortcuts Events AppleScript Sort AppleScript Sound AppleScript Spotlight AppleScript SRT AppleScript StandardAdditions AppleScript stringByApplyingTransform AppleScript System Events AppleScript System Settings AppleScript TemporaryItems AppleScript Terminal AppleScript Text AppleScript Text CSV AppleScript Text TSV AppleScript TextEdit AppleScript Translate AppleScript Trash AppleScript Twitter AppleScript UI AppleScript Unit Conversion AppleScript UTType AppleScript valueForKeyPath AppleScript Video AppleScript VisionKit AppleScript Visual Studio Code AppleScript webarchive AppleScript webp AppleScript Wifi AppleScript XML AppleScript XML EPUB AppleScript XML OPML AppleScript XML Plist AppleScript XML RSS AppleScript XML SVG AppleScript XML TTML AppleScript XML webloc AppleScript YouTube AppleScript Zero Suppress Applications Barcode OnLine Tools CityCode Design iPhone List Logs lsappinfo Memo Music perl PlistBuddy pluginkit postalcode ReadMe SF Symbols character id SF Symbols Entity sips Skype Slack sqlite TCC Tools Typography Video Wacom zoom