slyfox
-
Posts
66 -
Joined
-
Last visited
Content Type
Blogs
Gallery
Downloads
Events
Profiles
Forums
Articles
Media Demo
Posts posted by slyfox
-
-
Does his work with Bear 2?
I just installed the workflow and followed the instructions on GitHub to make it work with the Apple Silicone chip. When I type "BS" Bear Search appears for a second and then reverts back to Google search
-
@xilopaint Interesting. It works on other files.
-
4 hours ago, xilopaint said:
@slyfox I need the Alfred Debugger output as well.
[22:10:12.341] Logging Started... [22:10:30.863] Alfred PDF Tools[File Action] Processing complete [22:10:30.875] Alfred PDF Tools[File Action] Passing output '( "/Users/ivan/Library/CloudStorage/Dropbox/1.pdf", "/Users/ivan/Library/CloudStorage/Dropbox/2.pdf" )' to Arg and Vars [22:10:30.877] Alfred PDF Tools[Arg and Vars] Processing complete [22:10:30.878] Alfred PDF Tools[Arg and Vars] Passing output '' to Keyword [22:10:32.307] Alfred PDF Tools[Keyword] Processing complete [22:10:32.308] Alfred PDF Tools[Keyword] Passing output 'May' to Run Script [22:10:32.575] ERROR: Alfred PDF Tools[Run Script] . 22:10:32 workflow.py:2332 DEBUG ---------- Alfred PDF Tools (4.3.1) ---------- 22:10:32 workflow.py:1692 DEBUG reading settings from /Users/ivan/Library/Application Support/Alfred/Workflow Data/com.xilopaint.alfredapp.pdftools/settings.json 22:10:32 workflow.py:2737 DEBUG update check not due 22:10:32 workflow.py:2352 ERROR 'NumberObject' object has no attribute 'indirect_reference' Traceback (most recent call last): File "/Users/ivan/Library/Mobile Documents/com~apple~CloudDocs/Alfred/Alfred.alfredpreferences/workflows/user.workflow.C5A658BE-E81B-480E-BBF0-A024BF54E903/workflow/workflow.py", line 2346, in run func(self) File "/Users/ivan/Library/Mobile Documents/com~apple~CloudDocs/Alfred/Alfred.alfredpreferences/workflows/user.workflow.C5A658BE-E81B-480E-BBF0-A024BF54E903/alfred_pdf_tools.py", line 583, in main merge(query, pdf_paths) File "/Users/ivan/Library/Mobile Documents/com~apple~CloudDocs/Alfred/Alfred.alfredpreferences/workflows/user.workflow.C5A658BE-E81B-480E-BBF0-A024BF54E903/alfred_pdf_tools.py", line 80, in wrapper func(*args, **kwargs) File "/Users/ivan/Library/Mobile Documents/com~apple~CloudDocs/Alfred/Alfred.alfredpreferences/workflows/user.workflow.C5A658BE-E81B-480E-BBF0-A024BF54E903/alfred_pdf_tools.py", line 301, in merge writer.append(reader) File "/Users/ivan/Library/Mobile Documents/com~apple~CloudDocs/Alfred/Alfred.alfredpreferences/workflows/user.workflow.C5A658BE-E81B-480E-BBF0-A024BF54E903/pypdf/_writer.py", line 2659, in append self.merge( File "/Users/ivan/Library/Mobile Documents/com~apple~CloudDocs/Alfred/Alfred.alfredpreferences/workflows/user.workflow.C5A658BE-E81B-480E-BBF0-A024BF54E903/pypdf/_utils.py", line 442, in wrapper return func(*args, **kwargs) File "/Users/ivan/Library/Mobile Documents/com~apple~CloudDocs/Alfred/Alfred.alfredpreferences/workflows/user.workflow.C5A658BE-E81B-480E-BBF0-A024BF54E903/pypdf/_writer.py", line 2755, in merge elif dest["/Page"].indirect_reference.idnum in srcpages: AttributeError: 'NumberObject' object has no attribute 'indirect_reference' 22:10:32 workflow.py:2355 INFO for assistance, see: https://github.com/xilopaint/alfred-pdf-tools 22:10:32 workflow.py:2376 DEBUG ---------- finished in 0.021s ----------
-
Re-downloaded. No more errors, but Mergin PDF command does nothing.
### Workflow version
4.3.1### Alfred version
5.1.1### Python version
3.9.6### PyCryptodome version
Not Installed### Rosetta installation status
Installed### macOS version
13.4### Architecture
arm64
-
23 hours ago, xilopaint said:
@slyfoxTo get support you need to post the !diagnostic keyword output.
Diagnostic: https://pastebin.com/bPRcfxUD
-
-
-
I tried to install and run the workflow and immediately got an error. Any idea how to fix this?
Reason: launch path not accessible /usr/bin/php Check that the selected language exists on your system. If you're syncing Alfred's preferences, also check that all related workflow files exist locally. Related Workflow Info... Name: 'Calculate Anything' Folder:/Users/bob/Library/Mobile Documents/com~apple~CloudDocs/Alfred/Alfred.alfredpreferences/workflows/user.workflow.30D26E72-33D3-4A03-B90C-3297F9BAC9D5
-
Here is a more functional Siri Shortcut with a few changes.
https://www.icloud.com/shortcuts/4b7a5e1350c045598ac4e0b78aadb934
Then just connect Alfred with the shortcut.
-
I previously used Apple Music and used this script to mark a track Unloved and play the next track.
echo ' (function() { var track = Application("Music").currentTrack(); var trackDisliked = track.disliked(); var notification = (trackDisliked ? "UnDisliked" : "Disliked") + ": " + track.name(); track.disliked = !trackDisliked; return notification; })()' | osascript -l JavaScript
I switched to Plexamp. Currently, my keyboard shortcut in Plexamp is set to "Fn+Pg Down" to mark the track as disliked. I need Alfred to also simulate "Next Track" keystroke, which is under F8 keyboard key on my Mac. Anyway to do this?
-
Is there a way to do more than one action with a contacT?
I am trying to automate these steps:
1. Choose a contact
2. Get firstName
3. Get lastName
4. Get email
5. compose a Calendly link with the contact's details in the URL
6. Copy URL to clipboard
Edit: A workaround is to create a Siri Shortcut that does the above steps and then have Alfred open the shortcut using Alfred Siri Shortcuts Workflow.
-
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.
-
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
Then replace (content of the report):
NN with firstName --> ([M][r-s]\.\s)(\w*\s)(\w*) - group 2
XX with lastName --> ([M][r-s]\.\s)(\w*\s)(\w*) - group 3
DOB with dob --> Date\s\of\s\Birth:\s(\w+\s\d{1,2}\,\s\d{4})
DOL with dol --> Date\s\of\s\Loss:\s(\w+ \d{1,2},\s\d{4})
-
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) { s = s.replace(dobReplacement, "$1"+getDateofBirth+"$2"); return s; } function run(argv) { return cleanup(argv[0]); }
-
Thank you. This works!
-
@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 run(argv) { return cleanup(argv[0]); }
Can I also ask (trying to understand)
1. Why do we need line 2-5? Can't we just start with line
var nameReplacement = /(\W|^)XX(\W|$)/gm;
2. return s.match(lastname)[1] --> Why is there a number 1 rather then number 3? I thought that the last name will be group $3 in RegEx
-
8 hours ago, Terminal said:
Not super familiar with JS. Does this work?
var replacements = [ // (\W|^) matches non-word character or start // (\W|$) matches non-word character or end // $1 and $2 are the first and second match groups, // where a match group is whatever matches the contents // of a pair of parentheses. /(\W|^)XX(\W|$)/gm, ]; function getName(s) { let lastname = /(?:[M][r-s]\.\s)(?:\w+)(\s\w*)/; return s.match(lastname)[1] } function cleanReport(s) { replacements.forEach(function(l) { s = s.replace(l, getName(s)); }); return s; } function run(sb) { return cleanReport(sb); }
It does not.
-
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 = Mr.
Group 2 = John
Group 3 = SmithGroup 2 is set to variable FirstName
Group 3 is set to variable LastNameI then tell KM to replace all instances of XX with LastName variable.
Based on the solution in this forum post for Find & Replace as well as as this forum post - https://forums.getdrafts.com/t/regex-find-and-replace-with-variables/6294/11?u=slyfox
I tried to figure this out myself but it does not seem to be working.
Can you please advise how to make this work?
#!/usr/bin/osascript -l JavaScript var replacements = [ // (\W|^) matches non-word character or start // (\W|$) matches non-word character or end // $1 and $2 are the first and second match groups, // where a match group is whatever matches the contents // of a pair of parentheses. [/(\W|^)XX(\W|$)/gm, '$1/([M][r-s]\.\s)(\w*\s)(\w*)/)[3]$2'], ]; function feminise(s) { replacements.forEach(function(l) { s = s.replace(l[0], l[1]); }); return s; } function run(argv) { return cleanReport(argv[0]); }
-
-
Got it. Thank you.
-
Where specifically in the Argument and Variables Utility should I enter the math formula? "=round({query}/10)"
-
On 8/23/2017 at 4:55 PM, GuiB said:
Here is 2 examples... If you don't want to do some scripting, the first example could be great to easily add a formula by modifying the "Arg and Vars" object (can duplicate to make more math functions). The second one is nicer if you prefer to have a direct feedback on the number you input
https://nofile.io/f/vucR6c28GJq/Calculation+in+Workflow+Example.alfredworkflow
Best!
Can you please show a screenshot where exactly to add the math formula to "Arg and Vars" as the link is dead?
-
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?
-
There is a space after “He “ and “She “
New Bear Alfred Workflow
in Share your Workflows
Posted