AppleScript AppStore

[AppStore]アップデートページを開く


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

#!/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 "UniformTypeIdentifiers"
use framework "AppKit"
use scripting additions

property refMe : a reference to current application

set strBundleID to ("com.apple.AppStore") as text
###オープンするURL
set ocidURLComponents to refMe's NSURLComponents's alloc()'s init()
ocidURLComponents's setScheme:("macappstore")
ocidURLComponents's setHost:("showUpdatesPage")
ocidURLComponents's setPath:("")
set ocidURL to (ocidURLComponents's |URL|())
set strURL to ocidURL's absoluteString() as text
log strURL
-->(*macappstore://showUpdatesPage*)
###起動
tell application id strBundleID to launch
###起動待ち 最大10秒
repeat 10 times
  tell application id strBundleID to activate
  tell application id strBundleID
    set boolFrontMost to frontmost as boolean
  end tell
  if boolFrontMost = false then
    delay 0.5
  else
    exit repeat
  end if
end repeat
###URLを開く
tell application id strBundleID
  open location strURL
end tell




|

[AppStore]ストーリーページを開く


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

#!/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 "UniformTypeIdentifiers"
use framework "AppKit"
use scripting additions

property refMe : a reference to current application


set strBundleID to ("com.apple.AppStore") as text
###オープンするURL
set ocidURLComponents to refMe's NSURLComponents's alloc()'s init()
ocidURLComponents's setScheme:("macappstore")
ocidURLComponents's setHost:("showPurchasesPage")
ocidURLComponents's setPath:("")
set ocidURL to (ocidURLComponents's |URL|())
set strURL to ocidURL's absoluteString() as text
log strURL
-->(*macappstore://showPurchasesPage*)
###起動
tell application id strBundleID to launch
###起動待ち 最大10秒
repeat 10 times
  tell application id strBundleID to activate
  tell application id strBundleID
    set boolFrontMost to frontmost as boolean
  end tell
  if boolFrontMost = false then
    delay 0.5
  else
    exit repeat
  end if
end repeat
###URLを開く
tell application id strBundleID
  open location strURL
end tell




|

[AppStore]アカウントページを開く


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

#!/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 "UniformTypeIdentifiers"
use framework "AppKit"
use scripting additions

property refMe : a reference to current application


set strBundleID to ("com.apple.AppStore") as text
###オープンするURL
set ocidURLComponents to refMe's NSURLComponents's alloc()'s init()
ocidURLComponents's setScheme:("macappstore")
ocidURLComponents's setHost:("showPurchasesPage")
ocidURLComponents's setPath:("")
set ocidURL to (ocidURLComponents's |URL|())
set strURL to ocidURL's absoluteString() as text
log strURL
-->(*macappstore://showPurchasesPage*)
###起動
tell application id strBundleID to launch
###起動待ち 最大10秒
repeat 10 times
  tell application id strBundleID to activate
  tell application id strBundleID
    set boolFrontMost to frontmost as boolean
  end tell
  if boolFrontMost = false then
    delay 0.5
  else
    exit repeat
  end if
end repeat
###URLを開く
tell application id strBundleID
  open location strURL
end tell




|

[AppStore]ストアトップページを開く


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

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
(*
itunes.apple.comのlookupについてはこちらを
https://quicktimer.cocolog-nifty.com/icefloe/2023/08/post-623246.html
*)
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use framework "UniformTypeIdentifiers"
use framework "AppKit"
use scripting additions

property refMe : a reference to current application
####設定項目


set strBundleID to ("com.apple.AppStore") as text
###オープンするURL
set ocidURLComponents to refMe's NSURLComponents's alloc()'s init()
ocidURLComponents's setScheme:("macappstore")
ocidURLComponents's setHost:("itunes.apple.com")
set ocidURL to (ocidURLComponents's |URL|())
set strURL to ocidURL's absoluteString() as text
log strURL
-->(*macappstore://itunes.apple.com*)
###起動
tell application id strBundleID to launch
###起動待ち 最大10秒
repeat 10 times
  tell application id strBundleID to activate
  tell application id strBundleID
    set boolFrontMost to frontmost as boolean
  end tell
  if boolFrontMost = false then
    delay 0.5
  else
    exit repeat
  end if
end repeat
###URLを開く
tell application id strBundleID
  open location strURL
end tell




|

[AppStore]アーティスト・デベロッパーページを開く


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

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
(*
itunes.apple.comのlookupについてはこちらを
https://quicktimer.cocolog-nifty.com/icefloe/2023/08/post-623246.html
*)
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use framework "UniformTypeIdentifiers"
use framework "AppKit"
use scripting additions

property refMe : a reference to current application
####設定項目
set strAppID to ("id1219074513") as text


set strBundleID to ("com.apple.AppStore") as text
###オープンするURL
set ocidURLComponents to refMe's NSURLComponents's alloc()'s init()
ocidURLComponents's setScheme:("macappstore")
ocidURLComponents's setHost:("itunes.apple.com")
set strPath to ("/artist/" & strAppID) as text
ocidURLComponents's setPath:(strPath)
set ocidURL to (ocidURLComponents's |URL|())
set strURL to ocidURL's absoluteString() as text
log strURL
-->(*macappstore://itunes.apple.com/artist/id1219074513*)
###起動
tell application id strBundleID to launch
###起動待ち 最大10秒
repeat 10 times
  tell application id strBundleID to activate
  tell application id strBundleID
    set boolFrontMost to frontmost as boolean
  end tell
  if boolFrontMost = false then
    delay 0.5
  else
    exit repeat
  end if
end repeat
###URLを開く
tell application id strBundleID
  open location strURL
end tell




|

[AppStore]IDからWEBページを開く


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

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
(*
itunes.apple.comのlookupについてはこちらを
https://quicktimer.cocolog-nifty.com/icefloe/2023/08/post-623246.html
サンプル
trackName: Linearity Curve Graphic Design
trackId: 1219074514
bundleId: com.linearity.vn
version: 5.0.2
artistId: 1219074513
artistName: Linearity GmbH
macappstores://itunes.apple.com/app/id1219074514
https://apps.apple.com/app/apple-store/id1219074514

https://developer.apple.com/library/archive/qa/qa1633/_index.html
*)
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use framework "UniformTypeIdentifiers"
use framework "AppKit"
use scripting additions

property refMe : a reference to current application

set strTrackId to ("1219074514") as text

###オープンするURL
set ocidURLComponents to refMe's NSURLComponents's alloc()'s init()
ocidURLComponents's setScheme:("https")
ocidURLComponents's setHost:("apps.apple.com")
##英語の場合は
##ocidURLComponents's setPath:("/app/id" & strTrackId")
##日本語の場合
##ocidURLComponents's setPath:("/jp/app/apple-store/id" & strTrackId")
ocidURLComponents's setPath:("/jp/app/id" & strTrackId)

###
set ocidQueryItemMT to refMe's NSURLQueryItem's alloc()'s initWithName:("mt") value:("12")
(*
1 Music
2 Podcasts
3 Audiobooks
4 TV Shows
5 Music Videos
6 Movies
7 iPod Games
8 Mobile Software Applications
9 Ringtones
10 iTunes U
11 E-Books
12 Desktop Apps
*)
##AppStoreを起動させない 1で起動
set ocidQueryItemLS to refMe's NSURLQueryItem's alloc()'s initWithName:("ls") value:("0")
ocidURLComponents's setQueryItems:({ocidQueryItemMT, ocidQueryItemLS})
##ocidURLComponents's setQuery:("mt=12&ls=0")
##
set ocidURL to (ocidURLComponents's |URL|())
set strURL to ocidURL's absoluteString() as text
log strURL
-->(*macappstore://showUpdatesPage*)

###起動 Finder-->デフォルトのブラウザで
set strBundleID to ("com.apple.finder") as text
tell application id strBundleID to launch
###起動待ち 最大10秒
repeat 10 times
  tell application id strBundleID to activate
  tell application id strBundleID
    set boolFrontMost to frontmost as boolean
  end tell
  if boolFrontMost = false then
    delay 0.5
  else
    exit repeat
  end if
end repeat
###URLを開く
tell application id strBundleID
  open location strURL
end tell




|

[AppStore]アプリケーションページを開く


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

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
(*
itunes.apple.comのlookupについてはこちらを
https://quicktimer.cocolog-nifty.com/icefloe/2023/08/post-623246.html
スキームは4種類
macappstore://itunes.apple.com/app/id1219074514
macappstores://itunes.apple.com/app/id1219074514
itms-appss://itunes.apple.com/app/id1219074514
itms-apps://itunes.apple.com/app/id1219074514
*)
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use framework "UniformTypeIdentifiers"
use framework "AppKit"
use scripting additions

property refMe : a reference to current application
####設定項目
set strAppID to ("id1219074514") as text

set strBundleID to ("com.apple.AppStore") as text
###オープンするURL
set ocidURLComponents to refMe's NSURLComponents's alloc()'s init()
ocidURLComponents's setScheme:("macappstore")
ocidURLComponents's setHost:("itunes.apple.com")
set strPath to ("/app/" & strAppID) as text
ocidURLComponents's setPath:(strPath)
set ocidURL to (ocidURLComponents's |URL|())
set strURL to ocidURL's absoluteString() as text
log strURL
-->(*macappstore://itunes.apple.com/app/id1219074514*)
###起動
tell application id strBundleID to launch
###起動待ち 最大10秒
repeat 10 times
  tell application id strBundleID to activate
  tell application id strBundleID
    set boolFrontMost to frontmost as boolean
  end tell
  if boolFrontMost = false then
    delay 0.5
  else
    exit repeat
  end if
end repeat
###URLを開く
tell application id strBundleID
  open location strURL
end tell




|

[JSON]App Store Lookupデータから各種情報を取得する


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

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
# https://apps.apple.com/us/genre/ios/id36
(*
SafariでWEBページ表示中のアプリケーションのID情報を
lookup JSONから取得します

*)
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use framework "UniformTypeIdentifiers"
use framework "AppKit"
use scripting additions

property refMe : a reference to current application
set strBundleID to "com.apple.Safari" as text
################################
tell application "Safari"
  set numCntWindow to (count of every window) as integer
  if numCntWindow = 0 then
return "ウィンドウがありません"
  end if
end tell

###サファリの最前面のURL
tell application "Safari"
  set numID to id of front window
  set objTab to current tab of window id numID
  tell window id numID
    tell objTab
      set strURL to URL
    end tell
  end tell
end tell
################################
set strURL to strURL as text
set ocidURLString to refMe's NSString's stringWithString:(strURL)
set ocidURL to refMe's NSURL's alloc()'s initWithString:(ocidURLString)
###
set strHostName to ocidURL's |host|() as text
if strHostName is not "apps.apple.com" then
  set strOpenURL to "https://apps.apple.com/us/genre/ios/id36"
  tell application "Safari"
    open location strOpenURL
  end tell
return "ID取得出来ません"
end if
###ラストパス から デベロッパIDを取得する
set strLastPath to (ocidURL's lastPathComponent()) as text
set ocidLastPath to refMe's NSString's stringWithString:(strLastPath)
set ocidID to ocidLastPath's stringByReplacingOccurrencesOfString:("id") withString:("")
set strIDno to ocidID as text

###データ取得用のURLに整形
set strLookupURL to ("https://itunes.apple.com/lookup?id=" & strIDno & "") as text
set ocidLookup to refMe's NSString's stringWithString:(strLookupURL)
set ocidLookupURL to refMe's NSURL's alloc()'s initWithString:(ocidLookup)
log ocidLookupURL's absoluteString() as text
####JSON
set listReadData to refMe's NSData's alloc()'s initWithContentsOfURL:(ocidLookupURL) options:(refMe's NSDataReadingMappedIfSafe) |error|:(reference)
set coidReadData to item 1 of listReadData
###NSJSONSerialization
set listJSONSerialization to (refMe's NSJSONSerialization's JSONObjectWithData:(coidReadData) options:(refMe's NSJSONReadingMutableContainers) |error|:(reference))
set ocidJsonData to item 1 of listJSONSerialization
###
set ocidJsonDict to refMe's NSDictionary's alloc()'s initWithDictionary:(ocidJsonData)
set ocidResultsArray to ocidJsonDict's valueForKey:("results")
set ocidResultsDict to ocidResultsArray's firstObject()
## set listKeys to ocidResultsDict's allKeys()
set listKeys to {"primaryGenreName", "artworkUrl100", "currency", "sellerUrl", "artworkUrl512", "ipadScreenshotUrls", "fileSizeBytes", "genres", "languageCodesISO2A", "artworkUrl60", "supportedDevices", "trackViewUrl", "description", "bundleId", "version", "artistViewUrl", "userRatingCountForCurrentVersion", "isGameCenterEnabled", "appletvScreenshotUrls", "genreIds", "averageUserRatingForCurrentVersion", "releaseDate", "trackId", "wrapperType", "minimumOsVersion", "formattedPrice", "primaryGenreId", "currentVersionReleaseDate", "userRatingCount", "artistId", "trackContentRating", "artistName", "price", "trackCensoredName", "trackName", "kind", "features", "contentAdvisoryRating", "screenshotUrls", "releaseNotes", "isVppDeviceBasedLicensingEnabled", "sellerName", "averageUserRating", "advisories"} as list

repeat with itemKey in listKeys
  log (ocidResultsDict's valueForKey:(itemKey))
end repeat
set strTrackIName to (ocidResultsDict's valueForKey:("trackName")) as text
set strTrackId to (ocidResultsDict's valueForKey:("trackId")) as text
set strBundleID to (ocidResultsDict's valueForKey:("bundleId")) as text
set strVersion to (ocidResultsDict's valueForKey:("version")) as text
set strArtistId to (ocidResultsDict's valueForKey:("artistId")) as text
set strArtistName to (ocidResultsDict's valueForKey:("artistName")) as text

set strDefaultAnser to ("trackName: " & strTrackIName & "\r") as text
set strDefaultAnser to strDefaultAnser & ("trackId: " & strTrackId & "\r") as text
set strDefaultAnser to strDefaultAnser & ("bundleId: " & strBundleID & "\r") as text
set strDefaultAnser to strDefaultAnser & ("version: " & strVersion & "\r") as text
set strDefaultAnser to strDefaultAnser & ("artistId: " & strArtistId & "\r") as text
set strDefaultAnser to strDefaultAnser & ("artistName: " & strArtistName & "\r") as text


###ダイアログを出して
set aliasIconPath to POSIX file "/System/Applications/App Store.app/Contents/Resources/AppIcon.icns" as alias
set theResponse to 2 as number
try
  set recordResult to (display dialog "アプリ情報" with title "詳細情報" default answer strDefaultAnser 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 recordResult) then
return "時間切れですやりなおしてください"
end if
if "OK" is equal to (button returned of recordResult) then
  set strResponse to (text returned of recordResult) as text
end if


###クリップボードコピー
if button returned of recordResult is "クリップボードにコピー" then
  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)
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