Jump to content
RodgerWW

Edit scripts externally with auto update

Recommended Posts

Would it be possible to have the ability to edit scripts in workflows in an editor of our choice?

 

Perhaps having one added option in Alfred's prefs to select an 'editor' ... then, when we double click on the script in a workflow, having a button (perhaps beside "open workflow folder") that says "Edit in External Editor."

 

This would leave the default alone for quick and dirty stuff, yet allow others to load/modify the scripting in any of the multitude of editors out there that have all the color coding, command references and all that jive.

 

I for one find it a 'tiny' but of a pain having to resize that window every time just to find a line I need to reference. Also, being VERY new to scripts and such, I DO tend to find the color coding helpful at times.

Share this post


Link to post
Share on other sites

Would it be possible to have the ability to edit scripts in workflows in an editor of our choice?

 

Perhaps having one added option in Alfred's prefs to select an 'editor' ... then, when we double click on the script in a workflow, having a button (perhaps beside "open workflow folder") that says "Edit in External Editor."

 

This would leave the default alone for quick and dirty stuff, yet allow others to load/modify the scripting in any of the multitude of editors out there that have all the color coding, command references and all that jive.

 

I for one find it a 'tiny' but of a pain having to resize that window every time just to find a line I need to reference. Also, being VERY new to scripts and such, I DO tend to find the color coding helpful at times.

 

Alfred provides the script input area for you to enter your scripts but you aren't actually REQUIRED to put yours code there. For instance, some of my workflows simply create external php files that do all the work, edit those in whatever editor I choose, and just have the workflow execute those. This could be done with all languages. The only exception I could think of would be NSAppleScript. All others you could simply use bash to execute another script.

Share this post


Link to post
Share on other sites

Ultimately, the question is one of convenience and discoverability:

 

Currently, you are forced to choose between two awkward alternatives:

  • Either: deal with the limited editing features inside of Alfred or inconveniently copy code back and forth been Alfred and an external editor.
  • Or: by and large bypass Alfred's GUI and invoke editing of external file's via the Finder.

The latter technique is not even obvious to newcomers (right-click on workflow in list, select 'Show Finder',  create file in that folder).

 

A compromise would be to integrate a workflow's external files into Alfred's GUI by

  • listing external files and offering to edit them with their respective editors
  • offering to create new external files

Share this post


Link to post
Share on other sites

The latter technique is not even obvious to newcomers (right-click on workflow in list, select 'Show Finder',  create file in that folder).

 

In each of the sheets where you would actually enter script code (run script item and script filters), there is a button to open the workflow folder.

Share this post


Link to post
Share on other sites

Thanks, David - hadn't actually noticed - that's a promising start:

I can see two approaches - which are not mutually exclusive:

 

Approach 1:

  • Have Alfred scan the code that was directly entered into a workflow step and match it against files in the workflow folder (other than the default files). Offer a button for each matching file (typically, there will be only *1*), or perhaps a pop-up list if there are too many. Clicking a button or selecting a list item would then open that file externally with its registered editor.
  • Complementarily, offer the same list of matching files when control-clicking a workflow step from the outside (via a context menu).

 

Approach 2:

  • Inside a script-related workflow step, have Alfred offer the basic choice between inline code and a reference to an external file. In the latter case, restrict editing to a single command line that invokes the external file, and provide a button to open that file with its registered editor. (Conceivably, a custom language (interpreter) line could be added there as well - accompanied by a warning that such a workflow won't be portable.)

To allow users to stay within Alfred's GUI in most cases, it would also be nice to be able to *create* an external file from within a script-related workflow step / its context menu.

The appropriate filename extension could be derived from the chosen language (interpreter).

Share this post


Link to post
Share on other sites

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...