Jump to content


  • Content Count

  • Joined

  • Last visited

About slyfox

  • Rank

Recent Profile Visitors

847 profile views
  1. @Terminal Thank you very much. I appreciate your effort and time. I'll take a few days to figure out the logic behind the variables as I am yet to learn JS. @deanishe I would rather stick to Java Script as I plan to learn it to become better at using JS and RegEx in situations like in this thread. I don't know any programming languages as I am just a power user rather than a developer.
  2. I am trying to replace a Keyboard Maestro workflow with Alfred workflow. 1. CMD+A to select text 2. Copy to Clipboard 3. Execute Find & replace 4. Paste back the results. For step 3 my report will have this info at the top: ### Client Info - Clinic: Advanced Healthcare - Name: Mr. John Smith - Date of Birth: January 10, 1980 - Date of Loss: January 10, 2019 - Date of Assessment: January 10, 2020 I need to find and set variables: firstName = John lastName = Smith dob = January 10, 1980 dol = January 10, 2019
  3. @Terminal Through some trial and error I am trying to add another RegEx find & Replace but so far nothing happens. This time I am trying to replace "DOB" with "Date of Birth: January 10, 2020" All instances of "DOB" should turn into "January 10, 2020" Also, how would you combine multiple find and replace scripts into one? #!/usr/bin/osascript -l JavaScript var dobReplacement = /(\W|^)DOB(\W|$)/gm; function getDateofBirth(s) { let dob = /(?:Date\sof\sBirth:\s)?:(\w+\s\d{1,2}\,\s\d{4})/; return s.match(dob)[1] } function replaceDOB(s)
  4. @Terminal Almost there. @deanishe Sorry, I'll be more specific. input: Mr. John Smith Mr. XX goes to town. Output: Mr. John Smith Mr. Smithgoes to town. Javascript used #!/usr/bin/osascript -l JavaScript var replacements = [ ]; var nameReplacement = /(\W|^)XX(\W|$)/gm; function getName(s) { let lastname = /(?:[M][r-s]\.\s)(?:\w+)(\s\w*)/; return s.match(lastname)[1] } function cleanup(s) { replacements.forEach(function(l) { s = s.replace(l[0], l[1]); }); s = s.replace(nameReplacement, getName(s)); return s; } function ru
  5. I am trying to figure out how to convert a simple Keyboard Maestro (KM) text manipulation workflow into Drafts action. Please note that I don't know Java Script but perhaps with some examples, I can figure out the basics principles of RegEx Find & Replace in Javascript. A plain text document contains an instance of "Mr. John Smith" (name varies) The rest of the document refers to the client as Mr. XX. My KM workflow copies text to clipboard and then runs the RegEx with variables. `/([M][r-s]\.\s)(\w*\s)(\w*)/g;` Where: Group 1 = M
  6. This I know. I was under the impression that this formula can be included into "Arg and Var" utility somehow to do the calculation inside the workflow. Or this is only possible with a script? Not sure what I am doing here with a script though,.
  7. Where specifically in the Argument and Variables Utility should I enter the math formula? "=round({query}/10)"
  8. Can you please show a screenshot where exactly to add the math formula to "Arg and Vars" as the link is dead?
  9. @deanishe Thank you for the script. It works. Any idea why when the new content is pasted, there is a new line at the bottom whereas the original content does not have a new line?
  10. They are the same as the notes. Replace He with She Replace Mr with Ms I am using basic string replace.
  11. "If you post some sample input and the expected output, sure." @deanishe Are the examples (i.e., Mr. to Ms.) in the screenshots not clear?
  • Create New...