I managed this issue by deleting the quarantine attribute: set aPath to "some path" Your code is working well here but returns a quarantine error at the second attempt to open the file. Hi interesting! I could use this in a couple of my scripts generating PDFs which I prefer to open in Preview instead of Acrobat, the default on my system (Monterey 12.6.3). Compose an xattr command similar to the one above using the hex string.Change the default-app of an applicable file to the desired app manually.objective c - How to set default application for specific file types in Mac OS X? - Stack Overflow.applescript - Change the default application (for a file extension) via script/command line? - Ask Different.macos - Change file association in terminal? - Ask Different.It ain’t pretty, but it works well enough and is way better than having to do the job via the macOS UI. Set noMsgShow to my badFileMsg(wpf, wpfPath, folderProcess, noMsgShow) If name of wpf is not in noProcessList then If fileKind does not contain "WordPerfect" then If fileKind does not contain "Word Perfect fics" then If (versionByte is «data rdat00») then - WP5.xĮlse - WPDOS 6+ and miscellaneous others If (versionByte is «data rdat00») or (versionByte is «data rdat02») or (versionByte is «data rdat03») or (versionByte is «data rdat04») or (versionByte is «data rdat0A») or (versionByte is «data rdat2C») then If (versionByte is «data rdat02») then - Mac WP 2.1 If (fileTypeByte is «data rdat2C») then - WPMac if not fileTypeByte is «data rdat16» then - not WP Graphic Set versionByte to (read wpf from 11 for 1 as data) Set fileTypeByte to (read wpf from 10 for 1 as data) Set hasHeader to ((read wpf for 4 as data) is «data rdatFF575043») The code is incompetent because I don’t know how to write anything better, unfortunately, but it seems to work. It’s possible that all you need is the string that begins com.agileTortoise, etc, and not any hex string. The only line you really need is the one that runs a shell script with xattr. Here is the routine I use, which is far more elaborate than you need, because it first tests the file to determine which version of WordPerfect created the file so that it can apply the correct attribute, but you’ll get the idea. Instead, for a script that I use to add extended attributes to old WordPerfect files, I used the hex string of the text of the attribute that I found in other files that already had the correct attribute. I’ve never found a straightforward method. I’ve been Googling and so far haven’t found a straightforward way to write an xattr value. My default text editor is BBEdit, and I’ve obviously set the above file to Drafts. (Not a file type / extension – although I’d like to learn how to do that too.) Does anyone know how to script changing the default application for a specific file?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |