[LETS]FontWorksのLETSアプリ起動と終了
#!/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 "UniformTypeIdentifiers"
use scripting additions
property refMe : a reference to current application
###################################
### URLスキームから起動させる方法
set ocidURLComponents to refMe's NSURLComponents's alloc()'s init()
ocidURLComponents's setScheme:("LETS")
set ocidAppURL to ocidURLComponents's |URL|
set appSharedWorkspace to refMe's NSWorkspace's sharedWorkspace()
set boolDone to appSharedWorkspace's openURL:(ocidAppURL)
log boolDone
return
###################################
### SystemEventでチェックしてから起動させる方法
##バンドルID
set strBundleID to ("jp.co.fontworks.LETS") as text
tell application "System Events"
set listBundleID to (bundle identifier of every process) as list
set listProcess to (name of every process) as list
end tell
if listBundleID contains strBundleID then
tell application id strBundleID
try
set numCntWindow to (count of every window) as integer
on error
set numCntWindow to 0
end try
end tell
else
tell application id strBundleID to launch
tell application id strBundleID to activate
end if
############################
### com.apple.systemevents解放
############################
set strBundleIDSystemEvent to ("com.apple.systemevents") as text
set ocidRunningApplication to refMe's NSRunningApplication
set ocidAppArray to ocidRunningApplication's runningApplicationsWithBundleIdentifier:(strBundleIDSystemEvent)
repeat with itemAppArray in ocidAppArray
itemAppArray's terminate()
end repeat
tell application "System Events" to quit
終了
#!/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 "UniformTypeIdentifiers"
use scripting additions
property refMe : a reference to current application
############################
### 設定
############################
####メインのバンドルID
set strBundleID to ("jp.co.fontworks.LETS") as text
###ヘルパーのバンドルID
set listHelperBundleID to {"jp.co.fontworks.LETS"} as list
############################
### 本処理
############################
tell application "System Events"
set listBundleID to (bundle identifier of every process) as list
set listProcess to (name of every process) as list
end tell
if listBundleID contains strBundleID then
###終了
try
tell application id strBundleID to quit
end try
end if
delay 1
############################
### 半ゾンビ化対策
############################
set ocidRunningApplication to refMe's NSRunningApplication
set ocidAppArray to ocidRunningApplication's runningApplicationsWithBundleIdentifier:(strBundleID)
repeat with itemAppArray in ocidAppArray
itemAppArray's terminate()
end repeat
delay 1
############################
### ヘルパーの半ゾンビ化対策
############################
repeat with itemHelperBundleID in listHelperBundleID
set strHelperBundleID to itemHelperBundleID as text
#####
set ocidRunningApplication to refMe's NSRunningApplication
set ocidAppArray to (ocidRunningApplication's runningApplicationsWithBundleIdentifier:(strHelperBundleID))
repeat with itemAppArray in ocidAppArray
itemAppArray's forceTerminate()
end repeat
end repeat
| 固定リンク
「Fonts」カテゴリの記事
- WIndows用のフォント・管理ツール(2025.05.28)
- ユーザードメインのフォントフォルダにインストールしているフォントの数(2025.05.05)
- macOS標準のヒラギノ(2025.04.08)
- [FontList]15.3.1時点でのフォントのバージョン(2025.02.11)
- [FontBook]フォント名・PS名・フォントファミリー名の取得(2025.01.27)