Jump to content
Acidham

Change Default App for filetype

Recommended Posts

Posted (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 by Acidham

Share this post


Link to post
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...

Share this post


Link to post
3 hours ago, Acidham said:

ported to Python

 

Where did you get Alfred.py from? That's some really old-school looking code.

Share this post


Link to post
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 😕

 

Share this post


Link to post
Posted (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 by deanishe

Share this post


Link to post
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!

Share this post


Link to post
Posted (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 by deanishe

Share this post


Link to post

Ok got it, but this is mostly based coincidences. 

 

For class Item(object) I did not saw the need therefore I ignored it :D

 

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!

Share this post


Link to post

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 ?

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...