Jump to content

Find and replace in clipboard text


Stephen_C

Recommended Posts

I see. Either plain text or <>. Thanks Stephen.

 

[10:09:14.706] Find and replace text[Universal Action] Processing complete
[10:09:14.711] Find and replace text[Universal Action] Passing output 'The elephant sat on the mat.' to Arg and Vars
[10:09:14.713] Find and replace text[Arg and Vars] Processing complete
[10:09:14.713] Find and replace text[Arg and Vars] Passing output '' to Automation Task
[10:09:14.714] Find and replace text[Automation Task] Running task 'Identify Frontmost App' with no arguments
[10:09:14.911] Find and replace text[Automation Task] Processing complete
[10:09:14.914] Find and replace text[Automation Task] Passing output 'TextEdit' to Arg and Vars
[10:09:14.915] Find and replace text[Arg and Vars] Processing complete
[10:09:14.916] Find and replace text[Arg and Vars] Passing output '' to Keyword
[10:09:18.614] Find and replace text[Keyword] Processing complete
[10:09:18.619] Find and replace text[Keyword] Passing output 'elephant' to Arg and Vars
[10:09:18.621] Find and replace text[Arg and Vars] Processing complete
[10:09:18.622] Find and replace text[Arg and Vars] Passing output '' to Keyword

 

Link to comment
Share on other sites

Posted (edited)

That is bizarre. When I do exactly what I asked you to do I get this debug output:

 

[18:18:12.869] Logging Started...
[18:18:37.954] Find and replace text[Universal Action] Processing complete
[18:18:37.964] Find and replace text[Universal Action] Passing output 'The cat sat on the mat' to Arg and Vars
[18:18:37.966] Find and replace text[Arg and Vars] Processing complete
[18:18:37.968] Find and replace text[Arg and Vars] Passing output '' to Automation Task
[18:18:37.971] Find and replace text[Automation Task] Running task 'Identify Frontmost App' with no arguments
[18:18:38.229] Find and replace text[Automation Task] Processing complete
[18:18:38.233] Find and replace text[Automation Task] Passing output 'TextEdit' to Arg and Vars
[18:18:38.235] Find and replace text[Arg and Vars] Processing complete
[18:18:38.236] Find and replace text[Arg and Vars] Passing output '' to Keyword
[18:18:41.219] Find and replace text[Keyword] Processing complete
[18:18:41.225] Find and replace text[Keyword] Passing output 'cat' to Arg and Vars
[18:18:41.227] Find and replace text[Arg and Vars] Processing complete
[18:18:41.228] Find and replace text[Arg and Vars] Passing output '' to Keyword
[18:18:49.483] Find and replace text[Keyword] Processing complete
[18:18:49.491] Find and replace text[Keyword] Passing output 'elephant' to Arg and Vars
[18:18:49.492] Find and replace text[Arg and Vars] Processing complete
[18:18:49.494] Find and replace text[Arg and Vars] Passing output '' to Arg and Vars
[18:18:49.496] Find and replace text[Arg and Vars] Processing complete
[18:18:49.497] Find and replace text[Arg and Vars] Passing output 'The cat sat on the mat' to Conditional
[18:18:49.499] Find and replace text[Conditional] Processing complete
[18:18:49.500] Find and replace text[Conditional] Passing output 'The cat sat on the mat' to Replace
[18:18:49.502] Find and replace text[Replace] Processing complete
[18:18:49.503] Find and replace text[Replace] Passing output 'The elephant sat on the mat' to Arg and Vars
[18:18:49.504] Find and replace text[Arg and Vars] Processing complete
[18:18:49.505] Find and replace text[Arg and Vars] Passing output 'The elephant sat on the mat' to Dialog Conditional
[18:18:50.880] Find and replace text[Dialog Conditional] Processing complete
[18:18:50.887] Find and replace text[Dialog Conditional] Passing output 'The elephant sat on the mat' to Arg and Vars
[18:18:50.890] Find and replace text[Arg and Vars] Processing complete
[18:18:50.891] Find and replace text[Arg and Vars] Passing output '' to Automation Task
[18:18:50.892] Find and replace text[Automation Task] Running task 'Open Apps' with arguments (
    ""
)
[18:18:51.165] Find and replace text[Automation Task] Processing complete
[18:18:51.170] Find and replace text[Automation Task] Passing output '' to Copy to Clipboard

 

You did redownload a fresh copy of the workflow as I suggested, didn't you? Otherwise I have no idea why your copy is failing (although in the example you've just given you seem to be trying to replace "elephant” with "elephant”—which won't produce much in the way of a result 😀).

 

Stephen

Edited by Stephen_C
Link to comment
Share on other sites

Assuming you have downloaded a fresh version of the workflow from the gallery (you have not specifically confirmed that) I have two last things for you to try.

  • Close and quit all open windows on the relevant Mac except TextEdit.
  • Repeat exactly what I suggested in this post.

Do you still get the same result? In other words, does the workflow still not work?

 

If it still doesn't work, please try this:

  • Close and quit all open windows on the relevant Mac except TextEdit.
  • In Text/Edit type The cat sat on the mat.
  • Run the workflow and, when asked what text you want to find (i.e., in the first prompt of the workflow) type dog.
  • When asked in the second prompt of the workflow Replace "dog" with what (blank to delete all occurrences of "dog")? simply leave it blank and press ⏎.

Do you then receive any error message displayed by the workflow itself (i.e., not in the debug window but displayed by the workflow)?

 

Stephen

Link to comment
Share on other sites

Yes, I downloaded straight from the gallery. After quitting all applications except TextEdit, I ran the workflow twice. First for "cat", nothing happens. Second for "dog", nothing happens. Both times, I waited for the second prompt to appear, but it never does. No error message either.

Link to comment
Share on other sites

I clicked on the square node and check marked "Don't close the Alfred window on actioning result". After entering "cat", the second prompt appeared. I was able to replace "cat" with "dog" in my text selection in TextEdit. Also, I was able to copy it to the clipboard. When I entered a word that was not in the text selection, it returned the query as not found. Bearing in mind, this does not solve our mystery, nor does it function the way you intended for your workflow.

Here's what we have when I first entered "cat":
 

[18:10:09.891] Find and replace text[Universal Action] Processing complete
[18:10:09.897] Find and replace text[Universal Action] Passing output 'The cat sat on the mat.' to Arg and Vars
[18:10:09.898] Find and replace text[Arg and Vars] Processing complete
[18:10:09.899] Find and replace text[Arg and Vars] Passing output '' to Automation Task
[18:10:09.899] Find and replace text[Automation Task] Running task 'Identify Frontmost App' with no arguments
[18:10:10.100] Find and replace text[Automation Task] Processing complete
[18:10:10.105] Find and replace text[Automation Task] Passing output 'TextEdit' to Arg and Vars
[18:10:10.106] Find and replace text[Arg and Vars] Processing complete
[18:10:10.107] Find and replace text[Arg and Vars] Passing output '' to Keyword
[18:10:12.346] Find and replace text[Keyword] Processing complete
[18:10:12.350] Find and replace text[Keyword] Passing output 'cat' to Arg and Vars
[18:10:12.351] Find and replace text[Arg and Vars] Processing complete
[18:10:12.352] Find and replace text[Arg and Vars] Passing output '' to Keyword
[18:10:14.010] Find and replace text[Keyword] Processing complete
[18:10:14.015] Find and replace text[Keyword] Passing output 'dog' to Arg and Vars
[18:10:14.016] Find and replace text[Arg and Vars] Processing complete
[18:10:14.017] Find and replace text[Arg and Vars] Passing output '' to Arg and Vars
[18:10:14.019] Find and replace text[Arg and Vars] Processing complete
[18:10:14.020] Find and replace text[Arg and Vars] Passing output 'The cat sat on the mat.' to Conditional
[18:10:14.022] Find and replace text[Conditional] Processing complete
[18:10:14.023] Find and replace text[Conditional] Passing output 'The cat sat on the mat.' to Replace
[18:10:14.024] Find and replace text[Replace] Processing complete
[18:10:14.033] Find and replace text[Replace] Passing output 'The dog sat on the mat.' to Arg and Vars
[18:10:14.035] Find and replace text[Arg and Vars] Processing complete
[18:10:14.036] Find and replace text[Arg and Vars] Passing output 'The dog sat on the mat.' to Dialog Conditional
[18:10:16.961] Find and replace text[Dialog Conditional] Processing complete
[18:10:16.964] Find and replace text[Dialog Conditional] Passing output 'The dog sat on the mat.' to Arg and Vars
[18:10:16.965] Find and replace text[Arg and Vars] Processing complete
[18:10:16.966] Find and replace text[Arg and Vars] Passing output '' to Automation Task
[18:10:16.966] Find and replace text[Automation Task] Running task 'Open Apps' with arguments (
    ""
)
[18:10:17.100] Find and replace text[Automation Task] Processing complete
[18:10:17.105] Find and replace text[Automation Task] Passing output '' to Copy to Clipboard

 

Screenshot 2023-07-13 at 5.38.36 PM.png

Edited by nartxela
Link to comment
Share on other sites

3 hours ago, nartxela said:

I clicked on the square node and check marked "Don't close the Alfred window on actioning result".

I'm not sure why that made a difference for you: it does not for me. However, I would normally have selected that option when creating a workflow like this so will issue an update that does so! In any event, very well done for solving your problem.

 

3 hours ago, nartxela said:

When I entered a word that was not in the text selection, it returned the query as not found.

Yes, that's what it should do.

 

3 hours ago, nartxela said:

Bearing in mind, this does not solve our mystery, nor does it function the way you intended for your workflow.

It doesn't solve the mystery in that the workflow worked for me without the change you made…and I don't know why you had the problem (given that we seem to be running identical versions, etc.). However, the workflow is (for you) now functioning in the intended way (from what you say).

 

I'm sorry this has been such a saga—but even more sorry not to understand why that change made it work for you when it still worked for me (and, apparently, 200+ others!)without the change!

 

Stephen

Link to comment
Share on other sites

The new release will also contain one other improvement. If the search word is not found the text window will now retain focus (enabling a new search) after the error message is displayed.

 

The new version is on GitHub now. It usually takes a couple of days or so for the update to appear in the gallery.

 

Stephen

Link to comment
Share on other sites

Thanks Stephen for your commitment!

If I had the resources, I would've done a fresh install of Alfred (without my user settings) to see if the workflow behaved differently. It's best to isolate the variable as much as you can. However, given the circumstance, I'm content to have found a workaround that allows the workflow to function for me. Perhaps sometime in the future, this unresolved mystery will reveal itself to me.

I'm grateful that you took the time to address my saga as it shows your commitment to the workflow you've created. I look forward to any future release you may have up your sleeve.

In version 2.3, as you've mentioned, you added "Don't close the Alfred window on actioning result". I'd like to mention that it was the second node (right after Keyword Input "Text - Find & Replace") where check-marking this option worked for me. 

I searched for a term not found in my text selection, an error message popped up (as it should). However, the Alfred window did not retain focus nor did it become visible once again, enabling a new search. I tried check-marking "Don't close the Alfred window…" on the third node (right after Keyword Input "Replace {var:find}"). Unfortunately, this did not remedy the issue.

Other users not mentioning this issue tells me it might be an isolated issue. If I ever solve this case, you'll be the first to know…

Edited by nartxela
Link to comment
Share on other sites

1 hour ago, nartxela said:

However, the Alfred window did not retain focus nor did it become visible once again, enabling a new search.

It's not the Alfred window that should retain focus but the text editor window containing the selected text (so that you can again run Alfred and use your Universal Action hotkey to run the workflow again if you wish).

 

Thanks for your other kind comments.

 

Stephen

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...