Acidham Posted April 26, 2019 Posted April 26, 2019 (edited) Dependencies Default App uses duti to change assigned apps. You need to install duti first before you execute the Alfred Workflow brew install duti Usage dapp ext 1. ext you can type any extension, the workflow will ask for confirmation to change the assigned app 2. Choose one of the Apps to assign the extension to. Download on Git https://github.com/Acidham/alfred-default-app Edited April 26, 2019 by Acidham xilopaint and deanishe 2
Acidham Posted April 26, 2019 Author Posted April 26, 2019 (edited) Finally fixed a bug that joined the code and added OneUpdater! Edited April 26, 2019 by Acidham vitor 1
xilopaint Posted April 27, 2019 Posted April 27, 2019 Why don't you use a Script Filter for the second step?
Acidham Posted April 27, 2019 Author Posted April 27, 2019 7 hours ago, xilopaint said: Why don't you use a Script Filter for the second step? Because it was too late yesterday. 😂 Version 1.0 is now available and ported to Python 🤗 I hope there is no new bug 🤨 ... let me know how it goes...
deanishe Posted April 27, 2019 Posted April 27, 2019 3 hours ago, Acidham said: ported to Python Where did you get Alfred.py from? That's some really old-school looking code.
Acidham Posted April 27, 2019 Author Posted April 27, 2019 4 minutes ago, deanishe said: Where did you get Alfred.py from? That's some really old-school looking code. Thanks 😢 I created for my own once I started with Python&Alfred. Since it does the Job I never touched it...even if I am not sure if I ever can write high-polished code 😕
deanishe Posted April 27, 2019 Posted April 27, 2019 (edited) 19 minutes ago, Acidham said: Thanks 😢 I didn't say, and certainly didn't mean, "bad". I just asked because of the old-style classes. I think most Python programmers these days don't even know they exist. There's absolutely nothing wrong with the code. The style is just kinda old-school (old-style classes, camelCase). Edited April 27, 2019 by deanishe
Acidham Posted April 27, 2019 Author Posted April 27, 2019 Just now, deanishe said: I just asked because of the old-style classes. I think most Python programmers these days don't even know they exist. 😳 really? can you point me to newer-style format or at least what old-style is in my class? Now you made me curious ...and, no worries, every feedback is welcome hand helps...thx for that!
deanishe Posted April 27, 2019 Posted April 27, 2019 (edited) 25 minutes ago, Acidham said: can you point me to newer-style format or at least what old-style is in my class? New-style classes inherit from object, e.g. class Item(object):. I don't remember what difference it actually makes (other than Python 3 doesn't support old-style classes), just that in about 2002 they said "you should use new-style classes from now on." Here are the technical details. Similarly, PEP 8, the official Python style guide came out in 2001 and said that we should all use PascalCase for class names and snake_case for everything else. So you tend to only see camelCase in very old code (like plistlib.readPlist from the standard library, or the Twisted library, which has also been around forever). Edited April 27, 2019 by deanishe
Acidham Posted April 27, 2019 Author Posted April 27, 2019 Ok got it, but this is mostly based coincidences. For class Item(object) I did not saw the need therefore I ignored it I started with snake_case but then I felt a bit lost aka I was not able to see the differences between variables and methods so I switch to PascalCase. But now I am on the way to switch to snake_case. Furthermore PyCharm always notified me about my old style 😕 Thank you for your pointers! I made now the decision to take care of the new_style in the future!
Dave_H Posted May 1, 2019 Posted May 1, 2019 Hey, It doesn't seem to work by my side. Entering dapp just returns a contact that I've saved as such, but entering a file extension ater it does nothing. Am I missing a step ?
Acidham Posted May 1, 2019 Author Posted May 1, 2019 (edited) Did you install duti ? Any WF debug Info when executing ? Edited May 1, 2019 by Acidham
andy4222 Posted June 7, 2023 Posted June 7, 2023 (edited) @Acidham `operation not permitted: ./py3.sh` is what I get when trigger the workflow and typing in the extension name. I checked that py3.sh has execute perms duti is installed Edited June 7, 2023 by andy4222
Acidham Posted June 8, 2023 Author Posted June 8, 2023 py3.sh is checking for the latest version of python3. You can easily comment that out for time being in the workflow steps: e.g. # ./py3.sh ext.py "$1" python3 ext.py "$1" Can you also send me the python3 version you are using?
vitor Posted June 8, 2023 Posted June 8, 2023 @Acidham You’re probably better off just removing the file and using /usr/bin/python3 directly, no need for the middleman (er, middlescript?) Or even just using External Script directly. I have confirmed both work in Ventura.
Acidham Posted June 8, 2023 Author Posted June 8, 2023 (edited) @vitor yep that is the plan to get rid of py3.sh. Meanwhile, it should work with python3. But first I wanted to get confirmation. Edited June 8, 2023 by Acidham vitor 1
andy4222 Posted June 8, 2023 Posted June 8, 2023 @AcidhamTried changing it to python3 and it works on Ventura. Had to change all 3 script filters.
Acidham Posted June 8, 2023 Author Posted June 8, 2023 (edited) Yes, all the three, but it was just for debugging. I released a new version and removed `py3.sh` completely. https://github.com/Acidham/alfred-default-app/releases/tag/v1.4.2 Edited June 8, 2023 by Acidham
Faris Najem Posted November 21, 2023 Posted November 21, 2023 Hi, I used This so nice workflow for months, but now it doesn't work in My MacBook pro (m1pro, Sonoma os). Any help, please? This is the debug report: [19:47:30.080] Default App[Script Filter] Processing complete [19:47:30.085] Default App[Script Filter] Passing output 'PDF Studio Viewer 2023' to Arg and Vars [19:47:30.087] Default App[Arg and Vars] Processing complete [19:47:30.088] Default App[Arg and Vars] Passing output 'PDF Studio Viewer 2023=.pdf' to Run Script [19:47:30.246] ERROR: Default App[Run Script] Traceback (most recent call last): File "/Users/farisal-mawwashi/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.60FD7BEC-4973-4B4C-A1F1-6638DA93FADC/change.py", line 37, in <module> resp = duti(app_id, ext) ^^^^^^^^^^^^^^^^^ File "/Users/farisal-mawwashi/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.60FD7BEC-4973-4B4C-A1F1-6638DA93FADC/change.py", line 28, in duti resp = os.system(f"{d_path} -s " + appid + " " + ext + " all") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: embedded null byte [19:47:30.260] Default App[Run Script] Processing complete [19:47:30.261] Default App[Run Script] Passing output '' to Debug [19:47:30.262] Default App[Debug] '', { ext = ".pdf" } [19:47:30.264] Default App[Debug] Processing complete [19:47:30.265] Default App[Debug] Passing output '' to Post Notification
Acidham Posted November 21, 2023 Author Posted November 21, 2023 Hi @Faris Najem I changed handling of duti app dependency. Please try and let me know: https://github.com/Acidham/alfred-default-app/releases/tag/v1.4.3
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now