Jump to content

katie

Member
  • Posts

    64
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by katie

  1. Hi Vítor, Thanks for this great workflow! I was wondering… is there an easy way (for a non-coder like myself) to create a duplicate of this workflow that works for starred items or any other tag? For example, could I change every instance of "unreaditems" to "starreditems" in the code and have it work in the same way for those type of bookmarks? I think I could handle a search and replace, but I'm not sure that would work and I don't want to break it. I'd appreciate any tips you might have! Katie
  2. Okay, that makes sense. Thanks for explaining it to me!
  3. Oh, sorry! I did search the forums but I didn't see that one. Thanks for pointing me in the right direction!
  4. I'm using this workflow to create new folders with a keyword but it doesn't seem to work on the desktop. Is there an easy way to modify this slightly so that if there's no open Finder window, a new folder will be created on the desktop?
  5. Thank you for this workflow! Is there a pre-defined list of file types that I can create? I'm wondering because I can use this with no problem for .txt and .doc/.docx files, but not for, for example, .rtf or .key files.
  6. Thanks for your reply! I'm sorry for being unclear. Basically, I have been scouring the internet for bits of Applescript that I can piece together. This is what I have so far: try --Get URL and Title of page from Google Chrome tell application "Google Chrome" to tell active tab of window 1 set u to URL set t to title end tell --Set default folder to save in; use the form "set defaultpath to "Macintosh HD:Users:katie:Downloads" as alias" for another specific location set defaultpath to (path to downloads folder) as alias --Make link and ask user to choose name (title of page is suggested) and location (starts at default folder) tell application "Finder" make new internet location file to u at {choose file name with prompt "Save file as:" default location defaultpath default name t} open information window of result end tell end try This is what I want the code to do: Get the URL and title of page of the front most tab of Google Chrome. Save as dialogue (default location is the downloads folder, default name is the title of the page) Save .webloc file to that location. But it doesn't. No file is created with the code I created. The other codes I mentioned were just other less-ideal solutions (to saving a link as a file) to prove that I have been trying hard to find a way to do this myself! I tried the code you wrote (both with Safari and changing it to suit Google Chrome) in the Applescript Editor. When I run it, I'm asked where to save the file and what to name it (as expected). But when I click save, my input is disregarded and the .webloc file saves to the desktop with the name equal to the title of the web page.
  7. I haven't gotten to the point of adding it to a workflow - since it doesn't even work in the Applescript Editor. I was planning to do a hot key and keyword linked to a NSAppleScript object. I understand that this would involve wrapping the script in this: on alfred_script(q) -- your script here end alfred_script
  8. Thanks for being so open to suggestions! The feelslike option works great! I generally find the feels like temperature more informative so I appreciate this addition to the workflow. I think you could fit in both if it was something like this: Actual (Feelslike) or vice versa, e.g. -16C (-26), but it's not necessary. I like the new simplified implementation of the wset commands!
  9. I'm trying to create a workflow to save a link (.webloc file) to a user-specified location. I'm new to Alfred and coding, so I thought I would start off "slow" but, as it turns out, it's not as straightforward as I hoped and I've spent an embarrassingly long time trying to figure it out! It's time to ask for help I've been piecing together the code via snippets found online and trial and error. Here's what I have so far: try --Get URL and Title of page from Google Chrome tell application "Google Chrome" to tell active tab of window 1 set u to URL set t to title end tell --Set default folder to save in; use the form "set defaultpath to "Macintosh HD:Users:katie:Downloads" as alias" for another specific location set defaultpath to (path to downloads folder) as alias --Make link and ask user to choose name (title of page is suggested) and location (starts at default folder) tell application "Finder" make new internet location file to u at {choose file name with prompt "Save file as:" default location defaultpath default name t} open information window of result end tell end try From everything I can find online, this should work. I know that there are problems with it because, from what I understand, it will alert the user if there is already a file with the same name and ask them if they want to replace it or not but then won't actually do those actions. But I thought I would focus on getting a file to actually save first...This code opens a save as dialogue with the pre-populated name and location, but nothing is saved. Sometimes the default save location doesn't work either and it goes instead to my Documents folder. I found two solutions but they are not ideal. The following solution definitely works but doesn't allow for a user-specified name and location: tell application "Finder" make new internet location file at desktop to u with properties {name:t} I could use this to save to the Downloads folder, then access the file through Alfred to move it to somewhere else. But, it seems like it should be possible to make the process faster. This solution can save a .url to any location: try tell application "Safari" set u to URL of (document of window 1) set t to name of window 1 set defaultpath to (path to downloads folder) as alias set savedfile to (choose file name with prompt "Save file as:" default location defaultpath default name t) set savepath to (POSIX path of savedfile) & ".url" end tell set res to "[InternetShortcut]URL=" & u set cmd to "echo \"" & res & "\" > " & quoted form of savepath do shell script cmd on error x activate me display dialog x end try While this option has the added benefit of making files that can be opened across platforms, Chrome cannot currently handle such files (and they open as plain text). I could get an extension to open them as a workaround but I'd prefer to find a way to get the first script to work. I also don't really understand this code (the shell script part). So, I'm asking for help. Can anyone see why my first Applescript is not actually saving a file?
  10. Great! And I'm available if you need a guinea pig I have a few ideas now that I've played with it a bit and I'll write them out here, but I'm not sure they would be helpful to everyone so feel free to reject any that you think are not useful. I'm also really new to Alfred so I don't know the best way to implement things or if they are even possible. Option to choose "feels like" temperature versus "actual temperature". Weather alert text shown in Alfred. As it is now, I have to go to the website to read the updates. Maybe in the black text box that sometimes pops up (like in workflows for lyrics)? Hourly weather: chance of precipitation (%, mm) and temperature. I think it would probably clutter things up to include all of this at once. But, maybe clicking enter on a day could take you to a new list with hourly conditions displayed in the same manner as the forecast? Favourite locations to see current conditions in multiple places (useful when planning a road trip home - it's an 8 hour drive and weather along the way makes a big difference). I guess this would require setting up favourite locations. I don't know if this would work with the key limits (no more than 10 requests per minute). Yesterday's weather - I'm interested in the relative judgement, something like "Today will be colder than/the same as yesterday" or "Tomorrow will be warmer than today" (maybe display this text rather than the local time in the subtext). But if that's too complex, then displaying the information would be good, too. Option to display local sunrise and sunset times. That's everything - I didn't quite realize how much I check the weather until writing this up...but it may also be because we're in the middle of a snow squall warning I also know that this is quite a lot of stuff and a lot of work so please don't take them all as requests - none of them are really even necessary; the workflow is awesome in its current form and I already see myself using it daily.
  11. It works! Thank you!! And I love your workflow; thank you for sharing it! Any chance that you would consider adding additional features, like hourly weather or favourite locations or yesterday's conditions?
  12. Thank you! I really appreciate your time and effort
  13. Hi, I'm getting the same "invalid literal for int() with base 10: ' '" that was briefly mentioned. I tried resetting all of the locations, units, service, etc. I checked my key. I tried restarting Alfred and restarting my computer, but the problem persists. It shows the error when I use the "weather" keyword. But, if I type something like "weather Vancouver" then it will get valid results. If I stop typing like "weather V", "weather Van", "weather Vancou" then it will report "results failed" or sometimes it will suggest a city and show results. After running "weather" keyword, I get the following debug log: [2013-12-10 22:13:54,299] INFO: alfred_weather: Running command weather [2013-12-10 22:13:54,314] ERROR: alfred_weather: Error telling Traceback (most recent call last): File "alfred_weather.py", line 804, in tell items = globals()[cmd](query) File "alfred_weather.py", line 706, in tell_weather weather = _get_wund_weather() File "alfred_weather.py", line 359, in _get_wund_weather weather['alerts'] = [parse_alert(a) for a in data['alerts']] File "alfred_weather.py", line 341, in parse_alert 'expires': datetime.fromtimestamp(int(alert['expires_epoch'])), ValueError: invalid literal for int() with base 10: '' Is anyone able to understand what this code means? I tried looking up "expires_epoch" and found this from weather underground: http://www.wunderground.com/weather/api/d/docs?d=data/alerts But it wasn't too helpful (to me). I don't think the problem can be that my default location is in Canada since the workflow seems to work for Vancouver. I'd really appreciate some help!
×
×
  • Create New...