Skip to main content
1-Visitor
September 23, 2014
Question

[A11316] Unexpected argument Arbortext Editor error

  • September 23, 2014
  • 7 replies
  • 1849 views

I'm facing a problem in one of my XUI windows when I try to load a file from a certain directory; my dialogue is a loading file window and the idea is to load the file from a directory specified by a path loaded with a 'Browse..' button, the problem I'm having is that every time I load certain paths I receive the "[A11316] Unexpected argument error"; I could see this only happens when the directory contains a blank space in the name of any of the directories including in it.


I hope anyone could explain me alittle more about this A11316 error so I could handle it.



Paulette 🙂

    7 replies

    1-Visitor
    September 23, 2014
    It sounds like the problem is with how you use the path specified by the
    user's choice through the Browse button. Since the problem occurs when
    you have a space character in the path, you should try surrounding the
    path with quotes when you use it. Can you provide a sample of the line
    or lines of code where you use the path?


    pzorrilla1-VisitorAuthor
    1-Visitor
    September 23, 2014

    Hello Clay!


    I'm attaching you the code I'm using to select the path and the method in the which one Arbortext is reporting me the error..


    <button id="browse" label="Browse...">



    dlgdoc.getElementById("load_dir_check").setAttribute("checked","false");





    text = dlgdoc.createTextNode(filename);


    }


    </button>


    <script ev:event="DOMActivate" type="text/javascript">


    path = dlgdoc.getElementById("path").firstChild.firstChild.nodeValue;


    var ret; ret = Acl.execute("source docGuru_load_xml_report.acl");




    dlgitem_add_callback($load_file_win, "load_dir_check", "load_reports_dir")... function load_reports_dir(win, dlgitem, event, data, appdata){ ...<




    dlgitem_set_value($win, 'path', $main::ENV['REPORTS_DIRECTORY']); =


    } else if($checked == 1){


    #remove, if there's any, the value in the path


    dlgitem_deactivate($win,'load_file');


    }#Ends ITEM_CHANGED conditional block


    Thanks in advance for your time,



    pzorrilla1-VisitorAuthor
    1-Visitor
    September 23, 2014

    Hello Brian,


    I just uploaded a reply with my code 😄


    Thank you so much,


    Paulette

    18-Opal
    September 24, 2014
    Hi Paulette-

    It's hard to tell without actually running the code, but just eyeballing it, I would guess the problem is with this line:

    Acl.execute("docGuru_load_xml_report::loadReportAndSetData(js_eval('path'))");
    I think the js_eval() is returning the path with spaces in it, which the call to loadReportAndSetData parameter list doesn't know how to handle properly.

    Try something like this instead:

    Acl.execute("docGuru_load_xml_report::loadReportAndSetData(" + path + "))");
    Since you are building the ACL call in Javascript already, you can just insert the value of the JS "path" variable directly, without needing to put js_eval() inside your ACL. Also notice the single quotes before and after, which should help the ACL function call understand that you want the entire string to be considered as a single parameter (which may sometimes contain spaces). The single quotes will also prevent the ACL interpreter from reading any backslashes in the path as string escape characters.

    --Clay
    pzorrilla1-VisitorAuthor
    1-Visitor
    September 29, 2014

    Clay,


    Thank you so much for your help, I was sure the error was related with js_eval line, however I changed it and the error is still there, but, seeing my code I think I identified where the error is thrown, I have a method where I am using the "cd" ACL command, I think that if I define a PATH with spaces it will send me the error, do you have any idea about how to allow "cd" comman using names of directories which have any blank space in it?



    Again, thank you so much for you time 🙂



    Paulette

    18-Opal
    September 29, 2014
    Hi Paulette-

    Ah, ok, then that would be the place to make sure you have the required single-quotes. So, instead of

    cd c:/some/path/with spaces in it

    use

    cd 'c:/some/path/with spaces in it'

    and that should work better. If you need to apply this to a variable value, you may need to construct a command string and then execute it, something like this:

    local newdir = 'c:/some/path/with spaces in it';
    execute("cd " . newdir . ");

    --Clay
    pzorrilla1-VisitorAuthor
    1-Visitor
    October 1, 2014

    Clay,



    Paulette