 	func saveClipboardToFile(_ filePath: String?) {
 		let pasteboard = NSPasteboard.general
 		if let uti = pasteboard.pasteboardItems?[0].types[0] {
-			var output = false
-			var typeIdx = -1
-			if let ostype = UTTypeCopyPreferredTagWithClass(uti as CFString, kUTTagClassOSType)?.takeRetainedValue() as String? {
-				if let tempIdx = types.index(of: ostype) {
-					output = true
-					typeIdx = tempIdx
-				}
-			} else {
-				if uti.rawValue == "dyn.agk8u" {
-					// for theme
-					output = true
-					typeIdx = 8
-				}
-			}
-			if output == true && typeIdx > -1 {
+			if let typeIdx = types.index(of: uti.rawValue) {
 				typeArrayController.setSelectionIndex(typeIdx)
 				let xmlStr = pasteboard.string(forType: uti)
 				if let path = filePath {

		do {
			if let path = filePath {
				let xmlStr = try String(contentsOfFile: path, encoding: String.Encoding.utf8)
				if let ostype = detectOstypeFromXmlStr(xmlStr) {
					let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassOSType, ostype as CFString, kUTTypeData)?.takeRetainedValue()
					if var type = uti as String? {
						if type == "dyn.ah62d4rv4gk8u" {
							// for theme
							type = "dyn.agk8u"
						}
						pasteboard.declareTypes([NSPasteboard.PasteboardType(rawValue: type)], owner: nil)
						if pasteboard.setString(xmlStr as String, forType: NSPasteboard.PasteboardType(rawValue: type)) {
							if let idx = types.index(of: ostype) {
								showMsg(String(format: NSLocalizedString("copiedToClipboard", comment: "%s definition copied to the clipboard."), typeLabels[idx]))
							}
						} else {
							showMsg(NSLocalizedString("failedToSetClipboard", comment: "Failed to update the clipboard."))
						}
					}
				}
			}

		NSLocalizedString("layout12", comment: "Layout (v12+)"),
		NSLocalizedString("customFunction", comment: "Custom Function"),
		NSLocalizedString("valueList", comment: "Value List"),
		NSLocalizedString("theme", comment: "Theme"),
	]

	func applicationDidFinishLaunching(_ aNotification: Notification) {
