Barcode

[CIPDF417BarcodeGenerator]PDF417バーコードを作成する

基本はQRと同じ
値は仕様を参照



#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#webViewベーススクリプト
#https://macscripter.net/viewtopic.php?pid=209146
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
##自分環境がos12なので2.8にしているだけです
use AppleScript version "2.8"
use framework "Foundation"
use framework "AppKit"
use framework "WebKit"
use scripting additions

property objMe : a reference to current application
property objNSURL : a reference to objMe's NSURL
property objNSString : a reference to objMe's NSString
set objFileManager to objMe's NSFileManager's defaultManager()

#####################################
set aliasIconPath to POSIX file "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/BookmarkIcon.icns" as alias
set theResponse to "Hello worldsABCDEFG1234" as text
try
set objResponse to (display dialog "数値のみ48桁まで" with title "PDF417コードを作成します" default answer theResponse buttons {"OK", "キャンセル"} default button "OK" cancel button "キャンセル" with icon aliasIconPath giving up after 20 without hidden answer)
on error
log "エラーしました"
return
end try
if true is equal to (gave up of objResponse) then
return "時間切れですやりなおしてください"
end if
if "OK" is equal to (button returned of objResponse) then
set strText to (text returned of objResponse) as text
else
return "キャンセル"
end if
###フォルダのパス
###ピクチャーフォルダのパス
set aliasDirPath to (path to pictures folder from user domain) as alias
set strDirPath to POSIX path of aliasDirPath as text
####フォルダ名
set strFolderName to "QRcode" as text
set strDirPath to ("" & strDirPath & strFolderName & "") as text
###NSStringテキスト
set ocidDirPath to objNSString's stringWithString:strDirPath
###フォルダを作る
###途中のフォルダも作る-->true
set boolMakeNewFolder to (objFileManager's createDirectoryAtPath:ocidDirPath withIntermediateDirectories:true attributes:(missing value) |error|:(missing value))

####日付フォーマット
set prefDateFormat to "yyyyMMddHHmmss"
set ocidFormatter to objMe's NSDateFormatter's alloc()'s init()
ocidFormatter's setLocale:(objMe's NSLocale's localeWithLocaleIdentifier:"ja_JP_POSIX")
ocidFormatter's setDateFormat:(prefDateFormat as string)
set strDateAndTime to (ocidFormatter's stringFromDate:(current date)) as text
#####日付をファイル名にする
set strSaveFilePath to strDirPath & "/" & strDateAndTime & ".png"

#####################################
set strInputText to (strText) as text
####テキストをNSString
set ocidInputString to objNSString's stringWithString:strInputText
#####################################
##全角を半角に変換して
set ocidInputStringHalfwidth to (ocidInputString's stringByApplyingTransform:(objMe's NSStringTransformFullwidthToHalfwidth) |reverse|:false)
##制御文字取り除き
set ocidwhitespaceAndNewlineCharacterSet to objMe's NSCharacterSet's whitespaceAndNewlineCharacterSet
set ocidInputString to ocidInputStringHalfwidth's stringByTrimmingCharactersInSet:ocidwhitespaceAndNewlineCharacterSet
##スペース取り除き
set ocidSearchString to objNSString's stringWithString:" "
set ocidReplacementString to objNSString's stringWithString:""
set ocidTrimmingText to ocidInputString's stringByReplacingOccurrencesOfString:ocidSearchString withString:ocidReplacementString
##ハイフン取り除き
set ocidSearchString to objNSString's stringWithString:"-"
set ocidTrimmingText to ocidTrimmingText's stringByReplacingOccurrencesOfString:ocidSearchString withString:ocidReplacementString
#####################################
####テキストをUTF8
set ocidUtf8InputString to ocidTrimmingText's dataUsingEncoding:(objMe's NSUTF8StringEncoding)
####CIPDF417BarcodeGenerator初期化
set ocidPDF417Image to objMe's CIFilter's filterWithName:"CIPDF417BarcodeGenerator"
ocidPDF417Image's setDefaults()
###設定
ocidPDF417Image's setValue:ocidUtf8InputString forKey:"inputMessage"
###BOOLEAN
ocidPDF417Image's setValue:"false" forKey:"inputAlwaysSpecifyCompaction"
ocidPDF417Image's setValue:"true" forKey:"inputCompactStyle"
##Number. Min: 0.0 Max: 3.0
ocidPDF417Image's setValue:"3.0" forKey:"inputCompactionMode"
##Number. Min: 0.0 Max: 8.0
ocidPDF417Image's setValue:"3.0" forKey:"inputCorrectionLevel"
##Number. Min: 1.0 Max: 30.0
ocidPDF417Image's setValue:"5" forKey:"inputDataColumns"
##Number. Min: 3.0 Max: 90.0
ocidPDF417Image's setValue:"10" forKey:"inputRows"
##Number. Min: 13.0 Max: 283.0
ocidPDF417Image's setValue:"100" forKey:"inputMaxHeight"
##Number. Min: 56.0 Max: 583.0
ocidPDF417Image's setValue:"480" forKey:"inputMaxWidth"
##Number. Min: 13.0 Max: 283.0
ocidPDF417Image's setValue:"100" forKey:"inputMinHeight"
##Number. Min: 56.0 Max: 583.0
ocidPDF417Image's setValue:"100" forKey:"inputMinWidth"
##Number. Min: 0.0
ocidPDF417Image's setValue:"1" forKey:"inputPreferredAspectRatio"

###PDF417コード本体のイメージ
set ocidCIImage to ocidPDF417Image's outputImage()
log ocidCIImage
log className() of ocidCIImage as text

-->ここで生成されるのはPDF417は一番細いライン幅1pxの最小サイズ
###PDF417コードの縦横取得
set ocidCIImageDimension to ocidCIImage's extent()
set ocidCIImageWidth to (item 1 of item 2 of ocidCIImageDimension) as integer
set ocidCIImageHight to (item 2 of item 2 of ocidCIImageDimension) as integer
###最終的に出力したいpxサイズ
set numScaleMax to 580
###整数で拡大しないとアレなのでの値のニアなサイズになります
set numWidth to ((numScaleMax / ocidCIImageWidth) div 1) as integer
set numHight to (((580 / 2) / ocidCIImageHight) div 1) as integer
###↑サイズの拡大縮小する場合はここで値を調整すれば良い
####変換スケール作成-->拡大
set recordScalse to objMe's CGAffineTransform's CGAffineTransformMakeScale(numWidth, numHight)
##変換スケールを適応(元のサイズに元のサイズのスケール適応しても意味ないけど
set ocidCIImageScaled to ocidCIImage's imageByApplyingTransform:recordScalse
#######元のセルが1x1pxの最小サイズで出したいときはここで処理
##set ocidCIImageScaled to ocidCIImage
###イメージデータを展開
set ocidNSCIImageRep to objMe's NSCIImageRep's imageRepWithCIImage:ocidCIImageScaled
###出力用のイメージの初期化
set ocidNSImageScaled to objMe's NSImage's alloc()'s initWithSize:(ocidNSCIImageRep's |size|())
###イメージデータを合成
ocidNSImageScaled's addRepresentation:ocidNSCIImageRep
###出来上がったデータはOS_dispatch_data
set ocidOsDispatchData to ocidNSImageScaled's TIFFRepresentation()
####NSBitmapImageRep
set ocidNSBitmapImageRep to objMe's NSBitmapImageRep's imageRepWithData:ocidOsDispatchData
#####################################
###quiet zone用に画像をパディングする
set numPadWidth to ((ocidCIImageWidth * numWidth) + (numWidth * 6)) as integer
set numPadHight to ((ocidCIImageHight * numHight) + (numHight * 6)) as integer
###左右に4セル分づつ余白 quiet zoneを足す
####まずは元のコードのサイズに8セルサイズ分足したサイズの画像を作って
set ocidNSBitmapImagePadRep to (objMe's NSBitmapImageRep's alloc()'s initWithBitmapDataPlanes:(missing value) pixelsWide:numPadWidth pixelsHigh:numPadHight bitsPerSample:8 samplesPerPixel:4 hasAlpha:true isPlanar:false colorSpaceName:(objMe's NSCalibratedRGBColorSpace) bitmapFormat:(objMe's NSAlphaFirstBitmapFormat) bytesPerRow:0 bitsPerPixel:32)
###初期化
objMe's NSGraphicsContext's saveGraphicsState()
###ビットマップイメージ
(objMe's NSGraphicsContext's setCurrentContext:(objMe's NSGraphicsContext's graphicsContextWithBitmapImageRep:ocidNSBitmapImagePadRep))
###塗り色を『白』に指定して
objMe's NSColor's whiteColor()'s |set|()
###画像にする
objMe's NSRectFill({origin:{x:0, y:0}, |size|:{width:numPadWidth, height:numPadHight}})
###出来上がった画像にバーコードを左右3セル分ずらした位置にCompositeSourceOverする
ocidNSBitmapImageRep's drawInRect:{origin:{x:(numWidth * 3), y:(numHight * 3)}, |size|:{width:numPadWidth, Hight:numPadHight}} fromRect:{origin:{x:0, y:0}, |size|:{width:numPadWidth, height:numPadHight}} operation:(objMe's NSCompositeSourceOver) fraction:1.0 respectFlipped:true hints:(missing value)
####画像作成終了
objMe's NSGraphicsContext's restoreGraphicsState()

#####################################
####JPEG用の圧縮プロパティ
##set ocidNSSingleEntryDictionary to objMe's NSDictionary's dictionaryWithObject:1 forKey:(objMe's NSImageCompressionFactor)
####PNG用の圧縮プロパティ
set ocidNSSingleEntryDictionary to objMe's NSDictionary's dictionaryWithObject:true forKey:(objMe's NSImageInterlaced)

#####出力イメージへ変換
set ocidNSInlineData to (ocidNSBitmapImagePadRep's representationUsingType:(objMe's NSBitmapImageFileTypePNG) |properties|:ocidNSSingleEntryDictionary)
(*
NSBitmapImageFileTypeJPEG
NSBitmapImageFileTypePNG
NSBitmapImageFileTypeGIF
NSBitmapImageFileTypeBMP
NSBitmapImageFileTypeTIFF
NSBitmapImageFileTypeJPEG2000
*)
######インラインデータをファイルに書き出し
set boolMakePDF417 to (ocidNSInlineData's writeToFile:strSaveFilePath atomically:true)



set aliasDirPath to POSIX file strDirPath as alias

tell application "Finder"

select aliasDirPath
activate
end tell


return

#####################################
set targetURL to ("file://" & strSaveFilePath & "") as text
#####################################
repeat 1 times
####NSMutableDictionaryの初期化
set ocidNSDictionaryM to objMe's NSMutableDictionary's dictionary()
####ウィンドのサイズ
set {numWidth, numHeight} to {600, 300}
tell ocidNSDictionaryM
####画像のパス
its setObject:targetURL forKey:"theURL"
####ウィンドのサイズ
its setObject:numWidth forKey:"width"
its setObject:numHeight forKey:"height"
end tell
if objMe's NSThread's isMainThread() as boolean then
####Webビューを表示する
my performWebView:ocidNSDictionaryM
else
my performSelectorOnMainThread:"performWebView:" withObject:ocidNSDictionaryM waitUntilDone:true
end if
tell ocidNSDictionaryM
activate
end tell
#####10秒間開いたら閉じる
#####ここでこの処理をしたのはスクリプトメニューからの実行を配慮して
delay 10
end repeat



on performWebView:ocidNSDictionaryM
set {width, height} to {ocidNSDictionaryM's objectForKey:"width", ocidNSDictionaryM's objectForKey:"height"}
set strURL to (ocidNSDictionaryM's objectForKey:"theURL")
########
set theConfiguration to objMe's WKWebViewConfiguration's alloc()'s init()
set ocidURL to objNSURL's URLWithString:strURL
set theFetch to objNSString's stringWithContentsOfURL:ocidURL encoding:(objMe's NSUTF8StringEncoding) |error|:(missing value)
set theUserScript to objMe's WKUserScript's alloc()'s initWithSource:theFetch injectionTime:(objMe's WKUserScriptInjectionTimeAtDocumentEnd) forMainFrameOnly:true
set theUserContentController to objMe's WKUserContentController's alloc()'s init()
theUserContentController's addUserScript:theUserScript
theConfiguration's setUserContentController:theUserContentController
set webViewSize to objMe's NSMakeRect(0, 0, width, height)
set webView to objMe's WKWebView's alloc()'s initWithFrame:webViewSize configuration:theConfiguration
webView's setNavigationDelegate:me
webView's setUIDelegate:me
webView's setTranslatesAutoresizingMaskIntoConstraints:true
set theURL to objMe's |NSURL|'s URLWithString:strURL
set theRequest to objMe's NSURLRequest's requestWithURL:theURL
webView's loadRequest:theRequest
set ocidWebView to webView
########
set listWindowSize to objMe's NSMakeRect(0, 0, width, height)
set numStyleMaskNo to (objMe's NSWindowStyleMaskTitled as integer)
set numStyleMaskNo to numStyleMaskNo + (objMe's NSWindowStyleMaskClosable as integer)
set numStyleMaskNo to numStyleMaskNo + (objMe's NSWindowStyleMaskMiniaturizable as integer)
set numStyleMaskNo to numStyleMaskNo + (objMe's NSWindowStyleMaskResizable as integer)
set ocidWindow to objMe's NSWindow's alloc()'s initWithContentRect:listWindowSize styleMask:numStyleMaskNo backing:2 defer:yes
########
ocidWindow's setContentView:ocidWebView
set ocidNSWindowController to objMe's NSWindowController's alloc()'s initWithWindow:ocidWindow
ocidNSWindowController's showWindow:me
ocidNSWindowController's |window|'s |center|()
ocidNSWindowController's |window|'s makeKeyAndOrderFront:me
tell ocidNSDictionaryM to its setObject:ocidWindow forKey:"window"
end performWebView:

|

[CICode128BarcodeGenerator]Code128バーコード作成

基本はQRコードと同じ


#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#webViewベーススクリプト
#https://macscripter.net/viewtopic.php?pid=209146
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
##自分環境がos12なので2.8にしているだけです
use AppleScript version "2.8"
use framework "Foundation"
use framework "AppKit"
use framework "WebKit"
use scripting additions

property objMe : a reference to current application
property objNSURL : a reference to objMe's NSURL
property objNSString : a reference to objMe's NSString
set objFileManager to objMe's NSFileManager's defaultManager()

#####################################
set aliasIconPath to POSIX file "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/BookmarkIcon.icns" as alias
set theResponse to "1234567890" as text
try
set objResponse to (display dialog "数値のみ48桁まで" with title "code128コードを作成します" default answer theResponse buttons {"OK", "キャンセル"} default button "OK" cancel button "キャンセル" with icon aliasIconPath giving up after 20 without hidden answer)
on error
log "エラーしました"
return
end try
if true is equal to (gave up of objResponse) then
return "時間切れですやりなおしてください"
end if
if "OK" is equal to (button returned of objResponse) then
set strText to (text returned of objResponse) as text
else
return "キャンセル"
end if
###フォルダのパス
###ピクチャーフォルダのパス
set aliasDirPath to (path to pictures folder from user domain) as alias
set strDirPath to POSIX path of aliasDirPath as text
####フォルダ名
set strFolderName to "QRcode" as text
set strDirPath to ("" & strDirPath & strFolderName & "") as text
###NSStringテキスト
set ocidDirPath to objNSString's stringWithString:strDirPath
###フォルダを作る
###途中のフォルダも作る-->true
set boolMakeNewFolder to (objFileManager's createDirectoryAtPath:ocidDirPath withIntermediateDirectories:true attributes:(missing value) |error|:(missing value))

####日付フォーマット
set prefDateFormat to "yyyyMMddHHmmss"
set ocidFormatter to objMe's NSDateFormatter's alloc()'s init()
ocidFormatter's setLocale:(objMe's NSLocale's localeWithLocaleIdentifier:"ja_JP_POSIX")
ocidFormatter's setDateFormat:(prefDateFormat as string)
set strDateAndTime to (ocidFormatter's stringFromDate:(current date)) as text
#####日付をファイル名にする
set strSaveFilePath to strDirPath & "/" & strDateAndTime & ".png"

#####################################
set strInputText to (strText) as text
####テキストをNSString
set ocidInputString to objNSString's stringWithString:strInputText
#####################################
##全角を半角に変換して
set ocidInputStringHalfwidth to (ocidInputString's stringByApplyingTransform:(objMe's NSStringTransformFullwidthToHalfwidth) |reverse|:false)
##制御文字取り除き
set ocidwhitespaceAndNewlineCharacterSet to objMe's NSCharacterSet's whitespaceAndNewlineCharacterSet
set ocidInputString to ocidInputStringHalfwidth's stringByTrimmingCharactersInSet:ocidwhitespaceAndNewlineCharacterSet
##スペース取り除き
set ocidSearchString to objNSString's stringWithString:" "
set ocidReplacementString to objNSString's stringWithString:""
set ocidTrimmingText to ocidInputString's stringByReplacingOccurrencesOfString:ocidSearchString withString:ocidReplacementString
##ハイフン取り除き
set ocidSearchString to objNSString's stringWithString:"-"
set ocidTrimmingText to ocidTrimmingText's stringByReplacingOccurrencesOfString:ocidSearchString withString:ocidReplacementString
#####################################
####テキストをUTF8
set ocidUtf8InputString to ocidTrimmingText's dataUsingEncoding:(objMe's NSUTF8StringEncoding)
####CICode128Generator初期化
set ocidCode128Image to objMe's CIFilter's filterWithName:"CICode128BarcodeGenerator"
ocidCode128Image's setDefaults()
###テキスト設定
ocidCode128Image's setValue:ocidUtf8InputString forKey:"inputMessage"
###QuietSpace
ocidCode128Image's setValue:"4.0" forKey:"inputQuietSpace"
###inputBarcodeHeight
ocidCode128Image's setValue:"12.0" forKey:"inputBarcodeHeight"
###Code128コード本体のイメージ
set ocidCIImage to ocidCode128Image's outputImage()
-->ここで生成されるのはCode128は一番細いライン幅1pxの最小サイズ
###Code128コードの縦横取得
set ocidCIImageDimension to ocidCIImage's extent()
set ocidCIImageWidth to (item 1 of item 2 of ocidCIImageDimension) as integer
set ocidCIImageHight to (item 2 of item 2 of ocidCIImageDimension) as integer
###最終的に出力したいpxサイズ
set numScaleMax to 580
###整数で拡大しないとアレなのでの値のニアなサイズになります
set numWidth to ((numScaleMax / ocidCIImageWidth) div 1) as integer
set numHight to (((580 / 2) / ocidCIImageHight) div 1) as integer
###↑サイズの拡大縮小する場合はここで値を調整すれば良い
####変換スケール作成-->拡大
set recordScalse to objMe's CGAffineTransform's CGAffineTransformMakeScale(numWidth, numHight)
##変換スケールを適応(元のサイズに元のサイズのスケール適応しても意味ないけど
set ocidCIImageScaled to ocidCIImage's imageByApplyingTransform:recordScalse
#######元のセルが1x1pxの最小サイズで出したいときはここで処理
##set ocidCIImageScaled to ocidCIImage
###イメージデータを展開
set ocidNSCIImageRep to objMe's NSCIImageRep's imageRepWithCIImage:ocidCIImageScaled
###出力用のイメージの初期化
set ocidNSImageScaled to objMe's NSImage's alloc()'s initWithSize:(ocidNSCIImageRep's |size|())
###イメージデータを合成
ocidNSImageScaled's addRepresentation:ocidNSCIImageRep
###出来上がったデータはOS_dispatch_data
set ocidOsDispatchData to ocidNSImageScaled's TIFFRepresentation()
####NSBitmapImageRep
set ocidNSBitmapImageRep to objMe's NSBitmapImageRep's imageRepWithData:ocidOsDispatchData
#####################################
###quiet zone用に画像をパディングする
set numPadWidth to ((ocidCIImageWidth * numWidth) + (numWidth * 6)) as integer
set numPadHight to ((ocidCIImageHight * numHight) + (numHight * 6)) as integer
###左右に4セル分づつ余白 quiet zoneを足す
####まずは元のコードのサイズに8セルサイズ分足したサイズの画像を作って
set ocidNSBitmapImagePadRep to (objMe's NSBitmapImageRep's alloc()'s initWithBitmapDataPlanes:(missing value) pixelsWide:numPadWidth pixelsHigh:numPadHight bitsPerSample:8 samplesPerPixel:4 hasAlpha:true isPlanar:false colorSpaceName:(objMe's NSCalibratedRGBColorSpace) bitmapFormat:(objMe's NSAlphaFirstBitmapFormat) bytesPerRow:0 bitsPerPixel:32)
###初期化
objMe's NSGraphicsContext's saveGraphicsState()
###ビットマップイメージ
(objMe's NSGraphicsContext's setCurrentContext:(objMe's NSGraphicsContext's graphicsContextWithBitmapImageRep:ocidNSBitmapImagePadRep))
###塗り色を『白』に指定して
objMe's NSColor's whiteColor()'s |set|()
###画像にする
objMe's NSRectFill({origin:{x:0, y:0}, |size|:{width:numPadWidth, height:numPadHight}})
###出来上がった画像にバーコードを左右3セル分ずらした位置にCompositeSourceOverする
ocidNSBitmapImageRep's drawInRect:{origin:{x:(numWidth * 3), y:(numHight * 3)}, |size|:{width:numPadWidth, Hight:numPadHight}} fromRect:{origin:{x:0, y:0}, |size|:{width:numPadWidth, height:numPadHight}} operation:(objMe's NSCompositeSourceOver) fraction:1.0 respectFlipped:true hints:(missing value)
####画像作成終了
objMe's NSGraphicsContext's restoreGraphicsState()

#####################################
####JPEG用の圧縮プロパティ
##set ocidNSSingleEntryDictionary to objMe's NSDictionary's dictionaryWithObject:1 forKey:(objMe's NSImageCompressionFactor)
####PNG用の圧縮プロパティ
set ocidNSSingleEntryDictionary to objMe's NSDictionary's dictionaryWithObject:true forKey:(objMe's NSImageInterlaced)

#####出力イメージへ変換
set ocidNSInlineData to (ocidNSBitmapImagePadRep's representationUsingType:(objMe's NSBitmapImageFileTypePNG) |properties|:ocidNSSingleEntryDictionary)
(*
NSBitmapImageFileTypeJPEG
NSBitmapImageFileTypePNG
NSBitmapImageFileTypeGIF
NSBitmapImageFileTypeBMP
NSBitmapImageFileTypeTIFF
NSBitmapImageFileTypeJPEG2000
*)
######インラインデータをファイルに書き出し
set boolMakeCode128 to (ocidNSInlineData's writeToFile:strSaveFilePath atomically:true)



set aliasDirPath to POSIX file strDirPath as alias

tell application "Finder"

select aliasDirPath
activate
end tell


return

#####################################
set targetURL to ("file://" & strSaveFilePath & "") as text
#####################################
repeat 1 times
####NSMutableDictionaryの初期化
set ocidNSDictionaryM to objMe's NSMutableDictionary's dictionary()
####ウィンドのサイズ
set {numWidth, numHeight} to {600, 300}
tell ocidNSDictionaryM
####画像のパス
its setObject:targetURL forKey:"theURL"
####ウィンドのサイズ
its setObject:numWidth forKey:"width"
its setObject:numHeight forKey:"height"
end tell
if objMe's NSThread's isMainThread() as boolean then
####Webビューを表示する
my performWebView:ocidNSDictionaryM
else
my performSelectorOnMainThread:"performWebView:" withObject:ocidNSDictionaryM waitUntilDone:true
end if
tell ocidNSDictionaryM
activate
end tell
#####10秒間開いたら閉じる
#####ここでこの処理をしたのはスクリプトメニューからの実行を配慮して
delay 10
end repeat



on performWebView:ocidNSDictionaryM
set {width, height} to {ocidNSDictionaryM's objectForKey:"width", ocidNSDictionaryM's objectForKey:"height"}
set strURL to (ocidNSDictionaryM's objectForKey:"theURL")
########
set theConfiguration to objMe's WKWebViewConfiguration's alloc()'s init()
set ocidURL to objNSURL's URLWithString:strURL
set theFetch to objNSString's stringWithContentsOfURL:ocidURL encoding:(objMe's NSUTF8StringEncoding) |error|:(missing value)
set theUserScript to objMe's WKUserScript's alloc()'s initWithSource:theFetch injectionTime:(objMe's WKUserScriptInjectionTimeAtDocumentEnd) forMainFrameOnly:true
set theUserContentController to objMe's WKUserContentController's alloc()'s init()
theUserContentController's addUserScript:theUserScript
theConfiguration's setUserContentController:theUserContentController
set webViewSize to objMe's NSMakeRect(0, 0, width, height)
set webView to objMe's WKWebView's alloc()'s initWithFrame:webViewSize configuration:theConfiguration
webView's setNavigationDelegate:me
webView's setUIDelegate:me
webView's setTranslatesAutoresizingMaskIntoConstraints:true
set theURL to objMe's |NSURL|'s URLWithString:strURL
set theRequest to objMe's NSURLRequest's requestWithURL:theURL
webView's loadRequest:theRequest
set ocidWebView to webView
########
set listWindowSize to objMe's NSMakeRect(0, 0, width, height)
set numStyleMaskNo to (objMe's NSWindowStyleMaskTitled as integer)
set numStyleMaskNo to numStyleMaskNo + (objMe's NSWindowStyleMaskClosable as integer)
set numStyleMaskNo to numStyleMaskNo + (objMe's NSWindowStyleMaskMiniaturizable as integer)
set numStyleMaskNo to numStyleMaskNo + (objMe's NSWindowStyleMaskResizable as integer)
set ocidWindow to objMe's NSWindow's alloc()'s initWithContentRect:listWindowSize styleMask:numStyleMaskNo backing:2 defer:yes
########
ocidWindow's setContentView:ocidWebView
set ocidNSWindowController to objMe's NSWindowController's alloc()'s initWithWindow:ocidWindow
ocidNSWindowController's showWindow:me
ocidNSWindowController's |window|'s |center|()
ocidNSWindowController's |window|'s makeKeyAndOrderFront:me
tell ocidNSDictionaryM to its setObject:ocidWindow forKey:"window"
end performWebView:

|

[WKWebView]QRコードを表示する

webViewの基本構造はこちらを使用しています。
https://macscripter.net/viewtopic.php?pid=209146



#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#webViewベーススクリプト
#https://macscripter.net/viewtopic.php?pid=209146
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
##自分環境がos12なので2.8にしているだけです
use AppleScript version "2.8"
use framework "Foundation"
use framework "AppKit"
use framework "WebKit"
use scripting additions

property objMe : a reference to current application
property objNSURL : a reference to objMe's NSURL
property objNSString : a reference to objMe's NSString
set objFileManager to objMe's NSFileManager's defaultManager()

#####################################
set aliasIconPath to POSIX file "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/BookmarkIcon.icns" as alias
set theResponse to "" as text
try
set objResponse to (display dialog "バーコードの内容を入力" with title "QRコードを作成します" default answer theResponse buttons {"OK", "キャンセル"} default button "OK" cancel button "キャンセル" with icon aliasIconPath giving up after 20 without hidden answer)
on error
log "エラーしました"
return
end try
if true is equal to (gave up of objResponse) then
return "時間切れですやりなおしてください"
end if
if "OK" is equal to (button returned of objResponse) then
set strText to (text returned of objResponse) as text
else
return "キャンセル"
end if
###フォルダのパス
###ピクチャーフォルダのパス
set aliasDirPath to (path to pictures folder from user domain) as alias
set strDirPath to POSIX path of aliasDirPath as text
####フォルダ名
set strFolderName to "QRcode" as text
set strDirPath to ("" & strDirPath & strFolderName & "") as text
###NSStringテキスト
set ocidDirPath to objNSString's stringWithString:strDirPath
###フォルダを作る
###途中のフォルダも作る-->true
set boolMakeNewFolder to (objFileManager's createDirectoryAtPath:ocidDirPath withIntermediateDirectories:true attributes:(missing value) |error|:(missing value))

####日付フォーマット
set prefDateFormat to "yyyyMMddHHmmss"
set ocidFormatter to objMe's NSDateFormatter's alloc()'s init()
ocidFormatter's setLocale:(objMe's NSLocale's localeWithLocaleIdentifier:"ja_JP_POSIX")
ocidFormatter's setDateFormat:(prefDateFormat as string)
set strDateAndTime to (ocidFormatter's stringFromDate:(current date)) as text
#####日付をファイル名にする
set strSaveFilePath to strDirPath & "/" & strDateAndTime & ".png"

#####################################
set strInputText to (strText) as text
####テキストをNSString
set ocidInputString to objNSString's stringWithString:strInputText
#####################################
##全角を半角に変換して
set ocidInputStringHalfwidth to (ocidInputString's stringByApplyingTransform:(objMe's NSStringTransformFullwidthToHalfwidth) |reverse|:false)
##制御文字取り除き
set ocidwhitespaceAndNewlineCharacterSet to objMe's NSCharacterSet's whitespaceAndNewlineCharacterSet
set ocidInputString to ocidInputStringHalfwidth's stringByTrimmingCharactersInSet:ocidwhitespaceAndNewlineCharacterSet
##スペース取り除き
set ocidSearchString to objNSString's stringWithString:" "
set ocidReplacementString to objNSString's stringWithString:""
set ocidTrimmingText to ocidInputString's stringByReplacingOccurrencesOfString:ocidSearchString withString:ocidReplacementString
##ハイフン取り除き
set ocidSearchString to objNSString's stringWithString:"-"
set ocidTrimmingText to ocidTrimmingText's stringByReplacingOccurrencesOfString:ocidSearchString withString:ocidReplacementString
#####################################
####テキストをUTF8
set ocidUtf8InputString to ocidTrimmingText's dataUsingEncoding:(objMe's NSUTF8StringEncoding)
####CIQRCodeGenerator初期化
set ocidQRcodeImage to objMe's CIFilter's filterWithName:"CIQRCodeGenerator"
ocidQRcodeImage's setDefaults()
###テキスト設定
ocidQRcodeImage's setValue:ocidUtf8InputString forKey:"inputMessage"
###読み取り誤差値設定L, M, Q, H
ocidQRcodeImage's setValue:"Q" forKey:"inputCorrectionLevel"
###QRコード本体のイメージ
set ocidCIImage to ocidQRcodeImage's outputImage()
-->ここで生成されるのはQRのセルが1x1pxの最小サイズ
###QRコードの縦横取得
set ocidCIImageDimension to ocidCIImage's extent()
set ocidCIImageWidth to (item 1 of item 2 of ocidCIImageDimension) as integer
set ocidCIImageHight to (item 2 of item 2 of ocidCIImageDimension) as integer
###最終的に出力したいpxサイズ
set numScaleMax to 580
###整数で拡大しないとアレなのでの値のニアなサイズになります
set numWidth to ((numScaleMax / ocidCIImageWidth) div 1) as integer
set numHight to ((numScaleMax / ocidCIImageHight) div 1) as integer
###↑サイズの拡大縮小する場合はここで値を調整すれば良い
####変換スケール作成-->拡大
set recordScalse to objMe's CGAffineTransform's CGAffineTransformMakeScale(numWidth, numHight)
##変換スケールを適応(元のサイズに元のサイズのスケール適応しても意味ないけど
set ocidCIImageScaled to ocidCIImage's imageByApplyingTransform:recordScalse
#######元のセルが1x1pxの最小サイズで出したいときはここで処理
##set ocidCIImageScaled to ocidCIImage
###イメージデータを展開
set ocidNSCIImageRep to objMe's NSCIImageRep's imageRepWithCIImage:ocidCIImageScaled
###出力用のイメージの初期化
set ocidNSImageScaled to objMe's NSImage's alloc()'s initWithSize:(ocidNSCIImageRep's |size|())
###イメージデータを合成
ocidNSImageScaled's addRepresentation:ocidNSCIImageRep
###出来上がったデータはOS_dispatch_data
set ocidOsDispatchData to ocidNSImageScaled's TIFFRepresentation()
####NSBitmapImageRep
set ocidNSBitmapImageRep to objMe's NSBitmapImageRep's imageRepWithData:ocidOsDispatchData
#####################################
###quiet zone用に画像をパディングする
set numPadWidth to ((ocidCIImageWidth * numWidth) + (numWidth * 6)) as integer
set numPadHight to ((ocidCIImageHight * numHight) + (numHight * 6)) as integer
###左右に4セル分づつ余白 quiet zoneを足す
####まずは元のQRコードのサイズに8セルサイズ分足したサイズの画像を作って
set ocidNSBitmapImagePadRep to (objMe's NSBitmapImageRep's alloc()'s initWithBitmapDataPlanes:(missing value) pixelsWide:numPadWidth pixelsHigh:numPadHight bitsPerSample:8 samplesPerPixel:4 hasAlpha:true isPlanar:false colorSpaceName:(objMe's NSCalibratedRGBColorSpace) bitmapFormat:(objMe's NSAlphaFirstBitmapFormat) bytesPerRow:0 bitsPerPixel:32)
###初期化
objMe's NSGraphicsContext's saveGraphicsState()
###ビットマップイメージ
(objMe's NSGraphicsContext's setCurrentContext:(objMe's NSGraphicsContext's graphicsContextWithBitmapImageRep:ocidNSBitmapImagePadRep))
###塗り色を『白』に指定して
objMe's NSColor's whiteColor()'s |set|()
###画像にする
objMe's NSRectFill({origin:{x:0, y:0}, |size|:{width:numPadWidth, height:numPadHight}})
###出来上がった画像にQRバーコードを左右3セル分ずらした位置にCompositeSourceOverする
ocidNSBitmapImageRep's drawInRect:{origin:{x:(numWidth * 3), y:(numHight * 3)}, |size|:{width:numPadWidth, Hight:numPadHight}} fromRect:{origin:{x:0, y:0}, |size|:{width:numPadWidth, height:numPadHight}} operation:(objMe's NSCompositeSourceOver) fraction:1.0 respectFlipped:true hints:(missing value)
####画像作成終了
objMe's NSGraphicsContext's restoreGraphicsState()

#####################################
####JPEG用の圧縮プロパティ
##set ocidNSSingleEntryDictionary to objMe's NSDictionary's dictionaryWithObject:1 forKey:(objMe's NSImageCompressionFactor)
####PNG用の圧縮プロパティ
set ocidNSSingleEntryDictionary to objMe's NSDictionary's dictionaryWithObject:true forKey:(objMe's NSImageInterlaced)

#####出力イメージへ変換
set ocidNSInlineData to (ocidNSBitmapImagePadRep's representationUsingType:(objMe's NSBitmapImageFileTypePNG) |properties|:ocidNSSingleEntryDictionary)
(*
NSBitmapImageFileTypeJPEG
NSBitmapImageFileTypePNG
NSBitmapImageFileTypeGIF
NSBitmapImageFileTypeBMP
NSBitmapImageFileTypeTIFF
NSBitmapImageFileTypeJPEG2000
*)
######インラインデータをファイルに書き出し
set boolMakeQrCode to (ocidNSInlineData's writeToFile:strSaveFilePath atomically:true)

set targetURL to ("file://" & strSaveFilePath & "") as text
#####################################
repeat 1 times
####NSMutableDictionaryの初期化
set ocidNSDictionaryM to objMe's NSMutableDictionary's dictionary()
####ウィンドのサイズ
set {numWidth, numHeight} to {600, 600}
tell ocidNSDictionaryM
####画像のパス
its setObject:targetURL forKey:"theURL"
####ウィンドのサイズ
its setObject:numWidth forKey:"width"
its setObject:numHeight forKey:"height"
end tell
if objMe's NSThread's isMainThread() as boolean then
####Webビューを表示する
my performWebView:ocidNSDictionaryM
else
my performSelectorOnMainThread:"performWebView:" withObject:ocidNSDictionaryM waitUntilDone:true
end if
tell ocidNSDictionaryM
activate
end tell
#####10秒間開いたら閉じる
#####ここでこの処理をしたのはスクリプトメニューからの実行を配慮して
delay 10
end repeat



on performWebView:ocidNSDictionaryM
set {width, height} to {ocidNSDictionaryM's objectForKey:"width", ocidNSDictionaryM's objectForKey:"height"}
set strURL to (ocidNSDictionaryM's objectForKey:"theURL")
########
set theConfiguration to objMe's WKWebViewConfiguration's alloc()'s init()
set ocidURL to objNSURL's URLWithString:strURL
set theFetch to objNSString's stringWithContentsOfURL:ocidURL encoding:(objMe's NSUTF8StringEncoding) |error|:(missing value)
set theUserScript to objMe's WKUserScript's alloc()'s initWithSource:theFetch injectionTime:(objMe's WKUserScriptInjectionTimeAtDocumentEnd) forMainFrameOnly:true
set theUserContentController to objMe's WKUserContentController's alloc()'s init()
theUserContentController's addUserScript:theUserScript
theConfiguration's setUserContentController:theUserContentController
set webViewSize to objMe's NSMakeRect(0, 0, width, height)
set webView to objMe's WKWebView's alloc()'s initWithFrame:webViewSize configuration:theConfiguration
webView's setNavigationDelegate:me
webView's setUIDelegate:me
webView's setTranslatesAutoresizingMaskIntoConstraints:true
set theURL to objMe's |NSURL|'s URLWithString:strURL
set theRequest to objMe's NSURLRequest's requestWithURL:theURL
webView's loadRequest:theRequest
set ocidWebView to webView
########
set listWindowSize to objMe's NSMakeRect(0, 0, width, height)
set numStyleMaskNo to (objMe's NSWindowStyleMaskTitled as integer)
set numStyleMaskNo to numStyleMaskNo + (objMe's NSWindowStyleMaskClosable as integer)
set numStyleMaskNo to numStyleMaskNo + (objMe's NSWindowStyleMaskMiniaturizable as integer)
set numStyleMaskNo to numStyleMaskNo + (objMe's NSWindowStyleMaskResizable as integer)
set ocidWindow to objMe's NSWindow's alloc()'s initWithContentRect:listWindowSize styleMask:numStyleMaskNo backing:2 defer:yes
########
ocidWindow's setContentView:ocidWebView
set ocidNSWindowController to objMe's NSWindowController's alloc()'s initWithWindow:ocidWindow
ocidNSWindowController's showWindow:me
ocidNSWindowController's |window|'s |center|()
ocidNSWindowController's |window|'s makeKeyAndOrderFront:me
tell ocidNSDictionaryM to its setObject:ocidWindow forKey:"window"
end performWebView:


|

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

api.qrserver.comのAPIを利用します

#!/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 objMe : a reference to current application
property objNSString : a reference to objMe's NSString
property objNSDictionary : a reference to objMe's NSDictionary
property objNSJSONSerialization : a reference to objMe's NSJSONSerialization

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

#####ファイル選択のダイアログ
set aliasFile 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 aliasFile as text
#####zxing.org使う場合
###set strCommandText to "/usr/bin/curl -d \"f=file\" --data-binary 'decode=@" & strFilePath & "' 'https://zxing.org/w/decode.jspx?'"
#####コマンドライン整形
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
#####NSDictionary初期化
set ocidNSDictionaryM to objNSDictionary's dictionary()
#####↑このNSDictionaryJSONの値を格納
set ocidJsonResponse to (objNSJSONSerialization's JSONObjectWithData:((objNSString's stringWithString:jsonResponse)'s dataUsingEncoding:(objMe's NSUTF8StringEncoding)) options:0 |error|:(missing value))
#####値を取り出す
set recodeCenters to (ocidJsonResponse's symbol)'s valueForKey:"data"
#####ダイアログを出す
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)
return

|

[QRCode]Line Out呼び出し用のQRバーコード生成

Img_0130

リンク先がこの画面のQRバーコードを生成します

ダウンロード - lineoutqr.scpt.zip



#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
(*
ラインのURL仕様はこちら
https://developers.line.biz/ja/docs/messaging-api/using-line-url-scheme
*)
#
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
##自分環境がos12なので2.8にしているだけです
use AppleScript version "2.8"
use framework "Foundation"
use framework "CoreImage"
use scripting additions

property objMe : a reference to current application
property objNSString : a reference to objMe's NSString
set objFileManager to objMe's NSFileManager's defaultManager()

set strBaseUrlt to "https://line.me/R/call/81/" as text

set aliasIconPath to POSIX file "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/BookmarkIcon.icns" as alias
set theResponse to "電話番号を入力" as text
try
set objResponse to (display dialog "電話番号を入力してください" with title "QRコードを作成します" default answer theResponse buttons {"OK", "キャンセル"} default button "OK" cancel button "キャンセル" with icon aliasIconPath giving up after 20 without hidden answer)
on error
log "エラーしました"
return
end try
if true is equal to (gave up of objResponse) then
return "時間切れですやりなおしてください"
end if
if "OK" is equal to (button returned of objResponse) then
set strText to (text returned of objResponse) as text
else
return "キャンセル"
end if


###フォルダのパス
###ピクチャーフォルダのパス
set aliasDirPath to (path to pictures folder from user domain) as alias
set strDirPath to POSIX path of aliasDirPath as text
####フォルダ名
set strFolderName to "QRcode" as text
set strDirPath to ("" & strDirPath & strFolderName & "") as text
###NSStringテキスト
set ocidDirPath to objNSString's stringWithString:strDirPath
###フォルダを作る
###途中のフォルダも作る-->true
set boolMakeNewFolder to (objFileManager's createDirectoryAtPath:ocidDirPath withIntermediateDirectories:true attributes:(missing value) |error|:(missing value))

####日付フォーマット
set prefDateFormat to "yyyyMMddHHmmss"
set ocidFormatter to objMe's NSDateFormatter's alloc()'s init()
ocidFormatter's setLocale:(objMe's NSLocale's localeWithLocaleIdentifier:"ja_JP_POSIX")
ocidFormatter's setDateFormat:(prefDateFormat as string)
set strDateAndTime to (ocidFormatter's stringFromDate:(current date)) as text
#####日付をファイル名にする
set strSaveFilePath to strDirPath & "/" & strDateAndTime & ".png"


################################################################
set strInputText to (strBaseUrlt & strText) as text
####テキストをNSString
set ocidInputString to objNSString's stringWithString:strInputText
################################################################
##全角を半角に変換して
set ocidInputStringHalfwidth to (ocidInputString's stringByApplyingTransform:(objMe's NSStringTransformFullwidthToHalfwidth) |reverse|:false)
##制御文字取り除き
set ocidwhitespaceAndNewlineCharacterSet to objMe's NSCharacterSet's whitespaceAndNewlineCharacterSet
set ocidInputString to ocidInputStringHalfwidth's stringByTrimmingCharactersInSet:ocidwhitespaceAndNewlineCharacterSet
##スペース取り除き
set ocidSearchString to objNSString's stringWithString:" "
set ocidReplacementString to objNSString's stringWithString:""
set ocidTrimmingText to ocidInputString's stringByReplacingOccurrencesOfString:ocidSearchString withString:ocidReplacementString
##ハイフン取り除き
set ocidSearchString to objNSString's stringWithString:"-"
set ocidTrimmingText to ocidTrimmingText's stringByReplacingOccurrencesOfString:ocidSearchString withString:ocidReplacementString
################################################################
####テキストをUTF8
set ocidUtf8InputString to ocidTrimmingText's dataUsingEncoding:(objMe's NSUTF8StringEncoding)
####CIQRCodeGenerator初期化
set ocidQRcodeImage to objMe's CIFilter's filterWithName:"CIQRCodeGenerator"
ocidQRcodeImage's setDefaults()
###テキスト設定
ocidQRcodeImage's setValue:ocidUtf8InputString forKey:"inputMessage"
###読み取り誤差値設定L, M, Q, H
ocidQRcodeImage's setValue:"Q" forKey:"inputCorrectionLevel"
###QRコード本体のイメージ
set ocidCIImage to ocidQRcodeImage's outputImage()
-->ここで生成されるのはQRのセルが1x1pxの最小サイズ
###QRコードの縦横取得
set ocidCIImageDimension to ocidCIImage's extent()
set ocidCIImageWidth to (item 1 of item 2 of ocidCIImageDimension) as integer
set ocidCIImageHight to (item 2 of item 2 of ocidCIImageDimension) as integer
###最終的に出力したいpxサイズ
set numScaleMax to 580
###整数で拡大しないとアレなのでの値のニアなサイズになります
set numWidth to ((numScaleMax / ocidCIImageWidth) div 1) as integer
set numHight to ((numScaleMax / ocidCIImageHight) div 1) as integer
###↑サイズの拡大縮小する場合はここで値を調整すれば良い
####変換スケール作成-->拡大
set recordScalse to objMe's CGAffineTransform's CGAffineTransformMakeScale(numWidth, numHight)
##変換スケールを適応(元のサイズに元のサイズのスケール適応しても意味ないけど
set ocidCIImageScaled to ocidCIImage's imageByApplyingTransform:recordScalse
#######元のセルが1x1pxの最小サイズで出したいときはここで処理
##set ocidCIImageScaled to ocidCIImage
###イメージデータを展開
set ocidNSCIImageRep to objMe's NSCIImageRep's imageRepWithCIImage:ocidCIImageScaled
###出力用のイメージの初期化
set ocidNSImageScaled to objMe's NSImage's alloc()'s initWithSize:(ocidNSCIImageRep's |size|())
###イメージデータを合成
ocidNSImageScaled's addRepresentation:ocidNSCIImageRep
###出来上がったデータはOS_dispatch_data
set ocidOsDispatchData to ocidNSImageScaled's TIFFRepresentation()
####NSBitmapImageRep
set ocidNSBitmapImageRep to objMe's NSBitmapImageRep's imageRepWithData:ocidOsDispatchData
#################################################################
###quiet zone用に画像をパディングする
set numPadWidth to ((ocidCIImageWidth * numWidth) + (numWidth * 6)) as integer
set numPadHight to ((ocidCIImageHight * numHight) + (numHight * 6)) as integer
###左右に4セル分づつ余白 quiet zoneを足す
####まずは元のQRコードのサイズに8セルサイズ分足したサイズの画像を作って
set ocidNSBitmapImagePadRep to (objMe's NSBitmapImageRep's alloc()'s initWithBitmapDataPlanes:(missing value) pixelsWide:numPadWidth pixelsHigh:numPadHight bitsPerSample:8 samplesPerPixel:4 hasAlpha:true isPlanar:false colorSpaceName:(objMe's NSCalibratedRGBColorSpace) bitmapFormat:(objMe's NSAlphaFirstBitmapFormat) bytesPerRow:0 bitsPerPixel:32)
###初期化
objMe's NSGraphicsContext's saveGraphicsState()
###ビットマップイメージ
(objMe's NSGraphicsContext's setCurrentContext:(objMe's NSGraphicsContext's graphicsContextWithBitmapImageRep:ocidNSBitmapImagePadRep))
###塗り色を『白』に指定して
objMe's NSColor's whiteColor()'s |set|()
###画像にする
objMe's NSRectFill({origin:{x:0, y:0}, |size|:{width:numPadWidth, height:numPadHight}})
###出来上がった画像にQRバーコードを左右3セル分ずらした位置にCompositeSourceOverする
ocidNSBitmapImageRep's drawInRect:{origin:{x:(numWidth * 3), y:(numHight * 3)}, |size|:{width:numPadWidth, Hight:numPadHight}} fromRect:{origin:{x:0, y:0}, |size|:{width:numPadWidth, height:numPadHight}} operation:(objMe's NSCompositeSourceOver) fraction:1.0 respectFlipped:true hints:(missing value)
####画像作成終了
objMe's NSGraphicsContext's restoreGraphicsState()

#################################################################
####JPEG用の圧縮プロパティ
##set ocidNSSingleEntryDictionary to objMe's NSDictionary's dictionaryWithObject:1 forKey:(objMe's NSImageCompressionFactor)
####PNG用の圧縮プロパティ
set ocidNSSingleEntryDictionary to objMe's NSDictionary's dictionaryWithObject:true forKey:(objMe's NSImageInterlaced)

#####出力イメージへ変換
set ocidNSInlineData to (ocidNSBitmapImagePadRep's representationUsingType:(objMe's NSBitmapImageFileTypePNG) |properties|:ocidNSSingleEntryDictionary)
(*
NSBitmapImageFileTypeJPEG
NSBitmapImageFileTypePNG
NSBitmapImageFileTypeGIF
NSBitmapImageFileTypeBMP
NSBitmapImageFileTypeTIFF
NSBitmapImageFileTypeJPEG2000
*)
######インラインデータをファイルに書き出し
set boolMakeQrCode to (ocidNSInlineData's writeToFile:strSaveFilePath atomically:true)

###################
###ここから出来上がったファイルについて
set aliasDirPath to POSIX file strDirPath as alias
###
tell application "Finder"
select aliasDirPath
end tell
###
tell application "Preview"
launch
activate
tell window 1
open (POSIX file strSaveFilePath as alias)
end tell
end tell

return true

|

[Map]位置情報をQRコードにする

macOSのMapアプリはApplescript対応していないので、System Eventsを使うのですが

20220430020817_1280x627x144_0
20220430020817_1280x557x144_0
状態によって
メニュー名が変わります
これに、気がつかなかった…トホホ



AppleScript サンプルコード

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

AppleScript サンプルソース(参考)
行番号ソース
001#!/usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003#
004#
005#com.cocolog-nifty.quicktimer.icefloe
006----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
007##自分環境がos12なので2.8にしているだけです
008use AppleScript version "2.8"
009use framework "Foundation"
010use framework "CoreImage"
011use scripting additions
012
013property objMe : a reference to current application
014property objNSString : a reference to objMe's NSString
015set objFileManager to objMe's NSFileManager's defaultManager()
016
017set theURL to ""
018set ocidNSInlineData to ""
019set ocidNSBitmapImagePadRep to ""
020
021
022###set strLogFile to "/tmp/Geo2Qr4.txt"
023
024tell application "System Events"
025  launch
026end tell
027(*
028tell application "System Events"
029  tell application process "Maps"
030    keystroke "C" using {command down}
031  end tell
032end tell
033
034tell application "System Events"
035  keystroke "c" using {command down}
036end tell
037*)
038try
039  tell application "System Events"
040    tell process "Maps"
041      get every menu bar
042      tell menu bar 1
043        get every menu bar item
044        tell menu bar item "編集"
045          get every menu bar item
046          tell menu "編集"
047            get every menu item
048            tell menu item "リンクをコピー"
049              click
050            end tell
051          end tell
052        end tell
053      end tell
054    end tell
055  end tell
056on error
057  tell application "System Events"
058    tell process "Maps"
059      get every menu bar
060      tell menu bar 1
061        get every menu bar item
062        tell menu bar item "編集"
063          get every menu bar item
064          tell menu "編集"
065            get every menu item
066            tell menu item "コピー"
067              click
068            end tell
069          end tell
070        end tell
071      end tell
072    end tell
073  end tell
074end try
075
076(*
077tell application "System Events"
078  tell process "Maps"
079    tell menu bar 1
080      tell menu bar item "Edit"
081        tell menu "Edit"
082          click menu item "Copy Link"
083        end tell
084      end tell
085    end tell
086  end tell
087end tell
088*)
089
090
091tell application "Finder"
092  set theURL to (the clipboard) as text
093end tell
094delay 0.5
095
096
097try
098  set objAns to (display alert "どちら用のQRコードを作成しますか?" message "iOS用AppleMapのQRコードを作成する OR 一般的なQRコードを作成する" default button 1 buttons {"AppleMap用", "GoogleMap用", "汎用"})
099on error
100  log "エラーしました"
101  return
102end try
103
104
105set objResponse to (button returned of objAns) as text
106
107set theURL to theURL as text
108
109
110###
111###do shell script "echo \"" & theURL & "\" >> " & strLogFile & ""
112####
113
114#########################
115####URLの整形
116set AppleScript's text item delimiters to "ll="
117set listUrl to every text item of theURL as list
118set AppleScript's text item delimiters to ""
119
120set strSubURL to text item 2 of listUrl as text
121
122set AppleScript's text item delimiters to "&"
123set listSubURL to every text item of strSubURL as list
124set AppleScript's text item delimiters to ""
125
126set strLL to text item 1 of listSubURL as text
127
128set AppleScript's text item delimiters to ","
129set listLL to every text item of strLL as list
130set AppleScript's text item delimiters to ""
131
132set theLatitude to (item 1 of listLL) as text
133set theLongitude to (item 2 of listLL) as text
134
135
136####################################################
137
138set strFileName to ("" & theLatitude & "-" & theLongitude & ".png")
139#####################################################
140if objResponse is "AppleMap用" then
141  set theChl to ("GEO:" & theLatitude & "," & theLongitude & "") as text
142  log theChl
143else if objResponse is "GoogleMap用" then
144  
145  ###GoogleMap用の小数点以下の桁揃え
146
147  (*  *)
148  set AppleScript's text item delimiters to "."
149  set listLatitude to every text item of theLatitude as list
150  set AppleScript's text item delimiters to ""
151  set strLatitudeInt to text item 1 of listLatitude as text
152  set strLatitudeDecimal to text item 2 of listLatitude as text
153  set strLatitudeDecimal to (text 1 through 7 of (strLatitudeDecimal & "000000000")) as text
154  set theLatitude to ("" & strLatitudeInt & "." & strLatitudeDecimal & "")
155  
156  set AppleScript's text item delimiters to "."
157  set listLongitude to every text item of theLongitude as list
158  set AppleScript's text item delimiters to ""
159  set strLongitudeInt to text item 1 of listLongitude as text
160  set strLongitudeDecimal to text item 2 of listLongitude as text
161  set strLongitudeDecimal to (text 1 through 7 of (strLongitudeDecimal & "000000000")) as text
162  set theLongitude to ("" & strLongitudeInt & "." & strLongitudeDecimal & "")
163  
164  set theGooglemapParts to ("@" & theLatitude & "," & theLongitude & ",16z")
165  
166  set theChl to ("https://www.google.com/maps/" & theGooglemapParts & "") as text
167else
168  set theChl to ("http://maps.apple.com/?q=" & theLatitude & "," & theLongitude & "") as text
169end if
170#######################
171
172
173###フォルダのパス
174###ピクチャーフォルダのパス
175tell application "Finder"
176  set aliasDirPath to (path to pictures folder from user domain) as alias
177  set strDirPath to POSIX path of aliasDirPath as text
178end tell
179####フォルダ名
180set strFolderName to "QRcode" as text
181set strDirPath to ("" & strDirPath & strFolderName & "") as text
182###NSStringテキスト
183set ocidDirPath to objNSString's stringWithString:strDirPath
184###フォルダを作る
185###途中のフォルダも作る-->true
186set boolMakeNewFolder to (objFileManager's createDirectoryAtPath:ocidDirPath withIntermediateDirectories:true attributes:(missing value) |error| :(missing value))
187
188####ファイルパス
189set strSaveFilePath to ("" & strDirPath & "/" & strFileName & "") as text
190
191
192################################################################
193set strInputText to theChl as text
194####テキストをNSStringに
195set ocidInputString to objNSString's stringWithString:strInputText
196####テキストをUTF8に
197set ocidUtf8InputString to ocidInputString's dataUsingEncoding:(objMe's NSUTF8StringEncoding)
198####CIQRCodeGenerator初期化
199set ocidQRcodeImage to objMe's CIFilter's filterWithName:"CIQRCodeGenerator"
200ocidQRcodeImage's setDefaults()
201###テキスト設定
202ocidQRcodeImage's setValue:ocidUtf8InputString forKey:"inputMessage"
203###読み取り誤差値設定L, M, Q, H
204ocidQRcodeImage's setValue:"Q" forKey:"inputCorrectionLevel"
205###QRコード本体のイメージ
206set ocidCIImage to ocidQRcodeImage's outputImage()
207-->ここで生成されるのはQRのセルが1x1pxの最小サイズ
208###QRコードの縦横取得
209set ocidCIImageDimension to ocidCIImage's extent()
210set ocidCIImageWidth to (item 1 of item 2 of ocidCIImageDimension) as integer
211set ocidCIImageHight to (item 2 of item 2 of ocidCIImageDimension) as integer
212###最終的に出力したいpxサイズ
213set numScaleMax to 720
214###整数で拡大しないとアレなので↑の値のニアなサイズになります
215set numWidth to ((numScaleMax / ocidCIImageWidth) div 1) as integer
216set numHight to ((numScaleMax / ocidCIImageHight) div 1) as integer
217###↑サイズの拡大縮小する場合はここで値を調整すれば良い
218####変換スケール作成-->拡大
219set recordScalse to objMe's CGAffineTransform's CGAffineTransformMakeScale(numWidth, numHight)
220##変換スケールを適応(元のサイズに元のサイズのスケール適応しても意味ないけど
221set ocidCIImageScaled to ocidCIImage's imageByApplyingTransform:recordScalse
222#######元のセルが1x1pxの最小サイズで出したいときはここで処理
223##set ocidCIImageScaled to ocidCIImage
224###イメージデータを展開
225set ocidNSCIImageRep to objMe's NSCIImageRep's imageRepWithCIImage:ocidCIImageScaled
226###出力用のイメージの初期化
227set ocidNSImageScaled to objMe's NSImage's alloc()'s initWithSize:(ocidNSCIImageRep's |size|())
228###イメージデータを合成
229ocidNSImageScaled's addRepresentation:ocidNSCIImageRep
230###出来上がったデータはOS_dispatch_data
231set ocidOsDispatchData to ocidNSImageScaled's TIFFRepresentation()
232####NSBitmapImageRepに
233set ocidNSBitmapImageRep to objMe's NSBitmapImageRep's imageRepWithData:ocidOsDispatchData
234#################################################################
235###quiet zone用に画像をパディングする
236set numPadWidth to ((ocidCIImageWidth * numWidth) + (numWidth * 6)) as integer
237set numPadHight to ((ocidCIImageHight * numHight) + (numHight * 6)) as integer
238###左右に3セル分づつ余白 quiet zoneを足す
239####まずは元のQRコードのサイズに6セルサイズ分足したサイズの画像を作って
240set ocidNSBitmapImagePadRep to (objMe's NSBitmapImageRep's alloc()'s initWithBitmapDataPlanes:(missing value) pixelsWide:numPadWidth pixelsHigh:numPadHight bitsPerSample:8 samplesPerPixel:4 hasAlpha:true isPlanar:false colorSpaceName:(objMe's NSCalibratedRGBColorSpace) bitmapFormat:(objMe's NSAlphaFirstBitmapFormat) bytesPerRow:0 bitsPerPixel:32)
241###初期化
242objMe's NSGraphicsContext's saveGraphicsState()
243###ビットマップイメージ
244(objMe's NSGraphicsContext's setCurrentContext:(objMe's NSGraphicsContext's graphicsContextWithBitmapImageRep:ocidNSBitmapImagePadRep))
245###塗り色を『白』に指定して
246objMe's NSColor's whiteColor()'s |set|()
247##画像にする
248objMe's NSRectFill({origin:{x:0, y:0}, |size|:{width:numPadWidth, height:numPadHight}})
249###出来上がった画像にQRバーコードを左右3セル分ずらした位置にCompositeSourceOverする
250ocidNSBitmapImageRep's drawInRect:{origin:{x:(numWidth * 3), y:(numHight * 3)}, |size|:{width:numPadWidth, Hight:numPadHight}} fromRect:{origin:{x:0, y:0}, |size|:{width:numPadWidth, height:numPadHight}} operation:(objMe's NSCompositeSourceOver) fraction:1.0 respectFlipped:true hints:(missing value)
251####画像作成終了
252objMe's NSGraphicsContext's restoreGraphicsState()
253
254#################################################################
255
256####JPEG用の圧縮プロパティ
257##set ocidNSSingleEntryDictionary to objMe's NSDictionary's dictionaryWithObject:1 forKey:(objMe's NSImageCompressionFactor)
258####PNG用の圧縮プロパティ
259set ocidNSSingleEntryDictionary to objMe's NSDictionary's dictionaryWithObject:true forKey:(objMe's NSImageInterlaced)
260
261#####出力イメージへ変換
262set ocidNSInlineData to (ocidNSBitmapImagePadRep's representationUsingType:(objMe's NSBitmapImageFileTypePNG) |properties|:ocidNSSingleEntryDictionary)
263
264######インラインデータをファイルに書き出し
265set boolMakeQrCode to (ocidNSInlineData's writeToFile:strSaveFilePath atomically:true)
266
267set aliasDirPath to POSIX file strDirPath as alias
268###保存場所を開いて
269tell application "Finder"
270  select aliasDirPath
271end tell
272####プレビューに表示
273tell application "Preview"
274  launch
275  activate
276  open aliasDirPath
277end tell
278
279
280set theURL to ""
281set the clipboard to theURL
282set ocidNSInlineData to ""
283set ocidNSBitmapImagePadRep to ""
284return true
285
286
287to doReplace(theText, orgStr, newStr)
288  set oldDelim to AppleScript's text item delimiters
289  set AppleScript's text item delimiters to orgStr
290  set tmpList to every text item of theText
291  set AppleScript's text item delimiters to newStr
292  set tmpStr to tmpList as text
293  set AppleScript's text item delimiters to oldDelim
294  return tmpStr
295end doReplace
AppleScriptで生成しました

|

[Chrome]地図用のQRコードを生成する

AppleのURLに誤りがあったので修正
https://developer.apple.com/library/archive/featuredarticles/iPhoneURLScheme_Reference/MapLinks/MapLinks.html


(*


Chromeで開いているページのQRを作成します。
たぶんiOS専用 

20190706 初回作成
20210429 URLを修正

APIの仕様は
https://developers.google.com/chart/infographics/docs/qr_codes


*)

tell application "Google Chrome"
activate
tell window 1
tell active tab
set theURL to URL as text
end tell
end tell
end tell

tell application "Finder"
activate
set objAns to ¬
display alert ¬
"どちら用のQRコードを作成しますか?" message ¬
"iOSAppleMapQRコードを作成する OR 一般的なQRコードを作成する" default button 1 ¬
buttons {"AppleMap", "GoogleMap", "汎用"}
end tell


set AppleScript's text item delimiters to {"/"}
set listUrl to every text item of theURL as list
set numCntUrl to (count of listUrl) as number
set numSepUrl to 1 as number
set AppleScript's text item delimiters to {""}
log numCntUrl

repeat numCntUrl times
set theSepUrl to (item numSepUrl of listUrl) as text
try
set theUrlParts to (the character 1 of theSepUrl)
on error
set theUrlParts to " "
end try


if theUrlParts is "@" then
set theGooglemapParts to theSepUrl
set theSepUrl to doReplace(theSepUrl, "@", "")
set AppleScript's text item delimiters to {","}
set listSepUrl to every text item of theSepUrl as list

set theLatitude to (item 1 of listSepUrl) as text
set theLongitude to (item 2 of listSepUrl) as text

set AppleScript's text item delimiters to {""}
end if
set numSepUrl to numSepUrl + 1 as number
end repeat





if (button returned of objAns) is "AppleMap" then

set theChl to ("GEO:" & theLatitude & "," & theLongitude & "") as text
log theChl
else if (button returned of objAns) is "GoogleMap" then
set theChl to ("https://www.google.com/maps/" & theGooglemapParts & "") as text
else
set theChl to ("http://maps.apple.com/?ll=" & theLatitude & "," & theLongitude & "") as text

end if


--API各項目
--BASE URL
set theApiUrl to "https://chart.googleapis.com/chart?" as text

set theCht to "qr" as text

set theChs to "540x540" as text

set theChoe to "UTF-8" as text

---L M Q R
set theChld to "Q" as text

--URLを整形
set theOpenUrl to ("" & theApiUrl & "&cht=" & theCht & "&chs=" & theChs & "&choe=" & theChoe & "&chld=" & theChld & "&chl=" & theChl & "") as text


-----Chromeで開く
tell application "Google Chrome"
activate
tell window 1
set active tab index to 1
make new tab
tell active tab
set URL to theOpenUrl
end tell
end tell
end tell







to doReplace(theText, orgStr, newStr)
set oldDelim to AppleScript's text item delimiters
set AppleScript's text item delimiters to orgStr
set tmpList to every text item of theText
set AppleScript's text item delimiters to newStr
set tmpStr to tmpList as text
set AppleScript's text item delimiters to oldDelim
return tmpStr
end doReplace

|

[AppleScript]セルサイズが1pxのQRコードを作る

QRバーコードを作ります
セルサイズ『黒い塗りの1単位』が1pxのバーコードを作成します
--->この1pxバーコードを整数倍する事で『アンチエイリアス』の無い規格通りのバーコードができます。
PhotoShop等で拡大する場合は『ニアレストネイバー』で拡大すれば、アンチエイリアス立ちません。
最近の高画質環境では小さな事になりましたが
やっぱり、プロなんだし。ねっ
と、偉そうに…いったものの
最初から1pxなんだよね…出来上がりが。

ダウンロード - qrsell1px.scpt.zip



#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
#
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
##自分環境がos12なので2.8にしているだけです
use AppleScript version "2.8"
use framework "Foundation"
use framework "CoreImage"
use scripting additions

property objMe : a reference to current application
property objNSString : a reference to objMe's NSString
set objFileManager to objMe's NSFileManager's defaultManager()

set strText to "https://apps.apple.com/jp/developer/adobe-inc/id331646274?see-all=i-phonei-pad-apps"


###フォルダのパス
###ピクチャーフォルダのパス
set aliasDirPath to (path to pictures folder from user domain) as alias
set strDirPath to POSIX path of aliasDirPath as text
####フォルダ名
set strFolderName to "QRcode" as text
set strDirPath to ("" & strDirPath & strFolderName & "") as text
###NSStringテキスト
set ocidDirPath to objNSString's stringWithString:strDirPath
###フォルダを作る
###途中のフォルダも作る-->true
set boolMakeNewFolder to (objFileManager's createDirectoryAtPath:ocidDirPath withIntermediateDirectories:true attributes:(missing value) |error|:(missing value))

####日付フォーマット
set prefDateFormat to "yyyyMMddHHmmss"
set ocidFormatter to objMe's NSDateFormatter's alloc()'s init()
ocidFormatter's setLocale:(objMe's NSLocale's localeWithLocaleIdentifier:"ja_JP_POSIX")
ocidFormatter's setDateFormat:(prefDateFormat as string)
set strDateAndTime to (ocidFormatter's stringFromDate:(current date)) as text
#####日付をファイル名にする
set strSaveFilePath to strDirPath & "/" & strDateAndTime & ".png"

########################################################
set strInputText to strText as text
####テキストをNSString
set ocidInputString to objNSString's stringWithString:strInputText
####テキストをUTF8
set ocidUtf8InputString to ocidInputString's dataUsingEncoding:(objMe's NSUTF8StringEncoding)
####CIQRCodeGenerator初期化
set ocidQRcodeImage to objMe's CIFilter's filterWithName:"CIQRCodeGenerator"
ocidQRcodeImage's setDefaults()
###テキスト設定
ocidQRcodeImage's setValue:ocidUtf8InputString forKey:"inputMessage"
###読み取り誤差値設定L, M, Q, H
ocidQRcodeImage's setValue:"Q" forKey:"inputCorrectionLevel"
###QRコード本体のイメージ
set ocidCIImage to ocidQRcodeImage's outputImage()
-->ここで生成されるのはQRのセルが1x1pxの最小サイズ
###QRコードの縦横取得
set ocidCIImageDimension to ocidCIImage's extent()
set ocidCIImageWidth to (item 1 of item 2 of ocidCIImageDimension) as integer
set ocidCIImageHight to (item 2 of item 2 of ocidCIImageDimension) as integer
###最終的に出力したいpxサイズ
set numScaleMax to 580
###整数で拡大しないとアレなのでの値のニアなサイズになります
set numWidth to ((numScaleMax / ocidCIImageWidth) div 1) as integer
set numHight to ((numScaleMax / ocidCIImageHight) div 1) as integer
####
set ocidCIImageScaled to ocidCIImage
###イメージデータを展開
set ocidNSCIImageRep to objMe's NSCIImageRep's imageRepWithCIImage:ocidCIImageScaled
###出力用のイメージの初期化
set ocidNSImageScaled to objMe's NSImage's alloc()'s initWithSize:(ocidNSCIImageRep's |size|())
###イメージデータを合成
ocidNSImageScaled's addRepresentation:ocidNSCIImageRep
###出来上がったデータはOS_dispatch_data
set ocidOsDispatchData to ocidNSImageScaled's TIFFRepresentation()
####NSBitmapImageRep
set ocidNSBitmapImageRep to objMe's NSBitmapImageRep's imageRepWithData:ocidOsDispatchData
###################################################
###パディング3ピクセル
set numPadWidth to ((ocidCIImageWidth) + 6) as integer
set numPadHight to ((ocidCIImageHight) + 6) as integer
###左右に3pxづつ余白 quiet zoneを足す
####まずは元のQRコードのサイズに6px足したサイズの画像を作って
set ocidNSBitmapImagePadRep to (objMe's NSBitmapImageRep's alloc()'s initWithBitmapDataPlanes:(missing value) pixelsWide:numPadWidth pixelsHigh:numPadHight bitsPerSample:8 samplesPerPixel:4 hasAlpha:true isPlanar:false colorSpaceName:(objMe's NSCalibratedRGBColorSpace) bitmapFormat:(objMe's NSAlphaFirstBitmapFormat) bytesPerRow:0 bitsPerPixel:32)
###初期化
objMe's NSGraphicsContext's saveGraphicsState()
###ビットマップイメージ
(objMe's NSGraphicsContext's setCurrentContext:(objMe's NSGraphicsContext's graphicsContextWithBitmapImageRep:ocidNSBitmapImagePadRep))
###塗り色を『白』に指定して
objMe's NSColor's whiteColor()'s |set|()
##画像にする
objMe's NSRectFill({origin:{x:0, y:0}, |size|:{width:numPadWidth, height:numPadHight}})
###出来上がった画像にQRバーコードを左右3pxずらした位置にCompositeSourceOverする
ocidNSBitmapImageRep's drawInRect:{origin:{x:3, y:3}, |size|:{width:numPadWidth, Hight:numPadHight}} fromRect:{origin:{x:0, y:0}, |size|:{width:numPadWidth, height:numPadHight}} operation:(objMe's NSCompositeSourceOver) fraction:1.0 respectFlipped:true hints:(missing value)
####画像作成終了
objMe's NSGraphicsContext's restoreGraphicsState()
###################################################
####PNG用の圧縮プロパティ
set ocidNSSingleEntryDictionary to objMe's NSDictionary's dictionaryWithObject:true forKey:(objMe's NSImageInterlaced)
####
set ocidNSInlineData to (ocidNSBitmapImagePadRep's representationUsingType:(objMe's NSBitmapImageFileTypePNG) |properties|:ocidNSSingleEntryDictionary)
#####出力イメージへ変換
#####set ocidNSInlineData to (ocidNSBitmapImagePadRep's representationUsingType:(objMe's NSBitmapImageFileTypePNG) |properties|:ocidNSSingleEntryDictionary)
(*
NSBitmapImageFileTypeJPEG
NSBitmapImageFileTypePNG
NSBitmapImageFileTypeGIF
NSBitmapImageFileTypeBMP
NSBitmapImageFileTypeTIFF
NSBitmapImageFileTypeJPEG2000
*)
######インラインデータをファイルに書き出し
set boolMakeQrCode to (ocidNSInlineData's writeToFile:strSaveFilePath atomically:true)


set aliasDirPath to POSIX file strDirPath as alias

tell application "Finder"

select aliasDirPath
activate
end tell

boolMakeQrCode

|

[BarCode]tec-it

https://barcode.tec-it.com/
20220203-132414

|

Decode a 1D or 2D barcode

ZXing Decoder Online
https://zxing.org/w/decode.jspx

ダウンロード - qrdecode.html

|

その他のカテゴリー

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