Jump to content

Pearcen

Member
  • Posts

    44
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Pearcen

  1. Alfred 4.6 Pre-release Build 1263, Thursday 9th September 2021 Future macOS Support • Improved handling of missing bin path when running a Workflow script • Log debug info into the workflow debugger when relevant • Add options on popup alert dialog to open or disable the relevant workflow when attempting to run • Check alternative homebrew install locations for bins when missing from default location • e.g. homebrew installed php on macOS 12 will be found in either /opt/homebrew/bin/php (Apple Silicon) or usr/local/bin/php (Intel) • Updated built-in Google and Amazon workflows by Vítor Galvão • New workflows use ruby in place of php for default compatibility in macOS Monterey • If you're using these workflows, delete them and re-install them from the Workflow > + > Getting Started menu I'm testing this out now Using: Apple Silicon Air. MacOS 12 beta Monterey Homebrew installed php Results: Success!
  2. yeah Apple aren't bundling php with MacOS from Monterey.
  3. Extra mile. hehehe nah, just really got into Alfred the last year and thought if I can help then why not. It makes no difference how it laid out at all. I just put it there and coloured it to make it obvious what I had done. Glad it is working for you and good luck and enjoy Alfred and all it has to offer.
  4. @Sucesso Download my version from https://github.com/pearcenuk/Alfred-public/raw/main/_Paste without newlines.alfredworkflow and see if that works as it does for me. Things I've updated I've coloured red and left comments
  5. Is this what you wanted it to do? Take a block of text with multiple spaces in it and return a single line with \\ replacing newlines and a single space replacing any double or more spaces? eg: input: This is Some test so lets see how this goes with seeing if this does anything output: This is Some test so lets // see how this goes with seeing if this does anything This is what I added to get the above result and I also changed your snippet trigger to a keyword for testing.
  6. Try this as it looks like the same workflow I use daily.
  7. Yeah the second screenshot on my original post is from Moom. I saved a layout and gave it that shortcut. Obvs you can use whatever one you like and update the workflow to use your preferred hotkeys. Good luck
  8. @iapple It's a great workflow to try and build yourself if you have never tried before as so few moving parts, but I've done an export and put it here : https://github.com/pearcenuk/Alfred-public Hope it works.
  9. I do this with Alfred and Moom working together. Alfred kicks off all the apps that I need using Launch Apps action in the workflow, then a delay to make sure they've all started and then runs a global keyboard shortcut which runs a Moom window placement setting that puts the opened apps into the right place.
  10. Thank you for this, for making me a little less mouse dependent.
  11. @vero I know it's been a while, but I haven't been here for a bit. Here is an mdls of a file in 'My Drive' path: /Volumes/GoogleDrive/My Drive My Drive mdls General\ notes.txt _kMDItemDisplayNameWithExtensions = "General notes.txt" kMDItemContentCreationDate = 2020-06-24 01:51:30 +0000 kMDItemContentCreationDate_Ranking = 2020-06-24 00:00:00 +0000 kMDItemContentModificationDate = 2020-08-28 00:08:08 +0000 kMDItemContentModificationDate_Ranking = 2020-08-28 00:00:00 +0000 kMDItemContentType = "public.plain-text" kMDItemContentTypeTree = ( "public.plain-text", "public.text", "public.data", "public.item", "public.content" ) kMDItemDisplayName = "General notes.txt" kMDItemDocumentIdentifier = 0 kMDItemFSContentChangeDate = 2020-08-28 00:08:08 +0000 kMDItemFSCreationDate = 2020-06-24 01:51:30 +0000 kMDItemFSCreatorCode = "" kMDItemFSFinderFlags = 0 kMDItemFSHasCustomIcon = (null) kMDItemFSInvisible = 0 kMDItemFSIsExtensionHidden = 0 kMDItemFSIsStationery = (null) kMDItemFSLabel = 0 kMDItemFSName = "General notes.txt" kMDItemFSNodeCount = (null) kMDItemFSOwnerGroupID = 20 kMDItemFSOwnerUserID = 502 kMDItemFSSize = 5433 kMDItemFSTypeCode = "" kMDItemInterestingDate_Ranking = 2020-08-17 00:00:00 +0000 kMDItemKind = "Plain Text Document" kMDItemLastUsedDate = 2020-08-17 01:59:02 +0000 kMDItemLastUsedDate_Ranking = 2020-08-17 00:00:00 +0000 kMDItemLogicalSize = 5433 kMDItemPhysicalSize = 8192 kMDItemUseCount = 10 kMDItemUsedDates = ( "2020-07-08 16:00:00 +0000", "2020-08-16 16:00:00 +0000" )
  12. Yeah this one is annoying me. Spotlight picks it up fine so have to resort to that.
  13. I've had a play with the workflow AppleScript and think I have added some logic to help it deal with times. it should now accept times in the formats: <hour> am/pm or 24hr time. eg: 8 am. 3:45 pm, 2:39 am, 05:00 am 00:02, 13:56, 15:00, 23:49 This is my first attempt at AppleScript so hopefully it works and is useful to add to this already great workflow Code replaces all in the RunNSAppleScript block (* For using in Script Editor *) --alfred_script("xxx;;14;Wishlist") on alfred_script(q) set noDate to "no" set theDayArray to {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"} (* Explode query input *) set myList to explode(";", q) (* get the Title of the Reminder *) set theReminder to item 1 of myList (* try to get Date, tomorrow or next week on error set to "none" *) set queryDay to item 2 of myList if queryDay is "" then set queryDay to "none" (* Replace . with : <OLD:Set default Reminder Time 8:00> *) set queryTime to item 3 of myList -- if queryTime is "" then set queryTime to "8:00" set queryTime to replace_chars(queryTime, ".", ":") (* Get List of for Reminder *) set queryList to trim(item 4 of myList) (* try to get entered time. if only hours are provided at the missing ":00" *) if queryTime is not "" and queryTime does not contain ":" then set Pos to offset of " " in queryTime set theHour to characters 1 thru (Pos - 1) of queryTime as string set queryTime to theHour & ":00" & characters (Pos) through end of queryTime as string else if (queryTime does not contain "am") and (queryTime does not contain "pm") then set Pos to offset of ":" in queryTime set theHour to characters 1 thru (Pos - 1) of queryTime as string set theHour to returnNumbersInString(theHour) set theHour to theHour as number set queryTime to characters (Pos + 1) through end of queryTime as string -- Get the "minute" set Pos to offset of ":" in queryTime set theMin to characters 1 thru (Pos - 1) of queryTime as string set queryTime to characters (Pos + 1) through end of queryTime as string --Get "AM or PM" set Pos to offset of " " in queryTime set theSfx to characters (Pos + 1) through end of queryTime as string if theSfx does not contain "pm" and theSfx does not contain "am" then if (theHour is less than 24) or (theHour is greater than or equal to 0) then if theHour is less than 12 then set theSfx to "am" else set theSfx to "pm" set theHour to theHour - 12 end if end if end if set queryTime to theHour & ":" & theMin & " " & theSfx as string end if (* calculate due date when "today" was entered. If time string is emptpy, add 3 hours from now *) if queryDay contains "today" then if queryTime is not equal to "" then set theDate to date string of (current date) set DueDate to date (theDate & " " & queryTime) else set DueDate to ((current date) + (3 * hours)) end if (* calculate tomorrow's due date. If time string is empty get current time *) else if queryDay contains "tomorrow" then if queryTime is equal to "" then set queryTime to time string of (current date) end if set theDate to date string of ((current date) + (1 * days)) set DueDate to date (theDate & " " & queryTime) (* Calculate next weeks due date. If time string is empty get current time *) else if queryDay contains "next week" then if queryTime is equal to "" then set queryTime to time string of (current date) end if set theDate to date string of ((current date) + (1 * weeks)) set DueDate to date (theDate & " " & queryTime) (* if weekday was provided set due date to the next weekday*) else if theDayArray contains queryDay then set theNext to list_position(queryDay, theDayArray) set theNextWeekday to date string of (nextWeekday(theNext)) set DueDate to date (theNextWeekday & " " & queryTime) (* if no day was provided set noDate flag to "yes" *) else if queryDay contains "none" then set noDate to "yes" (* In case date where provided check if only DD and MM was provided and add current year *) else if queryDay contains "." then if queryTime is equal to "" then set queryTime to time string of (current date) end if set expDate to explode(".", queryDay) if (count of expDate) is equal to 2 then set theYear to year of (current date) set queryDay to queryDay & "." & theYear end if set DueDate to date (queryDay & " " & queryTime) end if (* Create reminder without a DueDate *) if noDate is equal to "yes" then tell application "Reminders" -- get default list set in Reminders if queryList is equal to "" then set listName to name of default list else set listName to queryList end if set availList to name of lists if availList does not contain listName then set listName to name of default list end if tell list listName make new reminder with properties {name:theReminder} end tell end tell set output to theReminder & ", in List: " & listName (* Create reminder with DueDate *) else tell application "Reminders" -- get default list set in Reminders if queryList is equal to "" then set listName to name of default list else set listName to queryList end if set availList to name of lists if availList does not contain listName then set listName to name of default list end if tell list listName make new reminder with properties {name:theReminder, remind me date:DueDate} end tell end tell set output to theReminder & " Due: " & DueDate & ", in List: " & listName end if end alfred_script (* explode string with given delimter *) on explode(delimiter, input) -- explode(delimiter (String),input (String)) (Array) local delimiter, input, ASTID set ASTID to AppleScript's text item delimiters try -- save delimiters to restore old settings set oldDelimiters to AppleScript's text item delimiters set AppleScript's text item delimiters to delimiter set input to text items of input set AppleScript's text item delimiters to ASTID set AppleScript's text item delimiters to oldDelimiters return input --> list on error eMsg number eNum set oldDelimiters to AppleScript's text item delimiters set AppleScript's text item delimiters to ASTID set AppleScript's text item delimiters to oldDelimiters error "Can't explode: " & eMsg number eNum end try end explode (* calculates next weekday as an integer *) on nextWeekday(wd) set today to current date set twd to weekday of today if twd is wd then set d to 7 else set d to (7 + wd - twd) mod 7 end if return today + (d * days) end nextWeekday (* returns position in a list *) on list_position(this_item, this_list) repeat with i from 1 to the count of this_list if item i of this_list is this_item then return i end repeat return 0 end list_position (*Replaces a character witin a text*) on replace_chars(this_text, search_string, replacement_string) -- (string,char,char) set AppleScript's text item delimiters to the search_string set the item_list to every text item of this_text set AppleScript's text item delimiters to the replacement_string set this_text to the item_list as string set AppleScript's text item delimiters to "" return this_text end replace_chars on returnNumbersInString(inputString) set s to quoted form of inputString do shell script "sed s/[a-zA-Z\\']//g <<< " & s set dx to the result set numlist to {} repeat with i from 1 to count of words in dx set this_item to word i of dx try set this_item to this_item as number set the end of numlist to this_item end try end repeat return numlist end returnNumbersInString (* ======================================================= FUNTION: Trim trailing whitespaces from a string RETURNS: String ======================================================== *) on trim(str) set cmd to "echo \"" & str & "\" | sed 's/ //g'" set trimmed to do shell script cmd return trimmed end trim
  14. From my testing it only likes times in the format hh:mm:ss am/pm so 7 am, 7:00, 07:00, 07:00:00, all fail but 07:00:00 am or 7:00:00 am works. [20:53:20.854] Apple Reminders[Arg and Vars] Passing output 'title;tomorrow;07:00:00;' to Run NSAppleScript [20:53:30.351] Apple Reminders[Run NSAppleScript] Processing complete [20:53:30.418] Apple Reminders[Run NSAppleScript] Passing output 'title Due: Thursday, 13 February 2020 at 12:00:00 am, in List: Reminders' to Post Notification [20:54:21.657] Apple Reminders[Arg and Vars] Passing output 'test;tomorrow;07:00:00 am;' to Run NSAppleScript [20:54:31.144] Apple Reminders[Run NSAppleScript] Processing complete [20:54:31.165] Apple Reminders[Run NSAppleScript] Passing output 'fart Due: Thursday, 13 February 2020 at 7:00:00 am, in List: Reminders' to Post Notification
×
×
  • Create New...