Guide

[github]初回アクセスからpushまで 

カテゴリーgithub
https://quicktimer.cocolog-nifty.com/icefloe/cat76058047/index.html
前提
業務利用の場合
SSHキーを使ったサービスが他にないか?を
システム管理者に事前に確認すること
ーー>既存のサービスを利用できなくなる可能性もある



事前準備:Finderで全てのファイルを表示させる
1:[GITHUB]アカウントを作成
2:[GITHUB]リポジトリを作成
3:[LOCAL]保存先(CLON先)を決める
4:[LOCAL]SSHのキーを確認
5:[LOCAL]公開キーを生成取得
6:[GITHUB]SSHキーを登録する
7:[LOCAL]CLONE
8:[LOCAL]add
9:[LOCAL]commit
10:[LOCAL]PUSH
11:結果確認


事前準備:Finderで全てのファイルを表示させる
スクリプトを使って設定してください
allfilesshowhide.zip

1:[GITHUB]アカウントを作成
guthubのページからアカウントを作成します
https://github.com/

2:[GITHUB]リポジトリを作成
20240418031507_1536x326

3:[LOCAL]保存先(CLON先)を決める
このサンプルでは
$HOME/Developer/GitHubフォルダを作成してそこを
github用のディレクトリとします
https://quicktimer.cocolog-nifty.com/icefloe/2024/02/post-73027b.html

4:[LOCAL]SSHのキーを確認
https://quicktimer.cocolog-nifty.com/icefloe/2024/02/post-6b37e5.html

5:[LOCAL]公開キーを生成取得
https://quicktimer.cocolog-nifty.com/icefloe/2024/02/post-a36fb3.html

6:[GITHUB]SSHキーを登録する
https://quicktimer.cocolog-nifty.com/icefloe/2024/02/post-7243dc.html

7:[LOCAL]CLONE
https://quicktimer.cocolog-nifty.com/icefloe/2024/02/post-8d12c5.html

8:[LOCAL]add
https://quicktimer.cocolog-nifty.com/icefloe/2024/02/post-bd0bfd.html

9:[LOCAL]commit
https://quicktimer.cocolog-nifty.com/icefloe/2024/02/post-4c0fe9.html

10:[LOCAL]PUSH
https://quicktimer.cocolog-nifty.com/icefloe/2024/02/post-2ec59c.html

11:結果確認
WEBブラウザで結果を確認してください

|

[fig 02-09]フォルダ内のアイテム

指定フォルダ内に内包される項目
例はユーザーの音楽Musicフォルダ


tell application "Finder"
tell folder (path to music folder from user domain)
set file_list to name of every item
end tell
end tell


#!/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

####ログ表示
doLogView()

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

####ミュージックフォルダ
set ocidUserMusicPath to (objFileManager's URLsForDirectory:(objMe's NSMusicDirectory) inDomains:(objMe's NSUserDomainMask))
log ocidUserMusicPath as list
log ocidUserMusicPath as text

####UNIXパス形式に変換(NSSingleObjectArraytringで確定させる)
set ocidFileRelativePath to (ocidUserMusicPath's objectAtIndex:0)'s relativePath
log ocidFileRelativePath as text
log className() of ocidFileRelativePath as text

###NSStringにして
set ocidDirPath to objNSString's stringWithString:ocidFileRelativePath
log ocidDirPath as text
log className() of ocidDirPath as text


###ディレクトリのコンテンツ一覧
set arrayFilesList to objFileManager's contentsOfDirectoryAtPath:ocidDirPath |error|:(missing value)
####
log arrayFilesList
log arrayFilesList's className() as text
log arrayFilesList as list

#########################ログ表示
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
#########################

|

[fig 02-08]フォルダのプロパティの取得

#!/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 "AppKit"
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()

####ミュージックフォルダ
set ocidUserMusicPath to (objFileManager's URLsForDirectory:(objMe's NSMusicDirectory) inDomains:(objMe's NSUserDomainMask))
log ocidUserMusicPath as list
log ocidUserMusicPath as text

####UNIXパス形式に変換(NSSingleObjectArraytringで確定させる)
set ocidFileRelativePath to (ocidUserMusicPath's objectAtIndex:0)'s relativePath
log ocidFileRelativePath as text
log className() of ocidFileRelativePath as text

###NSStringにして
set ocidDirPath to objNSString's stringWithString:ocidFileRelativePath
log ocidDirPath as text
log className() of ocidDirPath as text

###attributesOfItemAtPath
set ocidAttributes to objFileManager's attributesOfItemAtPath:ocidDirPath |error|:(missing value)
log ocidAttributes as list
log className() of ocidDirPath as text
(*
ocidAttributes
NSFileOwnerAccountID
NSFileSystemFileNumber
NSFileExtensionHidden
NSFileSystemNumber
NSFileSize
NSFileGroupOwnerAccountID
NSFileOwnerAccountName
NSFileCreationDate
NSFilePosixPermissions
NSFileProtectionKey
NSFileType
NSFileGroupOwnerAccountName
NSFileReferenceCount
NSFileModificationDate 等が入っています
*)

#########################ログ表示
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
#########################

|

[fig 02-04]テキストの結合(追加)

#!/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
####ログ表示
doLogView()
####
property objMe : a reference to current application
property objNSString : a reference to objMe's NSString
property objNSMutableString : a reference to objMe's NSMutableString

set strTextA to "美しい日本語" as text
set strTextB to "" as text
set strTextC to "オープンタイプフォント" as text


set strTextD to (strTextA & strTextB & strTextC) as text
log strTextD as text
log class of strTextD

set strTextE to (strTextA & strTextB & "" & strTextC) as text

log strTextE as text
log class of strTextE

########################

set strTextF to "美しい日本語" as text
set strTextG to "" as text
set strTextH to "オープンタイプフォント" as text


####NSString
set ocidTextF to objNSString's stringWithString:strTextF
set ocidTextG to objNSString's stringWithString:strTextG
set ocidTextH to objNSString's stringWithString:strTextH

set ocidTextI to ocidTextF's stringByAppendingString:ocidTextG
set ocidTextI to ocidTextI's stringByAppendingString:ocidTextH

log ocidTextI as text
log className() of ocidTextI as text

set ocidTextF to objNSString's stringWithString:strTextF
set ocidTextJ to ocidTextF's stringByAppendingString:ocidTextG
set ocidTextJ to ocidTextJ's stringByAppendingString:""
set ocidTextJ to ocidTextJ's stringByAppendingString:ocidTextH
log ocidTextJ as text
log className() of ocidTextJ as text


####NSMutableString

set strTextF to "美しい日本語" as text
set strTextG to "" as text
set strTextH to "オープンタイプフォント" as text

set ocidMutableString to objNSMutableString's alloc()'s initWithCapacity:0
ocidMutableString's setString:strTextF
ocidMutableString's appendString:strTextG
ocidMutableString's appendString:strTextH
log ocidMutableString as text
log className() of ocidMutableString as text

ocidMutableString's setString:""
ocidMutableString's setString:strTextF
ocidMutableString's appendString:strTextG
ocidMutableString's appendString:""
ocidMutableString's appendString:strTextH
log ocidMutableString as text
log className() of ocidMutableString as text


#########################ログ表示
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
#########################

|

[fig 02-03]フォルダの作成と削除

#!/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 scripting additions

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

property objMe : a reference to current application
property objNSString : a reference to objMe's NSString
property objNSMutableString : a reference to objMe's NSMutableString

property objNSNotFound : a reference to 9.22337203685477E+18 + 5807

###ランダム番号
set numRandomNo to random number 100 as integer
###テキストにしておいて
set strRandomNo to numRandomNo as text
###フォルダの名前を定義
set strFolderName to "番号フォルダ" & strRandomNo as text
###名称未設定フォルダを作っておいて
tell application "Finder" to make new folder at desktop
###↑これのresult=名称未設定フォルダのエイリアス
set aliasNewFolder to the result as alias
###フォルダの名前を変更する
tell application "Finder" to set the name of aliasNewFolder to strFolderName
###3秒まって
delay 3
####削除する
tell application "Finder" to delete (folder strFolderName of folder (path to desktop folder from user domain))

(*
ゴミ箱に入れる場合は
tell application "Finder" to move (folder folder_name of folder (path to desktop folder from user domain)) to trash
*)




display notification "処理終了" with title "処理が終了" subtitle "処理が終了しました" sound name "Sonumi"
log ">>>>>>>>>>>>処理終了<<<<<<<<<<<<<<<"
return ">>>>>>>>>>>>処理終了<<<<<<<<<<<<<<<"




#########################ログ表示
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
#########################

|

[fig 02-03]フォルダの作成 と 削除

#!/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
####ログ表示
doLogView()
####
property objMe : a reference to current application
property objNSString : a reference to objMe's NSString

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

####ランダム番号を生成
set numRandomNo to (random number 100) as integer
set numRandomNo to (random number from 0 to 100) as integer
set numRandomNo to (random number from 50 to 100) as integer

log numRandomNo
log class of numRandomNo

####フォルダ名を定義
set strFolderName to "番号フォルダ" & numRandomNo as text
log strFolderName as text
log class of strFolderName

#### フォルダ名をNSString
set ocidFolderName to objNSString's stringWithString:strFolderName
log ocidFolderName as text
log className() of ocidFolderName as text

set strDesktopPath to "~/Desktop/"

###ユーザーデスクトップフォルダを定義
set ocidDesktopPath to objNSString's stringWithString:strDesktopPath
log ocidDesktopPath as text
log className() of ocidDesktopPath as text

####フォルダ名を追加して作成するフォルダへのパスにする
set ocidMakeFolderPath to ocidDesktopPath's stringByAppendingString:ocidFolderName
log ocidMakeFolderPath as text
log className() of ocidMakeFolderPath as text

#####パス化する
set ocidPOSIXpath to ocidMakeFolderPath's stringByStandardizingPath
log ocidPOSIXpath as text
log className() of ocidPOSIXpath as text

####フォルダを作成
set boolMakeNewFolder to (objFileManager's createDirectoryAtPath:ocidPOSIXpath withIntermediateDirectories:true attributes:(missing value) |error|:(missing value))
log boolMakeNewFolder as boolean
log class of boolMakeNewFolder


###2秒まって
delay 2

###パスをNSStringに変換
set ocidPOSIXpathNSString to objNSString's stringWithString:ocidPOSIXpath
log ocidPOSIXpathNSString as text
log className() of ocidPOSIXpathNSString as text

###フォルダを削除
set boolGoToTrash to objFileManager's removeItemAtPath:ocidPOSIXpathNSString |error|:(missing value)
log boolGoToTrash as boolean
log class of boolGoToTrash as text

#########################ログ表示
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
#########################

|

[fig 02-02]random number

#!/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
####ログ表示
doLogView()
####
property objMe : a reference to current application
property objNSString : a reference to objMe's NSString
####
set numIntegerNo to (random number 100) as integer
set numIntegerNo to (random number from 0 to 100) as integer
set numIntegerNo to (random number from 50 to 100) as integer

log numIntegerNo
log class of numIntegerNo





#########################ログ表示
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
#########################

|

その他のカテゴリー

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 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