Jump to content

oorahduc

Member
  • Posts

    5
  • Joined

  • Last visited

Posts posted by oorahduc

  1. Hey Vero!

     

    First off, I want to thank you for all the effort you and Andrew have put into Alfred over the years. I've been a very happy user for a long time now.

     

    I don't use any other apps that affect the keyboard in any way - confirmed that in accessibility. I think the issue stems from my keyboard's "Key Repeat" and "Delay Until Repeat" which are 100% fast and 100% short (screenshot). The strange thing about the behavior though, is that it's not 100% of the time. When alfred _does_ begin to do merging with single key presses, adding a small delay between the CMD press and the C press copies normally instead of merging. Given that it's not a consistent behavior I'm unsure of what else could be an influence, but at least there's a workaround. :)

    Screen Shot 2017-06-06 at 8.58.17 AM.png

  2.  

    I think its complaining about the an index out of range. You need to be sure your "arglist" list really has three entries when you split it.

    I incorporated your modifications to main() - tidying up indeed. Unfortunately that didn't help the XML error. I am validating that arglist is getting split, though. In my code I assigned separate vars to the indexes of arglist to be certain it was splitting here:

            arglist = query.split(',')
            port = arglist[0]
            srv1 = arglist[1]
            srv2 = arglist[2]
    

    and my wf.add_item is calling those vars here:

            wf.add_item(
                title =  "Jump from %s to %s" % (srv1,srv2),
                arg = "-A -t -L 9800:localhost:{0} -L {1}:localhost:{2} bvi@{3} ssh -L {4}:localhost:9800 -L {5}:localhost:80 bvi@{6}".format(randport1,port,randport2,srv1,randport1,randport2,srv2),
                valid = True
                )
    

    and I am seeing it used those vars in the arg it creates in the debug window here:

    [ERROR: alfred.workflow.input.scriptfilter] XML Parse Error 'The operation couldn’t be completed. (NSXMLParserErrorDomain error 4.)'. Row (null), Col (null): 'Document is empty' in XML:
    9999,myserverip1,myserverip2
    <?xml version="1.0" encoding="utf-8"?>
    <items><item valid="yes"><title>Jump from 11 to 11</title><subtitle /><arg>-A -t -L 9800:localhost:5923 -L  9999:localhost:5318 bvi@myserverip1 ssh -L 5923:localhost:9800 -L 5318:localhost:80 bvi@myserverip2</arg></item></items>
    

    Still at a loss here...

  3. The title basically says what I'm trying to do. 

     

    I have a python script using deanishe's alfred-workflow library that I'm using to build an ssh CLI string.

     

    Workflow is set up like this:

     

    workflow.png?_subject_uid=377869981&w=AA

     

    The Script Filter runs "python jump.py {query}", or attempts to.

     

    jump.py looks like the following, and is meant to take args such as "9999,192.168.100.100,50.57.203.223", and buildout 'query', which should be passed to the Terminal Command action of "ssh {query}

    def main(wf):
        if len(wf.args):
            query = wf.args[0]
        else:
            query = None
        print query
        log.debug(query)
        arglist = query.split(',')
        randport1 = random.randint(5000,7000)
        randport2 = random.randint(5000,7000)
        port = arglist[0]
        srv1 = arglist[1]
        srv2 = arglist[2]
        query = "-A -t -L 9800:localhost:{0} -L {1}:localhost:{2} user@{3} ssh -L {4}:localhost:9800 -L {5}:localhost:80 user@{6}".format(randport1,port,randport2,srv1,randport1,randport2,srv2)
        wf.add_item(
            title =  "Jump from %s to %s" % (srv1,srv2),
            arg = "-A -t -L 9800:localhost:{0} -L {1}:localhost:{2} user@{3} ssh -L {4}:localhost:9800 -L {5}:localhost:80 user@{6}".format(randport1,port,randport2,srv1,randport1,randport2,srv2),
            valid = True
            )
        wf.send_feedback()
    
    # Mainloop
    if __name__ == u"__main__":
        wf = Workflow()
        log = wf.logger
        sys.exit(wf.run(main))
    

     

     

    This is the debug output I get... I'm not terribly familiar with XML, so I don't know what's going on here. The confusing thing is I have another script that is identical in the way it takes the args passed through Alfred, splits them into a list, and then assigns it to key value pairs in a dict. It works fine..

    <?xml version="1.0" encoding="utf-8"?>
    <items><item valid="no"><title>Error in workflow 'com.alfred.custconn'</title><subtitle>list index out of range</subtitle><icon>/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertStopIcon.icns</icon></item></items>
    [STDERR: alfred.workflow.input.scriptfilter] 15:18:37 jump.py:28 DEBUG     9999,11.48.54.65,11.11.11.1
    [INFO: alfred.workflow.input.scriptfilter] 9999,192.168.100.100,50.57.203.223
    [ERROR: alfred.workflow.input.scriptfilter] XML Parse Error 'The operation couldn’t be completed. (NSXMLParserErrorDomain error 4.)'. Row (null), Col (null): 'Document is empty' in XML:
    9999,192.168.100.100,50.57.203.223
    <?xml version="1.0" encoding="utf-8"?>
    <items><item valid="yes"><title>Jump from 192.168.100.100 to 50.57.203.223</title><subtitle /><arg>-A -t -L 9800:localhost:6678 -L  9999:localhost:5025 user@192.168.100.100 ssh -L 6678:localhost:9800 -L 5025:localhost:80 user@50.57.203.223</arg></item></items>
    
×
×
  • Create New...