BobRoss Posted September 4, 2014 Share Posted September 4, 2014 (edited) Hi All, Now before I start, I have trawled through the forum & elsewhere for the last 24 hours or so & found nothing to even point me in the right direction. I have a rather large script that's doing various (AD reads & applying RegWrites based on the SID & AD reads....) & I've stripped it all back & the problem appears to lie with the create object which is calling a sproc I wrote to pull back various based on params passed. Now for the actual issue, all worked fine first time everywhere apart from within a Citrix xenapp session which is when I'm getting hit with the Exception Occured Script Line -1 - Variable must be of type 'Object'. Here is a stripped back portion which I've been testing with against xenapp (with a MsgBox added to easily see if anything did return), can anyone notice anything glaringly stupid that I'm doing? Global $AppError = ObjEvent("AutoIt.Error","ErrFunc") $Emp=@UserName $adDSN="Driver={SQL Server};Server=*****;Database=*****;Uid=****;Pwd=*****" $adCN = ObjCreate ("ADODB.Connection") $adCN.Open ($adDSN) $FNsQuery = "exec [ooo_sp_ad_user] @user="&$Emp&",@type=1" $FNresult = $adCN.Execute($FNsQuery) $ADFirstName=$FNresult.Fields("").Value MsgBox(0, "AD Test", $ADFirstName) $adCN.Close Func ErrFunc() Local $HexNumber Local $strMsg $HexNumber = Hex($AppError.Number, 8) $strMsg = "Error Number: " & $HexNumber & @CRLF $strMsg &= "WinDescription: " & $AppError.WinDescription & @CRLF $strMsg &= "Script Line: " & $AppError.ScriptLine & @CRLF MsgBox(0, "ERROR", $strMsg) SetError(1) Endfunc Any pointers at all would be greatly appreciated. Thanks Bob Edited September 4, 2014 by BobRoss Link to comment Share on other sites More sharing options...
computergroove Posted September 4, 2014 Share Posted September 4, 2014 What is the Citrix XenApp trying to do? What device is the Citrix xenapp running on? It sounds like your error isn't coming from autoit. If you are running Citrix from a mobile device to remote control a desktop then where are you seeing the error -1? Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html Link to comment Share on other sites More sharing options...
BobRoss Posted September 4, 2014 Author Share Posted September 4, 2014 (edited) What is the Citrix XenApp trying to do? What device is the Citrix xenapp running on? It sounds like your error isn't coming from autoit. If you are running Citrix from a mobile device to remote control a desktop then where are you seeing the error -1? Â The compiled executable will run once at user login, it uses @username to identify the end user then passes this to the sproc along with an int value which identifies the process required at that time. Xenapp is running on a farm of 8 mixed vmware & physical servers, no mobile devices, purely a user logging into a Citrix session in an office environment & me wanting to catch said user & apply specific registry values based on said user. I just didn't know whether I was missing something, it works as I'd expect on a multitude of OS's from a local viewpoint, it's just when you chuck Xenapp into the mix it doesn't want to know. Any suggestions in terms of altering the ADODB code? I'm a sql dba so forgive my Autoit ignorance If I've given any off EDIT - And thanks for taking the time to reply! Cheers Bob Edited September 4, 2014 by BobRoss Link to comment Share on other sites More sharing options...
computergroove Posted September 4, 2014 Share Posted September 4, 2014 Where are you seeing the error -1? Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html Link to comment Share on other sites More sharing options...
BobRoss Posted September 4, 2014 Author Share Posted September 4, 2014 Where are you seeing the error -1? Â If I run the compiled exe from a xenapp session, firstly get; Then after Ok'ing the above this one; Followed by the MsgBox but returning 0 for the variable & not the value (which was givenname); Does that make my waffling any clearer? If not let me know. Thanks again for the input. Cheers Bob Link to comment Share on other sites More sharing options...
Danp2 Posted September 4, 2014 Share Posted September 4, 2014 Add some error checking after this line: $adCN = ObjCreate ("ADODB.Connection") Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
ripdad Posted September 4, 2014 Share Posted September 4, 2014 -1 means that the script is compiled. Run the script uncompiled to get the line number. "The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now