Jump to content

Subject22

Member
  • Posts

    171
  • Joined

  • Last visited

  • Days Won

    10

Posts posted by Subject22

  1. 1. I think it is up to the user whether he wants or not to move/copy files within his Dropbox account, much like what happens in Finder itself; anyway, thank you for your feedback.

    2. The current link, even for images, is a direct link that you can use in this forum for example. I use it all the time. What kind of link are you getting? Did you change the workflow?

     

    OK, obviously that's completely up to you :-) Would you mind giving me a hand modifying the workflow to behave the way I want it to? If you could perhaps point me in the right direction it could save me some time :-)

     

    You're completely right, it does! I have no idea how I got confused over that one. Must have thought I was doing one thing when I was in fact doing another. Sorry about that!

  2. It doesn’t make sense indeed. However it can make things slower having to scan the Dropbox folder for a file. At least you won’t have the same file in the Public folder. :)

     

    Huh? Couldn't you just inspect the file path of each file passed in? If it contains /Dropbox then it's in the Dropbox folder already and you don't need to move or copy it. No scanning involved.

     

    EDIT: One other thing. What do you think about having the workflow provide direct links for image files? I never want this sort of page, I want this kind, to allow embedding in forums like these (and even for normal sharing, I'd rather distribute the direct link). The only difference between the former and the latter links is that "www.dropbox" becomes "dl.dropboxusercontent".

  3. I think Alfred initializes the alfred_script(q) handler using whatever is passed to the NSAppleScript object.

     

    So Alfred essentially replaces all instances of "q" with the string passed in from OS X? Is this something that happens as a sort of textual preprocessing?

     

    As for iterating over a list of files, I can't think of a better method (with AppleScript). AppleScript is great for a lot of things, but it's features/syntax are kind of odd  B).

     

    OK, guess I've just been spoiled by Python's string handling routines :P

  4. Seems like the workflow actually does preview the results once you add a space to the end of your query, and that hitting return simply does this for you. Why is the terminating space character required?

     

    In answer to my own question, as I dislike having to enter a space character to have the workflow display any computed results I found a simple tweak to change this behaviour. Disclaimer: I've never so much as glanced at php before and the script is quite long so for all I know this will break the workflow in some way (though it seems to be working fine so far). Change line 130 in units_v2.php in the following manner.

    From:

    $this->spaced = (substr($q,-1)==' ');
    

    To:

    $this->spaced = true; #(substr($q,-1)==' ');
    

    Also, designandsuch, calculations involving femtometres and picometres give a formula not found error, though based on your comments in the script I'm sure you're aware of this. It's pretty easy to add support for them, so for anyone who's keen just insert this code at around line 412. It's well laid out and easy to understand.

    $pm_base = function($pm=0  ){ return $pm  / 1000000000000;};    // m  = pm / 10000000000
    $base_pm = function($m=0  ){ return $m  * 1000000000000;};      // pm  = m * 10000000000
    $fm_base = function($fm=0  ){ return $fm  / 1000000000000000;}; // m  = fm / 1000000000000000
    $base_fm = function($m=0  ){ return $m  * 1000000000000000;};   // fm  = m * 1000000000000000
    

    If you're still developing this then one feature that could be handy would be thousands separators (i.e.: 1,000 rather than 1000).

  5. Awesome, thanks to you all for clearing that up. I'm sort of picking up AppleScript as I go, learning bits and pieces as I need them and thus far I haven't needed to really know anything about handlers. Now I'm unclear as to how the 'query' variable (or whatever it happens to be named) makes its way into the script. alfred_script() is a function ("handler" in AppleScript parlance) but the variable passed to it appears to be uninitialised. If I did this in some other language it wouldn't work:

    def someFunction(someVariable):
        print "I'm doing something"
    
    someFunction(query) # query hasn't been initialised, so how can someFunction access it?

    Additionally, since the 'query' variable is passed to the alfred_script() handler how does the rest of the script end up having access to it? Why isn't this analogous to the following (incorrect) code?

    def someFunction(someVariable):
        print "I'm doing something"
    
    someFunction(query)
    
    print query # Again, the variable hasn't been initialised, how does print access it?

    EDIT: One other thing, is there some standard method of iterating over files passed into an Applescript with Alfred? The script gets a tab delimited string, so what's the neatest way of iterating over that string, converting each file path to a file that Applescript can work with? This is what I'm currently using and it's kind of nasty.

    set AppleScript's text item delimiters to " "
    set filePaths to text items of q
    
    repeat with filepath in filePaths
        set theFile to POSIX file filepath as alias
        #do stuff
    end repeat
  6. I'm trying to make a workflow which when invoked by a hotkey will hide the extensions of the files currently selected in OS X but I'm not too sure how Alfred's "Selection in OS X" hotkey action panel works and there seems to be dearth of documentation about it. What exactly does this action panel pass to a script (e.g.: a string)? What is the normal way of receiving this input in a script (e.g.: with "{query}" or with something else)? Does this behaviour vary between different types of scripts (i.e.: bash, AppleScript etc.)?

     

    I set up a simple workflow and found that return "{query}" posted a notification as expected when run from the Run Script action panel (with all delimiters unchecked) but not when run from the Run NSApplescript action panel (with the alfred_script(q) wrapper). Why is this? Is there anything else I should know about the "Selection in OS X" hotkey action panel?

  7. Please post a link to this workflow. I am not interested in the alternative, I don't want to type "w en" as the prefix rather than just "w".

     

    Thanks in advance.

     

    A bit of a late reply, but it really is excruciatingly easy to change the behaviour of that alternative workflow so that you don't need to type the Wikipedia language code. There are instructions in the first post of the thread and in the script filter itself. Just add your preferred language code to the last line of the filter. For English the line would look like this: python w.py en {query}

  8. I agree with you. This workflow is the best Alfred unit converter I've come across yet :D It interprets input sensibly and runs quickly :-)

     

     

    i would also like to just type it in without having to hit enter and get the results.

     

    Agreed. designandsuch, is there a reason why the workflow requires the user to hit enter to get results? Why not preview the result of all possible matching calculations? I often just want to look up a conversion quickly and hitting enter is an additional key press. Besides, sometimes I might be interested in the other outputs too.

    One typo: Line 727 of units_v2.php should use the currency code "nzd" not "znd".

     

    EDIT: Seems like the workflow actually does preview the results once you add a space to the end of your query, and that hitting return simply does this for you. Why is the terminating space character required?

  9. It'd be neat to be able to use the mini player to add the currently playing song to a particular playlist. I'm sure it'd be possible to create a workflow to do this, but I wouldn't know how to go about making a script filter (I intend to remedy that when I next have time :D), and it seems like something that might be more appropriate as a built-in feature. Just a thought :-)

  10. Ensure you have "random" switched off in iTunes, and set Alfred's iTunes Mini Player preferences (under Features > iTunes > Advanced) to use the Alfred playlist to ensure predictability.

     

    Those two things did it. That said, I actually really really like being able to add songs to Up Next with Alfred like that, so if there was a way of accessing both functionalities natively I'd be rapt :-) In the meantime, I'll see what I can dig up in the way of workflows. Thanks Vero!

  11. Yeah, but that doesn't cause the album to play, just that one song, after which iTunes returns to the previously playing content. Hitting return seems to have the same effect as manually adding the selected song to Up Next and skipping whatever track's currently playing.

  12. Is it possible to use the mini player to play an album? When I search for an album and hit return it opens that album rather than playing it (modifier keys don't make a difference either). I thought I'd check to see if there was a built in function before I put together a workflow.

×
×
  • Create New...