20260614

AS記法 WEBページ作成 フォルダ指定

AS記法 WEBページ作成 フォルダ指定

NOTE記事一覧ですnote.com

【Safari・FireFox用Script Editorで開く】 |

AS BuildWebPage.applescript.scpt
ソース
001#!/usr/bin/env osascript
002#coding: utf-8
003----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
004(*
005
006WEBページ作成
007フォルダ選択して中にある画像ファイルで処理
008
009com.cocolog-nifty.quicktimer.icefloe *)
010----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
011use AppleScript version "2.8"
012use scripting additions
013
014property refMe : a reference to current application
015
016set strBundleID to ("com.apple.BuildWebPage") as text
017
018############
019set aliasDefaultLocation to (path to desktop folder from user domain) as alias
020set strMes to "画像が入っているフォルダを選んでください" as text
021set strPrompt to "画像が入っているフォルダを選んでください" as text
022try
023   tell application "Finder"
024      tell application "SystemUIServer"
025         activate
026         set listAliasFolderPath to (choose folder strMes with prompt strPrompt default location aliasDefaultLocation with multiple selections allowed without invisibles and showing package contents)
027      end tell
028   end tell
029on error
030   log "エラーしました"
031   return "エラーしました"
032end try
033
034
035tell application id strBundleID to launch
036tell application id strBundleID to activate
037
038
039repeat with objAliasFolderPath in listAliasFolderPath
040   set aliasFolderPath to objAliasFolderPath as alias
041   
042   tell application id strBundleID to open aliasFolderPath
043   
044end repeat
045
046###保存先を開く
047delay 3
048set aliasPicturesDir to (path to pictures folder from user domain) as alias
049tell application "Finder"
050   tell folder aliasPicturesDir
051      set listAliasDirPath to (every folder) as alias list
052   end tell
053end tell
054
055tell application "Finder"
056   set listAliasDirPathSorted to (sort of listAliasDirPath by creation date) as alias list
057end tell
058
059set aliasNewDir to (last item of listAliasDirPathSorted) as alias
060
061tell application "Finder"
062   open location aliasNewDir
063end tell
064
065tell application "Finder" to activate
066
067
068return true
AppleScriptで生成しました