Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by slyfox

  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?
  12. Came here looking to answers about fill-in snippets. I tried various approach and Alfred is not suited for form based fill-in snippets. Typinator works best for this. I was for a moment thinking of decreasing the number of apps that I use and sticking with Alfred and Keyboard Maestro but it looks like I can't drop Typinator.
  13. How can I have Alfred do a basic calculation? 1. Input Keyword variable 2. round({query}/10) 3. Output to {query}
  14. What is a simple workflow that I can use to trigger keyboard shortcut to copy FirstName LastName and change it to LastName, FIrstName? I think that this can somehow be done with Transform Modifiers but I can't figure out how they work yet. Another option is to use RegEx to Find "([\w\.\-]+)\h+([\w\.\-]+)(.*)" and replace with "$2, $1"
  15. I need a simple workflow to copy text -> use RegEx to replace various text within the clipboard content and paste it back. My current workflow is to simply create a bunch of linked find and replace utility arguments inside Alfred. I am not sure if this is the best approach compared to a simple Javascript that includes a list of variables to replace. I don't know Java or any other programming language but sample Javascript looks simple enough to modify if someone can provide it.
  16. @Mpco Keyword trigger has a bump in-between. Something is not right. Entering a keyword with "search argument" does not pass the "search argument" to "dnt" script filter. It just triggers it. I then have to enter the search keyword once dnt is triggered.
  17. Almost there. Instead of using a hotkey, what is best way to setup keyword as trigger? For example, for my notes search, I want to setup "nt" keyword input + sear argument will result in searching for the argument in a specific database?
  18. What is the script that I can use to enter a keyword and have Alfred search within a pre-defined database?
  19. Is the workflow working? Running Aflred 4. Added my API token. I get no results for everything.
  20. Here is what I am trying to create: 1. Keyword trigger to filter files located on my Desktop. For example a newly saved Word document. 2. Once found, select. 3. Open a list with predefined contacts (email variables) and choose a contact to email to. 4. Set the subject line to file name. 5. Open mail app and attach the file and auto insert subject line. I can make this happen with Keyboard Maestro. I wonder if this can be done with Alfred without complicated Javascript, which I know nothing about.
  21. This post helped me understand the process as well. Thank you. However, when I type a snippet, say "ssuper" Alfred pastes the actual snippet after "ssuper" It does not replace it in many cases. Edit: Fixed it by going into snippet setting and slowing down the key event.
  • Create New...