Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by Subject22

  1. Off the top of my head, opening the AppleScript in the workflow folder and changing every instance of "Chrome" to "Safari" and every instance of "Safari" to "Chrome" ought to work. Try it anyway and if it doesn't do what you want let me know and I'll take a look when I can :-)
  2. I haven't read through all that exhaustively, but it seems to me that you're running the script and *then* opening Evernote, and you mentioned that Evernote needs to be open in order for the script to run. Have you tried moving the code for opening Evernote to the start of the script?
  3. I suspect it has something to do with the thread being moved to this sub-forum. EDIT: Wait!! I lie! I can change it from the mobile site! I swear I wasn't able to do that from the desktop version. But perhaps I just missed it at the time :-)
  4. I tried :-/ Seems I'm no longer able to change it.
  5. I've modified my version and can't check the original at the moment, but if I recall correctly there are two action panels in the workflow each linked to a different hotkey. One provides the long 'direct' link (which, frustratingly, expires after 4 hours), and the other provides the short 'share' link. Just set a hotkey for the short link and you should be fine :-)
  6. I left automatic trash emptying out of the standard version to avoid accidental deletion, but if you guys understand the risk and are happier this way that's fine by me :-)
  7. No problem :-) You know about Alfred's built in feature for emptying the trash don't you? The keyword emptytrash will do that for you :-) But if you want this workflow to automatically empty the trash after clearing your downloads folder, find it in Alfred, double click the Run Script action and paste the following code on a new line under the existing code: osascript -e 'tell app "Finder" to empty'
  8. That sounds perfectly reasonable to me. It was an honest mistake on my part :-) I've got a workaround, fortunately (thanks to Carlos-Sz), I just thought it was peculiar that it worked once the script was cached, and if it was called from outside Aflred (which I suppose includes the case where it is cached). Thanks for looking into this anyway!
  9. Sure. Sorry, I thought that's what I'd done, given that things seemed to have gone quiet in that thread :-) In future you'd rather I wait a bit longer? Ugh, maybe it's a good thing this is being closed. I just noticed that spelling mistake in the title. It'll bug me every time I look at it now
  10. Yes, it functions as expected when saved in .app format (although it doesn't appear to pass anything through to Alfred's notification action).
  11. Carlos-Sz's version uses that exact method, if I recall correctly. But that still fails when run directly from Alfred, it has to be saved as a .scpt in the workflow's directory and called with a bash script. EDIT: I lie. He tested a similar method, but neither way works properly when run from within Alfred. Both work fine from AppleScript Editor. This isn't really relevant, but we might as well be looking at the same thing. Here's the version of the code I'm using at the moment. I got rid of references to window 1 and started using front window instead, along with some other slight improvements. if application "Safari" is running then tell application "Safari" try set theURL to URL of current tab of front window set pageName to name of current tab of front window on error return "There are no pages open in Safari at the moment" end try end tell tell application "Google Chrome" activate if URL of active tab of front window is not theURL then if (count of windows) is 0 then make new window else make new tab at end of tabs of front window end if set URL of active tab of front window to theURL else return "The current Safari tab is already open in Chrome" end if end tell # Enable the following line to post notifications after sending URLs to Chrome --return "Opening '" & pageName & "' in Chrome" else return "Safari is not open at the moment" end if
  12. I would not have the first idea how to go about that, but I'm always keen to learn I might give it a try when I have more time to spare. My current project is a simulation tool for the RIP protocol. Time consuming, but fun Thanks for your help :-)
  13. Perhaps I haven't understood you correctly, but how would that help? The problem is that when Safari is not open the script fails to respect the if statement, causing Safari to launch. It ought to just return "Safari is not open at the moment" - which it does when the script is run from AppleScript Editor. I tried your suggestion, just in case. No luck :-/ If Safari's not open when I invoke the workflow it still launches, even though it should just post a notification. EDIT: Whoops. I thought I was in a different thread D: Excuse me while I adjust my reply :-) Done.
  14. Got it :-) Is there any way I could override Alfred's default behaviour when opening URLs? i.e.: Rather than handing the URL over to OSX to open, Alfred would pass it to a custom AppleScript.
  15. Hm. I did not know that. Do you have any desire to modify Alfred to work around this issue with OSX? Understandable if you don't :-)
  16. When I ask Alfred to open a URL (for example, from a standard search which returned bookmarks, a workflow which returned a URL, or a manually typed URL), he sometimes opens the URL in a new window rather than a new tab. I seem to remember the same thing happening with V1, so it's a long-standing issue. I've tried to find ways to reproduce the problem reliably, but I've come up short. All I can say is that it happens frequently (a few times a day) and that I haven't been able to discern a pattern. If the problem occurs (i.e.: I tell Alfred to open a URL and he opens it in a new window rather than a new tab) then it will keep happening with subsequent URLs until I open a new tab manually. That said, Alfred does seem to fix himself after a varying period of time. Sorry to be vague on details, I wouldn't have posted it until I had something more concrete but it's been such a long time, and it's been really annoying me. I did a quick google search and found a reference to a Get Satisfaction page which seemed to be relevant, but annoyingly I can't get it to load (asterisk added to prevent the link from being shrunk). h*ttp://getsatisfaction.com/alfredapp/topics/alfred_not_putting_web_search_in_a_new_tab_in_safari_but_does_in_chrome/edit+alfred+opening+url+in+new+window&cd=2&hl=en&ct=clnk&gl=nz Details OS X 10.8.3 Safari 6.0.3 Alfred 2.0.2 (178)
  17. Just set a different trigger for the workflow in Alfred's preferences. Alfred Preferences > Workflows > Dropbox Quick Links then double click on one of the Hotkey tiles and set your own shortcut.
  18. Handy workflow! I made a context aware equivalent triggered by a hotkey. If you're in Finder when you use it it'll open the current directory in Terminal, if you're in Terminal when you use it it'll open the current directory in Finder. I didn't bother including iTerm as I never use it. I'm sure that anyone who's using this kind of workflow will be more than capable of adding support for iTerm, should they need it :-) I'd appreciate any critiques of the AppleScript code I wrote. It's fairly messy, but anything neater (in terms of code) was less robust in actual use. Download: Directory Switcher
  19. Oh that is bizarre. The file that that link refers to on my local machine is correct. The file that that link refers to on my dropbox account online is correct. But actually clicking that link serves up an old version of the file. Try this: http://d.pr/f/Q7vP. Link in the first post now works again.
  20. Things have probably run as far as they're going to in this thread, so I thought I'd post it as a bug report. Here's a quick summary: An AppleScript I wrote does not behave as expected when run from Alfred's Run Script action. The same script runs as expected from AppleScript Editor. The script runs as expected via Alfred's NSApplescript action once it has been cached in memory (i.e.: the initial run with caching fails, but all subsequent runs behave as expected, until Alfred is restarted). Saving the script to the workflow's directory and calling it with a bash script via Alfred's Run Script action seems to be the best workaround. See the linked thread for more details and examples.
  21. That's a fair point. I've updated the script behind the current link. Just download a new copy, reimport it and let me know if it does what you want :-) I also added logic to see if the current Safari tab is already open in Chrome, in which case the workflow will post a notification saying so and take no further action.
  22. I just tested it on my machine and it definitely does. Are you 100% sure the total isn't changing? Alfred Preferences only updates the usage total when it starts up, and it seems to sometimes take Alfred a second to update the counter (i.e.: if you call a workflow and immediately open Alfred Preferences it may not show a change).
  23. I believe that comes under "General". You could easily check it. Open Alfred Preferences, check your total number of uses, quit Alfred Preferences, use a workflow, check your total number of uses again.
  24. David's infinitely more qualified than I am to answer your questions, so I'll take the easy one :-) The do shell script command normally does run without creating a Terminal window, the only reason it's doing it here is because you included it in a tell application "Terminal" block. Try this: #/usr/bin/osascript try tell application "Safari" to tell document 1 set theLink to (get URL) end tell end try try do shell script "python youtube-dl -o ~/Downloads/movie.mp4 " & theLink end try return "Download Finished... " For the record, if you are using AppleScript to tell Terminal to run a shell script, you can actually do it with do script rather than the full do shell script command :-) EDIT: I'm also not sure what the duplicate try blocks are meant to accomplish. Couldn't you achieve the same thing with just one? #/usr/bin/osascript try tell application "Safari" to tell document 1 set theLink to (get URL) end tell do shell script "python youtube-dl -o ~/Downloads/movie.mp4 " & theLink end try return "Download Finished... "
  • Create New...