Skip to main content

Hello, i’ve created an application via Remote Desktop Services using AutoIT that use $CmdLinen1] and $CmdLinen2] for user and password, when will execute on CMD with “C:/locate.exe user password” work’it, but, execute direct with double click appear the message “Array variable has incorrect number of subscripts or subscript dimension range exceeded” and same thing happen when i execute within Password Safe… whats happen? Theoretically, Password Vault will enter the user and password automatically...

Hello ​@rimeda201 

To simplify your RDS application I recommend you use the PS_Automate utility. This hides the complexities of writing and debugging AutoIT scripts.
You can find the details here on using the utility.https://www.beyondtrust.com/docs/beyondinsight-password-safe/ps/integrations/ps-automate/index.htm 

Here is a kb on setting up ps-automate.https://beyondtrustcorp.service-now.com/csm?id=kb_article_view&sysparm_article=KB0018649 

And here is another kb on configuring and testing a Password Safe applicationhttps://beyondtrustcorp.service-now.com/csm?id=kb_article_view&sysparm_article=KB0017190 

If you would like to continue using an AutoIt script the error you are specifying indicates  you are not using the correct number of parameters when running your compiled AutoIT script. 
You may want to add some error checking to your script and test from the command line.

For example you can add this to your script to test for 2 parameters before running your code.

If $CmdLine$0] <> 2 Then
   MsgBox($MB_OK, "Incorrect number of parameters", "Test.exe <username> <password>")
Else
   test_function($CmdLinei1], $CmdLine12])
EndIf

If you use more or less than the 2 parameters it will show the message box. 

When testing try testing from the command line. If I compiled my script to Test.exe you can use this to test on the cmd.exe command line.

test.exe MyUserName MyPassword

 


It’s works ​@jchandler! Thank you very much!


Reply