AppleScript Twitter

[com.microsoft.edgemac]前面のページのURLをtwitter.comに引用投稿


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

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
# エッジで前面のページのURLをtwitter.comに引用投稿
# 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.microsoft.edgemac" as text
#####WINDOWチェック
tell application id strBundleID
  set numCntWindow to (count of every window) as integer
  if numCntWindow = 0 then
return "ウィンドウがありません"
  end if
end tell
tell application "Microsoft Edge"
activate
  tell front window
    tell active tab
      set strCurrentTabUrl to URL as text
      set strCurrentTabTitle to title as text
    end tell
  end tell
end tell
###区切り文字を入れて改行
set strSetTextValue to ("\n--\n" & strCurrentTabTitle) as text
set ocidSetTextValue to refMe's NSString's stringWithString:(strSetTextValue)

#######URLの基本的な部分
set ocidURLComponents to refMe's NSURLComponents's alloc()'s init()
ocidURLComponents's setScheme:("https")
ocidURLComponents's setHost:("twitter.com")
ocidURLComponents's setPath:("/intent/tweet")
#クエリー部分
set ocidQueryItems to refMe's NSMutableArray's alloc()'s initWithCapacity:(0)
set ocidQueryItem to refMe's NSURLQueryItem's alloc()'s initWithName:("url") value:(strCurrentTabUrl)
ocidQueryItems's addObject:(ocidQueryItem)
set ocidQueryItem to refMe's NSURLQueryItem's alloc()'s initWithName:("text") value:(ocidSetTextValue)
ocidQueryItems's addObject:(ocidQueryItem)
ocidURLComponents's setQueryItems:(ocidQueryItems)
#テキストに戻して エッジに渡す
set ocidOpenURL to ocidURLComponents's |URL|()
set strOpenURL to ocidOpenURL's absoluteString() as text


###Chromeに渡す
tell application "Microsoft Edge"
activate
  tell front window
    set objNewTab to make new tab
    tell objNewTab to set URL to strOpenURL
  end tell
end tell

旧版はテキストとして扱う

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

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
# エッジで前面のページのURLをtwitter.comに引用投稿
# 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.microsoft.edgemac" as text
#####WINDOWチェック
tell application id strBundleID
  set numCntWindow to (count of every window) as integer
  if numCntWindow = 0 then
return "ウィンドウがありません"
  end if
end tell

tell application "Microsoft Edge"
activate
  tell front window
    tell active tab
      set strCurrentTabUrl to URL as text
      set strCurrentTabTitle to title as text
    end tell
  end tell
end tell

###区切り文字を入れて改行
set strCurrentTabTitle to ("\n--\n" & strCurrentTabTitle) as text
###エンコードして
set strCurrentTabUrl to doUrlEncode(strCurrentTabUrl) as text
set strCurrentTabTitle to doUrlEncode(strCurrentTabTitle) as text
###送信用URLに整形して
set strBaseUrl to "https://twitter.com/intent/tweet?" as text
set strOpenUrl to ("" & strBaseUrl & "url=" & strCurrentTabUrl & "&text=" & strCurrentTabTitle & "") as text
###Chromeに渡す
tell application "Microsoft Edge"
activate
  tell front window
    set objNewTab to make new tab
    tell objNewTab to set URL to strOpenUrl
  end tell
end tell
####################################
###### %エンコード
####################################
on doUrlEncode(argText)
  ##テキスト
  set ocidArgText to refMe's NSString's stringWithString:(argText)
  ##キャラクタセットを指定
  set ocidChrSet to refMe's NSCharacterSet's URLQueryAllowedCharacterSet
  ##キャラクタセットで変換
  set ocidArgTextEncoded to ocidArgText's stringByAddingPercentEncodingWithAllowedCharacters:(ocidChrSet)
  ######## 置換 %エンコードの追加処理
  ###置換レコード
  set recordPercentMap to {|+|:"%2B", |=|:"%3D", |&|:"%26", |$|:"%24"} as record
  ###ディクショナリにして
  set ocidPercentMap to refMe's NSDictionary's alloc()'s initWithDictionary:(recordPercentMap)
  ###キーの一覧を取り出します
  set ocidAllKeys to ocidPercentMap's allKeys()
  ###取り出したキー一覧を順番に処理
  repeat with itemAllKey in ocidAllKeys
    ##キーの値を取り出して
    set ocidMapValue to (ocidPercentMap's valueForKey:(itemAllKey))
    ##置換
    set ocidEncodedText to (ocidArgTextEncoded's stringByReplacingOccurrencesOfString:(itemAllKey) withString:(ocidMapValue))
    ##次の変換に備える
    set ocidArgTextEncoded to ocidEncodedText
  end repeat
  ##テキスト形式に確定
  set strTextToEncode to ocidEncodedText as text
  ###値を戻す
return strTextToEncode
end doUrlEncode

|

twitter投稿用

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

#!/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.6"
use framework "Foundation"
use scripting additions

property refMe : a reference to current application

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

set strBaseUrl to "https://twitter.com/intent/tweet?"

set strCurrentTabTitle to ("\n--\n" & strCurrentTabTitle) as text

set strCurrentTabUrl to doUrlEncode(strCurrentTabUrl) as text
set strCurrentTabTitle to doUrlEncode(strCurrentTabTitle) as text

set strOpenUrl to ("" & strBaseUrl & "url=" & strCurrentTabUrl & "&text=" & strCurrentTabTitle & "") as text

tell application "Google Chrome"
  activate
  tell window 1
    set objNewTab to make new tab
    tell objNewTab to set URL to strOpenUrl
  end tell
end tell

on doUrlEncode(argString)
  set ocidStrings to refMe's NSString's stringWithString:(argString)
  set ocidCharacterSet to refMe's NSCharacterSet's URLPathAllowedCharacterSet()
  set ocidEncodedURL to ocidStrings's stringByAddingPercentEncodingWithAllowedCharacters:ocidCharacterSet
  set strEncodedURL to ocidEncodedURL as text
  return strEncodedURL as text
end doUrlEncode

|

[m3u]Twitterビデオダウンロード(ヘルパー)m4s用



#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
(*

m3u8?variant_version=1
m3u8?container=fmp4

*)
#
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7

use AppleScript version "2.8"
use framework "Foundation"
use scripting additions
######ログ表示
doLogView()

property objMe : a reference to current application
property objNSString : a reference to objMe's NSString
property objNSURL : a reference to objMe's NSURL

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

####BaseURL
set strBaseURL to "https://video.twimg.com"

####クリップボードの内容をデフォルトに利用
tell application "Finder"
set strClipboardText to the clipboard as text
end tell
####コピーしているの前提で
set strDefaultAnswer to (strBaseURL & strClipboardText)
###ICONのパス
set aliasIconPath to POSIX file "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/ConnectToIcon.icns" as alias
###ダイアログ
set objResponse to (display dialog "URLを入力してください" with title "m3uファイル" default answer strDefaultAnswer buttons {"OK", "キャンセル"} default button "OK" cancel button "キャンセル" with icon aliasIconPath giving up after 10 without hidden answer)
if true is equal to (gave up of objResponse) then
return "時間切れですやりなおしてください"
error number -128
end if
if "OK" is equal to (button returned of objResponse) then
set strResponse to (text returned of objResponse) as text
else
log "エラーしました"
return "エラーしました"
error number -128
end if


###日付取得
###フォーマットは<http://nsdateformatter.com>参照
set strDateFormat to "yyyyMMddhhmmss" as text
set ocidForMatter to objMe's NSDateFormatter's alloc()'s init()
ocidForMatter's setLocale:(objMe's NSLocale's localeWithLocaleIdentifier:"ja_JP_POSIX")
ocidForMatter's setDateFormat:(strDateFormat)
set strDateText to (ocidForMatter's stringFromDate:(current date)) as text
####作成するダウンロードフォルダのパス
set strDirPath to ("/tmp/" & strDateText & "")
set objDirPath to objNSString's stringWithString:strDirPath
###フォルダを作る
set boolMakeNewFolder to (objFileManager's createDirectoryAtPath:objDirPath withIntermediateDirectories:true attributes:(missing value) |error|:(missing value))
###エラー判定
if boolMakeNewFolder is false then
return "ダウンロードフォルダの作成に失敗しました"
end if
(*
テンポラリーファイルを/tmpに作る事で
次回の再起動時に自動的に削除されるメリットがあります
*)
####
##まずは m3u8ファイルをダウンロードします
###コマンド整形
set strCommandText to "/usr/bin/curl -k '" & strResponse & "' -o '" & strDirPath & "/" & strDateText & ".m3u8'" as text
###コマンド実行
do shell script strCommandText

set strFilePath to "" & strDirPath & "/" & strDateText & ".m3u8"

####ドキュメントのパスをNSString
set ocidFilePath to objNSString's stringWithString:strFilePath
####ドキュメントのパスをNSURL
set ocidNSUrlPath to objNSURL's fileURLWithPath:ocidFilePath
####ファイル名
set ocidFileName to ocidNSUrlPath's lastPathComponent
####拡張子を除いたファイル名
set strPrefixName to (ocidFileName's stringByDeletingPathExtension) as text

##読み込み (テキスト)
set ocidReadM3Udata to objNSString's stringWithContentsOfFile:ocidFilePath

###改行でリスト化
set strReturn to "\n"
set ocidReadM3UdataArray to ocidReadM3Udata's componentsSeparatedByString:(strReturn)
###ダウンロードするテンポラリーファイルのナンバリング
set strFileNo to 1000 as number
###改行だけ繰返し
repeat with objReadM3UdataArray in ocidReadM3UdataArray
###テキストにして
set strReadM3UdataArray to objReadM3UdataArray as text
####EXT-X-MAP 部を最初に処理 初期化セクション
if strReadM3UdataArray starts with "#EXT-X-MAP" then
###ファイル番号カウントアップ
set strFileNo to strFileNo + 1 as number
set strMapPath to doReplace(strReadM3UdataArray, "#EXT-X-MAP:URI=", "")
set strMapPath to doReplace(strMapPath, "\"", "")
###URL整形
set strURL to (strBaseURL & strMapPath) as text
set strCommandText to "/usr/bin/curl -k '" & strURL & "' -o '" & strDirPath & "/" & strFileNo & ".m4s'" as text
do shell script strCommandText
else if strReadM3UdataArray starts with "#" then
log "コメント行"
else if strReadM3UdataArray is "" then
log "空行"
else
#####コンテンツ部のダウンロード
###ファイル番号カウントアップ
set strFileNo to strFileNo + 1 as number
####ドキュメントのパスをNSURL
set ocidNSUrlReadM3UdataArray to (objNSURL's fileURLWithPath:objReadM3UdataArray)
####ファイル名
set ocidM3UFileName to ocidNSUrlReadM3UdataArray's lastPathComponent
####拡張子
set strM3UPrefixName to (ocidM3UFileName's pathExtension) as text
log strM3UPrefixName
### URL整形
set strURL to (strBaseURL & strReadM3UdataArray) as text
if strM3UPrefixName is "m4s" then
###コマンド整形
set strCommandText to "/usr/bin/curl -k '" & strURL & "' -o '" & strDirPath & "/" & strFileNo & ".m4s'" as text
else if strM3UPrefixName is "ts" then
###コマンド整形
set strCommandText to "/usr/bin/curl -k '" & strURL & "' -o '" & strDirPath & "/" & strFileNo & ".ts'" as text
end if
###コマンド実行
do shell script strCommandText
end if

end repeat
#####
(*
要は元のMP4だったりTSファイルをsplitしてある『だけ』なので
CATで結合できます。

*)
if strM3UPrefixName is "m4s" then
###ダウンロード終わったものをまとめる
do shell script "/bin/cat " & strDirPath & "/*m4s >> ~/Desktop/" & strPrefixName & ".mp4"
else if strM3UPrefixName is "ts" then
###ダウンロード終わったものをまとめる
do shell script "/bin/cat " & strDirPath & "/*ts >> ~/Desktop/" & strPrefixName & ".ts"
end if





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


#########################ログ表示
to doLogView()

tell application "System Events"
set listAppList to title of (every process where background only is false)
end tell
repeat with objAppList in listAppList
set strAppList to objAppList as text
if strAppList is "スクリプトエディタ" then
tell application "Script Editor"
if frontmost is true then
try
tell application "System Events" to click menu item "ログを表示" of menu "表示" of menu bar item "表示" of menu bar 1 of application process "Script Editor"
end try
end if
end tell
end if
end repeat

end doLogView
#########################



#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
(*

m3u8?variant_version=1
m3u8?container=fmp4

*)
#
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7

use AppleScript version "2.8"
use framework "Foundation"
use scripting additions
######ログ表示
doLogView()

property objMe : a reference to current application
property objNSString : a reference to objMe's NSString
property objNSURL : a reference to objMe's NSURL

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

####BaseURL
set strBaseURL to "https://video.twimg.com"

####クリップボードの内容をデフォルトに利用
tell application "Finder"
set strClipboardText to the clipboard as text
end tell
####コピーしているの前提で
set strDefaultAnswer to (strBaseURL & strClipboardText)
###ICONのパス
set aliasIconPath to POSIX file "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/ConnectToIcon.icns" as alias
###ダイアログ
set objResponse to (display dialog "URLを入力してください" with title "m3uファイル" default answer strDefaultAnswer buttons {"OK", "キャンセル"} default button "OK" cancel button "キャンセル" with icon aliasIconPath giving up after 10 without hidden answer)
if true is equal to (gave up of objResponse) then
return "時間切れですやりなおしてください"
error number -128
end if
if "OK" is equal to (button returned of objResponse) then
set strResponse to (text returned of objResponse) as text
else
log "エラーしました"
return "エラーしました"
error number -128
end if


###日付取得
###フォーマットは<http://nsdateformatter.com>参照
set strDateFormat to "yyyyMMddhhmmss" as text
set ocidForMatter to objMe's NSDateFormatter's alloc()'s init()
ocidForMatter's setLocale:(objMe's NSLocale's localeWithLocaleIdentifier:"ja_JP_POSIX")
ocidForMatter's setDateFormat:(strDateFormat)
set strDateText to (ocidForMatter's stringFromDate:(current date)) as text
####作成するダウンロードフォルダのパス
set strDirPath to ("/tmp/" & strDateText & "")
set objDirPath to objNSString's stringWithString:strDirPath
###フォルダを作る
set boolMakeNewFolder to (objFileManager's createDirectoryAtPath:objDirPath withIntermediateDirectories:true attributes:(missing value) |error|:(missing value))
###エラー判定
if boolMakeNewFolder is false then
return "ダウンロードフォルダの作成に失敗しました"
end if
(*
テンポラリーファイルを/tmpに作る事で
次回の再起動時に自動的に削除されるメリットがあります
*)
####
##まずは m3u8ファイルをダウンロードします
###コマンド整形
set strCommandText to "/usr/bin/curl -k '" & strResponse & "' -o '" & strDirPath & "/" & strDateText & ".m3u'" as text
###コマンド実行
do shell script strCommandText

set strFilePath to "" & strDirPath & "/" & strDateText & ".m3u8"

####ドキュメントのパスをNSString
set ocidFilePath to objNSString's stringWithString:strFilePath
####ドキュメントのパスをNSURL
set ocidNSUrlPath to objNSURL's fileURLWithPath:ocidFilePath
####ファイル名
set ocidFileName to ocidNSUrlPath's lastPathComponent
####拡張子を除いたファイル名
set strPrefixName to (ocidFileName's stringByDeletingPathExtension) as text

##読み込み (テキスト)
set ocidReadM3Udata to objNSString's stringWithContentsOfFile:ocidFilePath
###改行でリスト化
set ocidReadM3UdataArray to ocidReadM3Udata's componentsSeparatedByString:"\n"
###ダウンロードするテンポラリーファイルのナンバリング
set strFileNo to 1000 as number
###改行だけ繰返し
repeat with objReadM3UdataArray in ocidReadM3UdataArray
###テキストにして
set strReadM3UdataArray to objReadM3UdataArray as text
####EXT-X-MAP 部を最初に処理 初期化セクション
if strReadM3UdataArray starts with "#EXT-X-MAP" then
###ファイル番号カウントアップ
set strFileNo to strFileNo + 1 as number
set strMapPath to doReplace(strReadM3UdataArray, "#EXT-X-MAP:URI=", "")
set strMapPath to doReplace(strMapPath, "\"", "")
###URL整形
set strURL to (strBaseURL & strMapPath) as text
set strCommandText to "/usr/bin/curl -k '" & strURL & "' -o '" & strDirPath & "/" & strFileNo & ".m4s'" as text
do shell script strCommandText
else if strReadM3UdataArray starts with "#" then
log "コメント行"
else if strReadM3UdataArray is "" then
log "空行"
else
#####コンテンツ部のダウンロード
###ファイル番号カウントアップ
set strFileNo to strFileNo + 1 as number
####ドキュメントのパスをNSURL
set ocidNSUrlReadM3UdataArray to (objNSURL's fileURLWithPath:objReadM3UdataArray)
####ファイル名
set ocidM3UFileName to ocidNSUrlReadM3UdataArray's lastPathComponent
####拡張子
set strM3UPrefixName to (ocidM3UFileName's pathExtension) as text
log strM3UPrefixName
### URL整形
set strURL to (strBaseURL & strReadM3UdataArray) as text
if strM3UPrefixName is "m4s" then
###コマンド整形
set strCommandText to "/usr/bin/curl -k '" & strURL & "' -o '" & strDirPath & "/" & strFileNo & ".m4s'" as text
else if strM3UPrefixName is "ts" then
###コマンド整形
set strCommandText to "/usr/bin/curl -k '" & strURL & "' -o '" & strDirPath & "/" & strFileNo & ".ts'" as text
end if
###コマンド実行
do shell script strCommandText
end if

end repeat
#####
(*
要は元のMP4だったりTSファイルをsplitしてある『だけ』なので
CATで結合できます。

*)
if strM3UPrefixName is "m4s" then
###ダウンロード終わったものをまとめる
do shell script "/bin/cat " & strDirPath & "/*m4s >> ~/Desktop/" & strPrefixName & ".mp4"
else if strM3UPrefixName is "ts" then
###ダウンロード終わったものをまとめる
do shell script "/bin/cat " & strDirPath & "/*ts >> ~/Desktop/" & strPrefixName & ".ts"
end if





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


#########################ログ表示
to doLogView()

tell application "System Events"
set listAppList to title of (every process where background only is false)
end tell
repeat with objAppList in listAppList
set strAppList to objAppList as text
if strAppList is "スクリプトエディタ" then
tell application "Script Editor"
if frontmost is true then
try
tell application "System Events" to click menu item "ログを表示" of menu "表示" of menu bar item "表示" of menu bar 1 of application process "Script Editor"
end try
end if
end tell
end if
end repeat

end doLogView
#########################

|

[m3u]Twitterビデオダウンロード(ヘルパー)TS用

Twitterビデオのm3uファイルから
TSファイルをダウンロードして1つのTSファイルに結合します。



#!/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 objNSURL : a reference to objMe's NSURL

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


####BaseURL
set strBaseURL to "https://video.twimg.com"


###日付取得
###フォーマットは<http://nsdateformatter.com>参照
set strDateFormat to "yyyyMMddhhmmss" as text
set ocidForMatter to objMe's NSDateFormatter's alloc()'s init()
ocidForMatter's setLocale:(objMe's NSLocale's localeWithLocaleIdentifier:"ja_JP_POSIX")
ocidForMatter's setDateFormat:(strDateFormat)
set theString to (ocidForMatter's stringFromDate:(current date)) as text
####作成するダウンロードフォルダのパス
set strDirPath to ("/tmp/" & theString & "")
set objDirPath to objNSString's stringWithString:strDirPath
###フォルダを作る
set boolMakeNewFolder to (objFileManager's createDirectoryAtPath:objDirPath withIntermediateDirectories:true attributes:(missing value) |error|:(missing value))
###エラー判定
if boolMakeNewFolder is false then
return "ダウンロードフォルダの作成に失敗しました"
end if
(*
テンポラリーファイルを/tmpに作る事で
次回の再起動時に自動的に削除されるメリットがあります
*)
######ログ表示
doLogView()

####ダイアログで使うデフォルトロケーション
tell application "Finder"
##set aliasDefaultLocation to container of (path to me) as alias
set aliasDefaultLocation to (path to downloads folder from user domain) as alias
end tell

####UTIリスト m3uのみ
set listUTI to {"public.m3u-playlist"}

####ダイアログを出す
set aliasFilePath to (choose file with prompt "m3uファイルを選んでください" default location (aliasDefaultLocation) of type listUTI with invisibles and showing package contents without multiple selections allowed) as alias

set strFilePath to POSIX path of aliasFilePath

####ドキュメントのパスをNSString
set ocidFilePath to objNSString's stringWithString:strFilePath
####ドキュメントのパスをNSURL
set ocidNSUrlPath to objNSURL's fileURLWithPath:ocidFilePath
####ファイル名
set ocidFileName to ocidNSUrlPath's lastPathComponent
####拡張子を除いたファイル名
set strPrefixName to (ocidFileName's stringByDeletingPathExtension) as text

##読み込み (テキスト)
set ocidReadM3Udata to objNSString's stringWithContentsOfFile:ocidFilePath
###改行でリスト化
set ocidReadM3UdataArray to ocidReadM3Udata's componentsSeparatedByString:"\n"
###ダウンロードするテンポラリーファイルのナンバリング
set strFileNo to 1000 as number
###改行だけ繰返し
repeat with objReadM3UdataArray in ocidReadM3UdataArray

###テキストにして
set strReadM3UdataArray to objReadM3UdataArray as text
if strReadM3UdataArray starts with "#" then
log "コメント行"
else
###ファイル番号カウントアップ
set strFileNo to strFileNo + 1 as number
###URL整形
set strURL to (strBaseURL & strReadM3UdataArray) as text
###コマンド整形
set strCommandText to "/usr/bin/curl -k '" & strURL & "' -o '" & strDirPath & "/" & strFileNo & ".ts'" as text
###コマンド実行
do shell script strCommandText
end if

end repeat
###ダウンロード終わったものをまとめる
do shell script "/bin/cat " & strDirPath & "/* >> ~/Desktop/" & strPrefixName & ".ts"




#########################ログ表示
to doLogView()

tell application "System Events"
set listAppList to title of (every process where background only is false)
end tell
repeat with objAppList in listAppList
set strAppList to objAppList as text
if strAppList is "スクリプトエディタ" then
tell application "Script Editor"
if frontmost is true then
try
tell application "System Events" to click menu item "ログを表示" of menu "表示" of menu bar item "表示" of menu bar 1 of application process "Script Editor"
end try
end if
end tell
end if
end repeat

end doLogView
#########################

|

[Google Chrome]Twitterへ投稿する

1:URLを取得する
2:タイトルを取得する
3:%エンコードする
4:URLを整形して
5:URLを開く を処理します

ダウンロード - twittere381b8e68a95e7a8bf.zip


#!/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.4"
use framework "Foundation"
use scripting additions

tell application "AppleScript Utility"
set application scripts position to top
set Script menu enabled to true
set show Computer scripts to true
set boolGuiScript to GUI Scripting enabled
if boolGuiScript is false then
GUI Scripting enabled
end if
set theAppPath to default script editor
log theAppPath
end tell


tell application "Finder"
set aliasScriptPath to path to scripts folder from user domain
set boolFolderChk to exists of (folder "Applications" of folder aliasScriptPath)
if boolFolderChk is false then
make new folder at aliasScriptPath with properties {name:"Applications", displayed name:"Applications", comment:"Applications"}
end if
set aliaseScriptAppPath to (folder "Applications" of folder aliasScriptPath) as alias
set boolFolderChk to exists of (folder "Google Chrome" of folder aliaseScriptAppPath)
if boolFolderChk is false then
make new folder at aliaseScriptAppPath with properties {name:"Google Chrome", displayed name:"Google Chrome", comment:"Google Chrome"}
end if

set aliasDistDir to (folder "Google Chrome" of folder aliaseScriptAppPath) as alias
set theDistDir to POSIX path of aliasDistDir as text

end tell


tell application "Finder"
set aliasContainerDir to container of (path to me) as alias
set theContainerDir to POSIX path of aliasContainerDir as text
end tell

set theCommandText to ("ditto \"" & theContainerDir & "Google Chrome\" \"" & theDistDir & "\"")
do shell script theCommandText



tell application "Finder"



open (folder "Twitterへ投稿" of folder "Google Chrome" of folder aliaseScriptAppPath)
select (folder "Twitterへ投稿" of folder "Google Chrome" of folder aliaseScriptAppPath)
end tell

|

その他のカテゴリー

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