Tasker JavaScriptlet prepending "undefined" in String



  • I maintain shows, and films from several platforms within an OrgMode File. Now the string you get when sharing from netflix has unnecessary information. Netflix Shared Link in Orgzly

    I get rid of that with Tasker and a Java Scriptlet.

    var endName = astext.search(" auf Netflix gesehen?") -1;
    var text = astext.slice(15,endName);
    endName = endName+24;
    var replacer = astext.slice(0,endName);
    var link = String(astext.replace(replacer));
    

    With astext as input source from AutoShare Netflix Toast Interception.

    So far so good, but as I have actually never used JavaScript before I get to a problem I don't really understand.

    Infront of my string stored in link there is "undefinded" prepended. I don't really know if I mess up JavaScript syntax or if there is something special with the interpreter Tasker is using. undefined String prepended

    This also happens if I instead of "resharing" the link simply print it out via Flash Task in Tasker



  • I don't have experience with scripts in Tasker but if it uses common JavaScript then you should be able to remove the text before the URL easily using this script:

    var idx = astext.indexOf("https://");
    var link = astext.substring(0,idx);
    

    First search for the string https:// and save the start index. Then cut everything away from start to the saved index.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2