Jump to content
surrealroad

High Sierra beta & JXA items not actionable [Fixed 3.5 b874 pre-release]

Recommended Posts

Since beta 7 of macOS High Sierra, I've been having issues with Alfred (v3.4.1) not allowing items to be actioned. For example, given this JSON output from a osascript (JS):

{
  "items": [{
    "title": "Add Reminder",
    "arg": -1,
    "valid": true,
    "subtitle": "Create a new reminder to \"something\"",
    "icon": {
      "path": ""
    }
  }],
  "variables": {
    "reminders": "[{\"arg\":-1,\"text\":\"something\",\"body\":\"\",\"date\":\"\",\"list\":\"\",\"priority\":null,\"application\":\"\"}]",
    "quitAfter": "true"
  }
}

(expanded for readability) I get the action showing up in Alfred, but it behaves as if `valid` was set to `false`. In other words, pressing enter doesn't do anything. Prior to beta 7, this had been working fine. I can't find what I could change in my code to resolve this.

image.thumb.png.30a02312fc724ac5885275f0a81056fc.png

Edited by surrealroad

Share this post


Link to post
Share on other sites

@surrealroad My test workflows are working on 10.13 Beta 7.

 

Are you seeing any errors in the Alfred debugger (set to All Info), or in Console.app?  Are any of your Script Filter workflows working (especially non-JS script filter ones)?

Share this post


Link to post
Share on other sites
5 hours ago, Andrew said:

@surrealroad My test workflows are working on 10.13 Beta 7.

 

Are you seeing any errors in the Alfred debugger (set to All Info), or in Console.app?  Are any of your Script Filter workflows working (especially non-JS script filter ones)?

nothing in the debugger, and all other workflows are fine. but AFAIK none of the other workflows are using JXA.

30 minutes ago, deanishe said:

How are you outputting the JSON? Are you returning it or writing it to STDOUT?

 

returning it

Edited by surrealroad

Share this post


Link to post
Share on other sites

Apologies, by "nothing" I meant "no errors or anything out of the ordinary" ;)

Here's the output when I try to run:

Starting debug for 'Reminders for Alfred 3'

[2017-09-06 15:26:44][input.scriptfilter] Queuing argument 's'
[2017-09-06 15:26:44][input.scriptfilter] Queuing argument 'so'
[2017-09-06 15:26:44][input.scriptfilter] Queuing argument 'som'
[2017-09-06 15:26:45][input.scriptfilter] Queuing argument 'some'
[2017-09-06 15:26:45][input.scriptfilter] Script with argument 'some' finished
[2017-09-06 15:26:45][STDERR: input.scriptfilter] /Users/jack/Dropbox/Alfred/Alfred.alfredpreferences/workflows/user.workflow.CDB1A90A-8ABD-4114-9CBC-2E7B38B91258/chrono.min.js
[2017-09-06 15:26:45][input.scriptfilter] {"items":[{"title":"Add Reminder","arg":-1,"valid":true,"subtitle":"Create a new reminder to \"some\"","icon":{"path":""}}],"variables":{"reminders":"[{\"arg\":-1,\"text\":\"some\",\"body\":\"\",\"date\":\"\",\"list\":\"\",\"priority\":null,\"application\":\"\"}]","quitAfter":"false"}}
[2017-09-06 15:26:45][input.scriptfilter] Queuing argument 'somet'
[2017-09-06 15:26:45][input.scriptfilter] Queuing argument 'someth'
[2017-09-06 15:26:45][input.scriptfilter] Queuing argument 'somethi'
[2017-09-06 15:26:45][input.scriptfilter] Queuing argument 'somethin'
[2017-09-06 15:26:45][input.scriptfilter] Queuing argument 'something'
[2017-09-06 15:26:45][input.scriptfilter] Script with argument 'something' finished
[2017-09-06 15:26:45][STDERR: input.scriptfilter] /Users/jack/Dropbox/Alfred/Alfred.alfredpreferences/workflows/user.workflow.CDB1A90A-8ABD-4114-9CBC-2E7B38B91258/chrono.min.js
[2017-09-06 15:26:45][input.scriptfilter] {"items":[{"title":"Add Reminder","arg":-1,"valid":true,"subtitle":"Create a new reminder to \"something\"","icon":{"path":""}}],"variables":{"reminders":"[{\"arg\":-1,\"text\":\"something\",\"body\":\"\",\"date\":\"\",\"list\":\"\",\"priority\":null,\"application\":\"\"}]","quitAfter":"false"}}

 

Share this post


Link to post
Share on other sites

Thanks. I figured it's that workflow, but are we talking about the latest release or an unreleased dev version?

 

To be clear, the workflow works perfectly for me, but I'm not running High Sierra because I don't run beta versions (or .0 versions) of OSes. I just want it to be clear which code you're talking about, in case somebody else can replicate the issue.

Share this post


Link to post
Share on other sites

@surrealroad sorry about the delay on this, I haven't had a dev setup on High Sierra so haven't been able to looking into this with more detail.

 

It looks like Apple's framework or JSON parsing has changed a little, and where Alfred is expecting a string for the "arg" field, you are passing an integer.

 

Before High Sierra, Alfred would happily take any object type and fall back onto the objects description, in terms of e.g number -1, that would be "-1" as a string. This no longer seems to happen. I'm going to look a little deeper into this and likely create a workaround or fix, but in the short term, you can fix this by returning "-1" instead of -1 for the arg.

 

(For reference, the JSON format is here: https://www.alfredapp.com/help/workflows/inputs/script-filter/json/)

Share this post


Link to post
Share on other sites

Update: I'm currently working on a generic fix, as this turns out to be a more holistic issue than framework / JSON. Shouldn't manifest itself much, but better to be safe than sorry :) 

Share this post


Link to post
Share on other sites

×
×
  • Create New...