Jump to content

GuiB

Member
  • Posts

    366
  • Joined

  • Last visited

  • Days Won

    19

Everything posted by GuiB

  1. @christian_alares, I just thought I should give a more complete script in case you want a script that work with Alfred prefix command to run a terminal command also. I mean, if you want to do something else than using the Open Terminal Here command. Here is a script that would work for both way of actioning the command: on alfred_script(q) if (text 1 thru 2 of q) is equal to "cd" then do shell script "open -a Hyper " & text 4 thru -1 of q else do shell script "open -a Hyper ~" delay 1 tell application "System Events" to keystroke q & return end if end alfred_script As @vitor said, this is not the best way since we need to insert a delay command for the keystrokes (the "delay 1" inside here), but seems to be quite great on my side (you may need to play with the delay time if there's a problem on your side). Also, I've use "open -a Hyper ~" in the second method so a new window is opened without using the keystroke method with delay. You may want to change the default path if you want (this would set you in your home directory, but change the "~" to something else if you prefer) --- Update I mention that this is not an optimal way, but I mean that mainly for the second method (when sending a command to Hyper). This is still speedy for the "Open Terminal Here" command and is the same as my first script above
  2. As @vitor said, Hyper is not scriptable (there's no applescript dictionary to make it works reliably without keystrokes). However, as a workaround, Hyper is able to open folder and file and it would set it's path to that folder. So, here is what I would do to make it reliable and fast: on alfred_script(q) do shell script "open -a Hyper " & text 4 thru -1 of q end alfred_script Just copy & paste this script in the custom script section in Features > Terminal / Shell of Alfred preferences and this should work Hope this helps!
  3. Don't know if this is related to your error @hfr, but on my side I needed to modify the script inside Notificator.app to make it works since I got an error "Unexpected identifier 'i'" ... So maybe @vitor this would be something to have a look. I changed in line 6 the keyword "let" to "var" and now everything works great. Changed from : for (let i = 0; i < argc; i++) { argv.push(ObjC.unwrap(args.objectAtIndex(i))) } to: for (var i = 0; i < argc; i++) { argv.push(ObjC.unwrap(args.objectAtIndex(i))) } Look in the attachment for the error message I got in case there's a better solution to this problem! Beside, thanks @vitor for the workflow!
  4. @Andrew sorry for the delay! I've tested with the updated Alfred pre-release and I confirm that now the guides stay while holding the options key even if the object move past the cursor. So thanks again and I think you've got the right balance between feature usability and simplicity! Great work!
  5. @vitor I understand what you mean and yes the way you describe it makes sense that it's faster to align with the way it's now implemented. However, I think we just have different workflow for that, I like to align the object directly when it is created instead of aligning everything when all the objects are on the canvas. As for showing the guides when the objects align, I'm completely with you and don't think this is really needed to be implemented for Alfred, I was mainly thinking of a way to show the guides when we move an object with the arrow keys. I was thinking that maybe the guides could pop for 1 second or something like that when the moved object align with another... but I know this would take more time coding and I'm not sure the extra work would be that much worth it. @Andrew I like your idea and was also thinking that maybe a faster way to toggle the feature would make it for me, but was wondering what would be the best and fastest way without changing the interface and, now that you say it, I think that your solution would be the best to suit both way of building a workflow (my way and vitor's way). So, thanks for having another look at it! Also, to give you some more ideas... maybe this is part of your tweaks for the next build, but I thought that to make it works with the move by arrow keys, the option key could show de guides when the cursor is over an object (like it is now), but it could also show the guides of an object when it is selected. I mean, the user click on an object, this object is now selected/highlighted, now the option key would show the guides of this object even if the cursor is moved away from it (so we keep the guides possible when moving with the arrows). However, if the cursor is now moved over another object while holding the option key, then the object with the cursor above gets the attention and the guides are showed for it. Again, I'm just giving some ideas --- Update --- Just went to see if there was an update to Alfred and there was one... so I just updated it and like it better this way! Thanks! Now I would just say, what do you think of the idea to show the guides on the selected object to allow to show it when we move with the arrows? I understand this could give more trouble than it worth (ex: what to do if multiple objects are selected ? and then if the mouse is over an object, show the guides of the selected object(s) or just the one with the mouse above ?), so I'll let you decide if this is wanted or not since it may be enough as it is now.
  6. Hi @Andrew, I like this new feature, but I find it a little too much intrusive at the moment... what about making the guidelines appear when we click and hold an object instead of directly when we are hovering it ? I think this is how most applications with draggable components work. Or some applications show the guidelines when two components move into an aligned position. With this last method we could see that we are aligned even when we move an object with the arrows... Nevertheless, I like the feature, just giving some ideas !
  7. Hi @Andrew, thanks for the update ! At first try this is working great! So thanks a lot ! Also, I saw the new snippet workflow trigger, this would be a very great addition! Thanks for your work
  8. Hi @Andrew, thanks for investigating the issue! As for my use case, I wanted to develop a workflow to find and replace text in the macOS selection using a series of 2 queries: the first one to determine what to find in the text and the second one to what to replace with. I wanted to have the Find & Replace script to be useful for multiple case, so for example to replace a word with another one or something more relating to coding, for example to convert tabs to the number of spaces wanted. Ex: - Replace query1("hello") with query2("hi") - Replace query1("\t") with query2(" ") -> Here replace tabs with 2 spaces - Replace query1(" ") with query2("\t") -> Here replace 4 spaces with a tab - Replace query1("\n") with query2(" ") -> Here replace newline with 1 spaces ... So, I would like the query to really not be trimmed (left or right trailing spaces) if that's possible Thanks again!
  9. Thanks deanishe! Yes, this is what I thought that it must be a bug because of it's inconsistency and because it doesn't act as the "keyword input", but thought that it could be a feature as well to make the input cleaner to the user script. However, if it's a feature I think it should be possible to bypass it by the workflow developper in case it is not wanted. Maybe a checkbox in the Scipt Filter input window to specify if we want the query to be trimmed or not would be great. Thanks for your help!
  10. Anyone has any idea ? Or maybe I didn't post to the right section and a moderator could move my question to the "Workflow Help & Questions" section or the "Bug Reports" section if you think it better fit, thanks a lot!
  11. I'm not sure if this is a bug, but I'm trying to get a query with multiple spaces in it and "as is" (meaning that I want the the left and right trailing spaces). Right now, Alfred trim the spaces to only one if multiple are inserted at the beginning or end of a query. This is working if using a "keyword input" so it seems to be a problem with the script filter input method. I've tried using the "with input as argv" or "with input as {query}" and both output the same. Here is my test script for the Script Filter input (using Python): import sys, json query = sys.argv[1] #query = """{query}""" # uncomment if trying with "with input as {query}" data = { 'items': [{ 'title': "Script Filter: The query is '" + query + "'", 'arg': query }] } sys.stdout.write(json.dumps(data)) Here is a screencast to show the problem: https://NoFile.io/f/4334MTCdPQ5/Alfred-SpaceInQuery-Problem.mov Is this a bug or there's something I'm not doing well or it's just not possible with the Script Filter input ? Thanks!
  12. It would be great to add the option to use a monospaced font with Large Type. I like to use Large Type to show the output of a shell script and a monospaced font would help to keep things aligned. For example, at the moment I want to pop a calendar with columns and rows by using gcalcli and the ouput that I get is not readable since all the columns are not aligned. I think the best option would be to have a global setting in the preference menu and to have another option in the Large Type workfow item that would override the global setting. This way, workflows that need the option can use it and the others will keep using the user preference. Or this could be an option with a selection of multiple fonts (with some monospaced fonts included) that Large Type can use... Right now I can output to a file and call qlmanage to pop the QuickLook preview, but I find it quite slower and I can't close it with the keyboard. Or maybe this will be possible with Alfred 3 or there will be more output options !? Looking forward to what you come out for Alfred 3 !! Thanks!
×
×
  • Create New...