use AppleScript version "2.8"
use framework "Foundation"
use scripting additions
property refMe : a reference to current application
property refNSString : a reference to refMe's NSString
property refNSData : a reference to refMe's NSData
property refNSURL : a reference to refMe's NSURL
property refNSDate : a reference to refMe's NSDate
property refNSDateFormatter : a reference to NSDateFormatter
property refNSMutableArray : a reference to refMe's NSMutableArray
property refNSMutableDictionary : a reference to refMe's NSMutableDictionary
property refNSPropertyListSerialization : a reference to refMe's NSPropertyListSerialization
set strPayloadType to "com.apple.TextEdit" as text
set strPayloadDisplayName to "com.apple.TextEdit" as text
set strPayloadOrganization to "com.cocolog-nifty.quicktimer" as text
set strPayloadDescription to "com.apple.TextEdit関連の設定です" as text
set strConsentTextDefault to "日本語の詳しい解説例:この設定は削除しないでください\ncom.apple.TextEditに関する設定です" as text
set strConsentTextEn to "Do not remove this setting" as text
set numTargetDeviceType to 5 as number
set strRelativePath to ("~/Desktop/") as text
set ocidRelativePath to refNSString's stringWithString:strRelativePath
set ocidFullPath to ocidRelativePath's stringByStandardizingPath()
set ocidFullPathURL to refMe's NSURL's fileURLWithPath:ocidFullPath
set aliasFullPathURL to ocidFullPathURL as alias
set strFileName to ("" & strPayloadDisplayName & ".mobileconfig") as text
set recordConsentText to {default:strConsentTextDefault, jp:strConsentTextDefault} as record
set aliasSaveFilePath to choose file name with prompt "ファイル名を付けてください" default name strFileName default location (aliasFullPathURL)
set strSaveFilePath to POSIX path of aliasSaveFilePath as text
set ocidPosixPath to refNSString's stringWithString:strSaveFilePath
set ocidPosixFullPath to ocidPosixPath's stringByStandardizingPath
set numPayloadVersion to (doGetDateNo("yyyyMMdd")) as number
tell application "System Events"
set strAuthor to full name of current user
end tell
set strAuthor to ""
set strCompany to ""
set ocidPayloadContentMain to refNSMutableDictionary's alloc()'s initWithCapacity:0
set strPayloadUUID to doUUIDgen() as text
set strPayloadIdentifier to ("" & strPayloadType & "." & strPayloadUUID & "") as text
tell ocidPayloadContentMain
ocidPayloadContentMain's setObject:(4 as integer) forKey:"PlainTextEncoding"
ocidPayloadContentMain's setObject:(4 as integer) forKey:"PlainTextEncodingForWrite"
ocidPayloadContentMain's setObject:(72 as integer) forKey:"WidthInChars"
ocidPayloadContentMain's setObject:("~/Desktop" as text) forKey:"NSNavLastRootDirectory"
ocidPayloadContentMain's setObject:("{960, 520}" as text) forKey:"NSNavPanelExpandedSizeForOpenMode"
ocidPayloadContentMain's setObject:("{960, 520}" as text) forKey:"NSNavPanelExpandedSizeForSaveMode"
ocidPayloadContentMain's setObject:(strAuthor as text) forKey:"author"
ocidPayloadContentMain's setObject:(strCompany as text) forKey:"company"
ocidPayloadContentMain's setObject:("ご相談ください(Ask)" as text) forKey:"copyright"
ocidPayloadContentMain's setObject:("Osaka-Mono" as text) forKey:"NSFixedPitchFont"
ocidPayloadContentMain's setObject:("14" as text) forKey:"NSFixedPitchFontSize"
ocidPayloadContentMain's setObject:("Osaka-Mono" as text) forKey:"NSFont"
ocidPayloadContentMain's setObject:("14" as text) forKey:"NSFontSize"
ocidPayloadContentMain's setObject:(true as boolean) forKey:"AddExtensionToNewPlainTextFiles"
ocidPayloadContentMain's setObject:(true as boolean) forKey:"PreserveWhitespace"
ocidPayloadContentMain's setObject:(true as boolean) forKey:"ShowRuler"
ocidPayloadContentMain's setObject:(true as boolean) forKey:"TextReplacement"
ocidPayloadContentMain's setObject:(true as boolean) forKey:"UseInlineCSS"
ocidPayloadContentMain's setObject:(true as boolean) forKey:"NSDocumentSuppressTempVersionStoreWarning"
ocidPayloadContentMain's setObject:(true as boolean) forKey:"NSNavPanelExpandedStateForSaveMode"
ocidPayloadContentMain's setObject:(false as boolean) forKey:"DataDetectors"
ocidPayloadContentMain's setObject:(false as boolean) forKey:"IgnoreHTML"
ocidPayloadContentMain's setObject:(false as boolean) forKey:"IgnoreRichTex"
ocidPayloadContentMain's setObject:(false as boolean) forKey:"SCheckGrammarWithSpelling"
ocidPayloadContentMain's setObject:(false as boolean) forKey:"SDataDetectors"
ocidPayloadContentMain's setObject:(false as boolean) forKey:"SSmartLinks"
ocidPayloadContentMain's setObject:(false as boolean) forKey:"SmartDashes"
ocidPayloadContentMain's setObject:(false as boolean) forKey:"SmartLinks"
ocidPayloadContentMain's setObject:(false as boolean) forKey:"SmartQuotes"
ocidPayloadContentMain's setObject:(false as boolean) forKey:"UseEmbeddedCSS"
ocidPayloadContentMain's setObject:(false as boolean) forKey:"CheckSpellingWhileTyping"
ocidPayloadContentMain's setObject:(false as boolean) forKey:"SmartCopyPaste"
ocidPayloadContentMain's setObject:(false as boolean) forKey:"SmartSubstitutionsEnabledInRichTextOnly"
ocidPayloadContentMain's setObject:(false as boolean) forKey:"CheckGrammarWithSpelling"
ocidPayloadContentMain's setObject:(false as boolean) forKey:"CheckSpellingAsYouTypeEnabledInRichTextOnly"
ocidPayloadContentMain's setObject:(false as boolean) forKey:"CorrectSpellingAutomatically"
ocidPayloadContentMain's setObject:(false as boolean) forKey:"NSNavLastUserSetHideExtensionButtonState"
ocidPayloadContentMain's setObject:(false as boolean) forKey:"NSAutomaticSpellingCorrectionEnabled"
ocidPayloadContentMain's setObject:(false as boolean) forKey:"NSAutomaticCapitalizationEnabled"
ocidPayloadContentMain's setObject:(false as boolean) forKey:"NSAutomaticTextCompletionEnabled"
ocidPayloadContentMain's setObject:(false as boolean) forKey:"NSAutomaticTextCompletionCollapsed"
ocidPayloadContentMain's setObject:(false as boolean) forKey:"NSAutomaticDashSubstitutionEnabled"
ocidPayloadContentMain's setObject:(false as boolean) forKey:"NSAutomaticQuoteSubstitutionEnabled"
ocidPayloadContentMain's setObject:(false as boolean) forKey:"NSAutomaticPeriodSubstitutionEnabled"
ocidPayloadContentMain's setObject:(strPayloadDisplayName as text) forKey:"PayloadDisplayName"
ocidPayloadContentMain's setObject:(strPayloadDescription as text) forKey:"PayloadDescription"
ocidPayloadContentMain's setObject:(strPayloadUUID as text) forKey:"PayloadUUID"
ocidPayloadContentMain's setObject:(strPayloadIdentifier as text) forKey:"PayloadIdentifier"
ocidPayloadContentMain's setObject:(strPayloadOrganization as text) forKey:"PayloadOrganization"
ocidPayloadContentMain's setObject:(strPayloadType as text) forKey:"PayloadType"
ocidPayloadContentMain's setObject:(numPayloadVersion as number) forKey:"PayloadVersion"
end tell
set strPayloadUUID to doUUIDgen() as text
set strPayloadIdentifier to ("" & strPayloadDisplayName & "." & strPayloadUUID & "") as text
set ocidPayloadContentArray to refNSMutableArray's alloc()'s initWithCapacity:0
tell ocidPayloadContentArray
ocidPayloadContentArray's addObject:ocidPayloadContentMain
end tell
set strPayloadUUID to doUUIDgen() as text
set strPayloadIdentifier to ("" & strPayloadDisplayName & "." & strPayloadUUID & "") as text
set ocidPlistData to refNSMutableDictionary's alloc()'s initWithCapacity:0
tell ocidPlistData
ocidPlistData's setObject:ocidPayloadContentArray forKey:"PayloadContent"
ocidPlistData's setObject:strPayloadDisplayName forKey:"PayloadDisplayName"
ocidPlistData's setObject:strPayloadDescription forKey:"PayloadDescription"
ocidPlistData's setObject:recordConsentText forKey:"ConsentText"
ocidPlistData's setObject:(strPayloadUUID as text) forKey:"PayloadUUID"
ocidPlistData's setObject:(strPayloadIdentifier as text) forKey:"PayloadIdentifier"
ocidPlistData's setObject:(strPayloadOrganization as text) forKey:"PayloadOrganization"
ocidPlistData's setObject:"Configuration" forKey:"PayloadType"
ocidPlistData's setObject:"User" forKey:"PayloadScope"
ocidPlistData's setObject:(numTargetDeviceType as number) forKey:"TargetDeviceType"
ocidPlistData's setObject:(false as boolean) forKey:"PayloadRemovalDisallowed"
ocidPlistData's setObject:(numPayloadVersion as number) forKey:"PayloadVersion"
end tell
set ocidBinplist to refMe's NSPropertyListBinaryFormat_v1_0
set ocidXmlplist to refMe's NSPropertyListXMLFormat_v1_0
set ocidPlistEditData to refMe's NSPropertyListSerialization's dataWithPropertyList:ocidPlistData format:ocidXmlplist options:0 |error|:(missing value)
set boolWritetoUrlArray to ocidPlistEditData's writeToFile:ocidPosixFullPath options:0 |error|:(reference)
set ocidWriteToUrlResults to item 1 of boolWritetoUrlArray
set ocidErrorResults to item 2 of boolWritetoUrlArray
if ocidWriteToUrlResults is true then
ocidPlistEditData's release()
ocidPlistData's release()
else
try
log ocidWriteToUrlResults's localizedDescription() as text
log ocidWriteToUrlResults's localizedFailureReason() as text
log ocidWriteToUrlResults's localizedRecoverySuggestion() as text
log ocidWriteToUrlResults's localizedRecoveryOptions() as text
log ocidWriteToUrlResults's recoveryAttempter() as text
log ocidWriteToUrlResults's helpAnchor() as text
end try
log "ファイルの書き込みに失敗しました"
end if
to doUUIDgen()
set ocidConcreteUUID to refMe's NSUUID's UUID()
set ocidUUIDString to ocidConcreteUUID's UUIDString()
set strUUIDString to ocidUUIDString as text
return strUUIDString
end doUUIDgen
to doGetDateNo(strDateFormat)
set ocidDate to refNSDate's |date|()
set ocidNSDateFormatter to refNSDateFormatter's alloc()'s init()
ocidNSDateFormatter's setLocale:(refMe's NSLocale's localeWithLocaleIdentifier:"ja_JP_POSIX")
ocidNSDateFormatter's setDateFormat:strDateFormat
set ocidDateAndTime to ocidNSDateFormatter's stringFromDate:ocidDate
set strDateAndTime to ocidDateAndTime as text
return strDateAndTime
end doGetDateNo
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ConsentText</key>
<dict>
<key>default</key>
<string>日本語の詳しい解説例:この設定は削除しないでください
com.apple.TextEditに関する設定です</string>
<key>jp</key>
<string>日本語の詳しい解説例:この設定は削除しないでください
com.apple.TextEditに関する設定です</string>
</dict>
<key>PayloadContent</key>
<array>
<dict>
<key>AddExtensionToNewPlainTextFiles</key>
<true/>
<key>CheckGrammarWithSpelling</key>
<false/>
<key>CheckSpellingAsYouTypeEnabledInRichTextOnly</key>
<false/>
<key>CheckSpellingWhileTyping</key>
<false/>
<key>CorrectSpellingAutomatically</key>
<false/>
<key>DataDetectors</key>
<false/>
<key>IgnoreHTML</key>
<false/>
<key>IgnoreRichTex</key>
<false/>
<key>NSAutomaticCapitalizationEnabled</key>
<false/>
<key>NSAutomaticDashSubstitutionEnabled</key>
<false/>
<key>NSAutomaticPeriodSubstitutionEnabled</key>
<false/>
<key>NSAutomaticQuoteSubstitutionEnabled</key>
<false/>
<key>NSAutomaticSpellingCorrectionEnabled</key>
<false/>
<key>NSAutomaticTextCompletionCollapsed</key>
<false/>
<key>NSAutomaticTextCompletionEnabled</key>
<false/>
<key>NSDocumentSuppressTempVersionStoreWarning</key>
<true/>
<key>NSFixedPitchFont</key>
<string>Osaka-Mono</string>
<key>NSFixedPitchFontSize</key>
<string>14</string>
<key>NSFont</key>
<string>Osaka-Mono</string>
<key>NSFontSize</key>
<string>14</string>
<key>NSNavLastRootDirectory</key>
<string>~/Desktop</string>
<key>NSNavLastUserSetHideExtensionButtonState</key>
<false/>
<key>NSNavPanelExpandedSizeForOpenMode</key>
<string>{960, 520}</string>
<key>NSNavPanelExpandedSizeForSaveMode</key>
<string>{960, 520}</string>
<key>NSNavPanelExpandedStateForSaveMode</key>
<true/>
<key>PayloadDescription</key>
<string>com.apple.TextEdit関連の設定です</string>
<key>PayloadDisplayName</key>
<string>com.apple.TextEdit</string>
<key>PayloadIdentifier</key>
<string>com.apple.TextEdit.66EA78E8-4D59-4E6E-89D1-77E98ADC560F</string>
<key>PayloadOrganization</key>
<string>com.cocolog-nifty.quicktimer</string>
<key>PayloadType</key>
<string>com.apple.TextEdit</string>
<key>PayloadUUID</key>
<string>66EA78E8-4D59-4E6E-89D1-77E98ADC560F</string>
<key>PayloadVersion</key>
<integer>20221004</integer>
<key>PlainTextEncoding</key>
<integer>4</integer>
<key>PlainTextEncodingForWrite</key>
<integer>4</integer>
<key>PreserveWhitespace</key>
<true/>
<key>SCheckGrammarWithSpelling</key>
<false/>
<key>SDataDetectors</key>
<false/>
<key>SSmartLinks</key>
<false/>
<key>ShowRuler</key>
<true/>
<key>SmartCopyPaste</key>
<false/>
<key>SmartDashes</key>
<false/>
<key>SmartLinks</key>
<false/>
<key>SmartQuotes</key>
<false/>
<key>SmartSubstitutionsEnabledInRichTextOnly</key>
<false/>
<key>TextReplacement</key>
<true/>
<key>UseEmbeddedCSS</key>
<false/>
<key>UseInlineCSS</key>
<true/>
<key>WidthInChars</key>
<integer>72</integer>
<key>author</key>
<string></string>
<key>company</key>
<string></string>
<key>copyright</key>
<string>ご相談ください(Ask)</string>
</dict>
</array>
<key>PayloadDescription</key>
<string>com.apple.TextEdit関連の設定です</string>
<key>PayloadDisplayName</key>
<string>com.apple.TextEdit</string>
<key>PayloadIdentifier</key>
<string>com.apple.TextEdit.E6E14777-11E7-41B9-8B87-34B1BF8851A3</string>
<key>PayloadOrganization</key>
<string>com.cocolog-nifty.quicktimer</string>
<key>PayloadRemovalDisallowed</key>
<false/>
<key>PayloadScope</key>
<string>User</string>
<key>PayloadType</key>
<string>Configuration</string>
<key>PayloadUUID</key>
<string>E6E14777-11E7-41B9-8B87-34B1BF8851A3</string>
<key>PayloadVersion</key>
<integer>20221004</integer>
<key>TargetDeviceType</key>
<integer>5</integer>
</dict>
</plist>