Jump to content


  • Posts

  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

PaulF's Achievements

Helping Hand

Helping Hand (3/5)



  1. I did just reboot to be sure, but the behavior is the same. I have been running this workflow for some time with the initial glitch and only yesterday spent the time to characterize the problem - i.e. fails first time unless Numbers is in focus. I see no difference in behavior between my AppleScript based WF and your JXA version. They both produce the same results when they succeed. But they both fail (for me) if I have the Alfred Preferences Window, or any other window other than Numbers, in focus when I run either workflow. As I have said the second time is then successful in both cases so long as I keep Numbers in focus. I get the same behavior with my Safari Tabs workflow as well so it doesn't seem to be app-specific. 🤔
  2. Thanks for the quick response and your clean JXA code. I have tried your "really fixed" workflow but unfortunately the behavior is the same for me as my original workflow. Does my workflow show the symptoms that I describe - fails, but only when Numbers is not in focus? If so, then maybe my machine is broken but I have no idea in what way and how I might proceed to "fix" it 😞
  3. I have a very similar workflow with the same structure that works with Safari instead of Numbers. This workflow shows the same behavior, requiring Safari to be in focus when the workflow is invoked in order for it to present the list of open tabs. Otherwise it just shifts the focus to Safari. Running a second time then works as expected because Safari now has focus. https://www.dropbox.com/s/e9g6oxom4igvln9/Safari Tabs - pmf.alfredworkflow?dl=0 Thanks for your help.
  4. Thanks @vitor for your explanation. Is there a better way to call a script filter from within another workflow and append the return to continue the processing in that other workflow. The external trigger is a "fire and forget" mechanism as noted by @deanishe in another post.
  5. Thanks @vitor for responding. I have just simplified my AppleScript code to remove some extraneous code that was very specific to my process. This workflow fails in the same way as before. The keyword for this public version of the workflow is 'nsp'. This is my first time sharing a workflow so I hope this dropbox link works for you. https://www.dropbox.com/s/9vzrll6pfjx8t81/Numbers Sheets - public.alfredworkflow?dl=0 Thanks again for offering to take a look.
  6. I think that I have solved my own problem with help from an old post on this forum. Calling a Workflow from another Workflow - Workflow Help & Questions - Alfred App Community Forum To trigger "1p" from my AppleScript I use the "search" method instead of the "runTrigger" method. If I have a variable "sheetName" in my AppleScript this becomes: tell application id "com.runningwithcrayons.Alfred" to search "1p " & sheetName delay 0.2 tell application "System Events" to keystroke return Note the space after 1p. When I added two of these calls in my script I found that I needed a short delay between the calls to get everything to "fire" properly. tell application id "com.runningwithcrayons.Alfred" to search "1p " & sheetName delay 0.2 tell application "System Events" to keystroke return delay 0.2 tell application id "com.runningwithcrayons.Alfred" to search "1p " & sheetName delay 0.2 tell application "System Events" to keystroke return I don't really understand the need for the delays but without them the subsequent code doesn't run.
  7. I am trying to debug (my first) script filter. I am using the option where Alfred filters the results (screenshot attached). If I understand correctly that means that my script runs only once. On my Mac I already have Numbers running with a number of sheets open that are being shown with those windows merged in a tab view before I invoke the workflow. My script filter uses AppleScript (getSheetList.scpt) to query Numbers for the names of those sheets. Scenarios: If I have focus on Numbers when I launch my workflow, the list is populated with the sheet names, as expected, and there is no issue. However, if the focus is elsewhere, the first time that I run the workflow the only response is to shift focus to Numbers - no list is generated - and the workflow ends. The second time I run the workflow all runs as expected, with a list being returned, since the first invocation set up the focus. I thought that I just had a focus issue so I investigated that further ... Attempts to force focus: If I manually force focus from Script Editor by running tell application "Numbers" to activate the workflow produces a list and there is no issue If I try to force focus by adding open -a Numbers or osascript -e 'activate application “Numbers”' to my filter script then Numbers gets focus, but no list is generated. I can't see what to do at this point, so here is the debug information that hopefully will help someone steer me in the right direction. Alfred debug window: for a "failed" run [15:28:57.162] Numbers Sheets - pmf[Script Filter] Queuing argument '(null)' for a "successful" run [15:30:36.081] Numbers Sheets - pmf[Script Filter] Queuing argument '(null)' [15:30:36.389] Numbers Sheets - pmf[Script Filter] Script with argv '(null)' finished [15:30:36.392] Numbers Sheets - pmf[Script Filter] {"items": [{"uid":"nBaseline Running Costs","title":"re_20 ... Any help would be much appreciated.
  8. I would like to call the 1Password 1Click Bookmarks integration (1p keyword in my case) from AppleScript. I do this to call other workflows using an External Trigger. Is this possible with the 1p integration? For context, I regularly launch a website and open a specific group in DEVONthink and a specific sheet in Numbers as part of a finance workflow. I have used an external trigger to have the Numbers workflow call the DEVONthink workflow with the same argument taken from the Numbers workflow script filter. I would like to also fire 1p from that same AppleScript.
  9. I just downloaded your workflow and quickly stepped through all the options - it looks really good, thank you for sharing your work. I did get one error though ... I then read about the use-of options and ran use-of-3, but the result was the same. I am running Omnifocus 3.6.4 and Alfred 4.0.9 on macOS Mojave 10.14.6
  10. Sorry to hear that. As I stated earlier, the only change that I made was to escape quotes (") in group names, so if deleting your groups with quotes (") didn't help then I don't have any more insight. I made the change in the script, dtp-list-groups.applescript, which I believe is the only AppleScript in the WorkFlow. If this doesn't make sense, best wait for @brunoc but it isn't going to help with your other groups.
  11. @nestorito any changes that I made will only address group names with quotes(") which break the workflow according to @brunoc Here is how I found my groups that contain quotes (") Hope this helps.
  12. @brunoc I think this works: The strategy is to escape the quote (") as (\") as required for JSON. All I did was introduce a "findAndReplaceInText" generic routine for replacing text in strings from the Mac Automation Scripting Guide which can then be used to escape the group name strings. I used that routine in your "addToGroups" to replace any quotes (") within "theName" to (\"). The routine string parameters are actually "\"", and "\\\" To add a single quote to a string in AppleScript already requires it be specified as \" To specify the required output means adding two backslashes, I think the first escapes the second! When I look at the JSON output, your original code using "theName" gives: "2019-08-19: 3" tie in west pasture" which causes a problem for JSON. However, using the modified code with "theEscapedName" gives: "2019-08-19: 3\" tie in west pasture" which is accepted by JSON and doesn't seem to affect the functioning of the rest of your code.
  13. @brunoc from what I can see, you're much better than me! Maybe someone else will be able to help out, and I will take a look myself. If I make any progress I will share it with you.
  14. @brunoc I just did a proof of concept test using my small test database that has the problematic group name 1. I ran "dtp" and forced the cache to update - it failed, as usual, because of the extra quote ("). 2. I then went to the cache and edited the "broken" jsonOutput by inserting a backslash (\) in front of the extra quote (") 3. I then reran "dtp" and this time there was no error and everything works as expected ... until the cache updates. Here is the window showing the group name with the internal quote ("). Selecting this group works as expected and the group is opened within DEVONthink correctly!
  15. @brunoc I have looked at my databases and I do have some groups with a quote (") in the name, and that is causing the problem. I created a small test database containing a group with a quote (") in the name. I then stepped through your script: dtp-list-groups.applescript (outside of Alfred) and captured the jsonOutput. I then looked at that data with a JSON formatter and I get an error unless: 1. I manually delete the extra quote (") 2. I manually insert a backslash (\) in front of the quote (") I see how an extra quote would cause problems given the reliance of the quote (") in the JSON format itself. However, I did find that people are using backslashes to escape the quote (") in similar situations How to escape double quotes in JSON. I don't know if you can encode the strings to protect the quote (") going into the jsonOutput or how this might affect the query side of your script. In the meantime, I will remove the quotes (") from those group names. Thanks again for providing this very useful workflow.
  • Create New...