Jump to content

Exception Occured Script Line -1 - Variable must be of type 'Object'


BobRoss
 Share

Recommended Posts

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 by BobRoss
Link to comment
Share on other sites

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

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 :unsure:

EDIT - And thanks for taking the time to reply!

Cheers

Bob

Edited by BobRoss
Link to comment
Share on other sites

Where are you seeing the error -1?

 

If I run the compiled exe from a xenapp session, firstly get;

rs6b77.png

Then after Ok'ing the above this one;

dg5lx3.png

Followed by the MsgBox but returning 0 for the variable & not the value (which was givenname);

2eebxj7.png

Does that make my waffling any clearer? :idiot:

If not let me know.

Thanks again for the input.

Cheers

Bob

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...