Jump to content
Sign in to follow this  
BobRoss

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

Recommended Posts

BobRoss

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

Share this post


Link to post
Share on other sites
computergroove

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

Share this post


Link to post
Share on other sites
BobRoss

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

Share this post


Link to post
Share on other sites
computergroove

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

Share this post


Link to post
Share on other sites
BobRoss

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

Share this post


Link to post
Share on other sites
ripdad

-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

Share this post


Link to post
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
Sign in to follow this  

  • Similar Content

    • water
      By water
      Extensive library to control and manipulate Microsoft Active Directory.

      Threads: Development - General Help & Support - Example Scripts - Wiki
      Previous downloads: 30467
       
      Known Bugs: (last changed: 2018-12-03)
      None
        Things to come: (last changed: 2018-12-03)
      None
      BTW: If you like this UDF please click the "I like this" button. This tells me where to next put my development effort
    • BigDaddyO
      By BigDaddyO
      I've recently been getting hammered by Symantec SEP deleting all of my compiled scripts so I'm trying to figure out how I could run my scripts uncompiled.
      Problem is, these scripts are typically launched from inside Citrix sessions that I don't have control of so I can't install AutoIT in there to get all the #Include files that my scripts are using.
      I tried to use AU3Stripper and while, yes that did create a single file and I could run it. it put it in a state that I couldn't easily maintain going forward.
       
      Is there any existing way to pull all the functions and drop them at the end of the main script?  Not sure about the Globals and Constants though, I guess they would have to go to the top which shoves everything else down.  I also need to maintain the current script spacing and comments as I often have to update older scripts and need the comments to help with that.
    • tweakster2010
      By tweakster2010
      Hello All,
      It has been a long time since I posted, role changes etc involving work and I finally am back to modifying a program I write in AutoIt that has AD integration. I am at a point where we are modifying our structure where I am validating users access via what Distribution List they belong to in our AD OU's. What I have run into is the OU is a sub OU of a sub OU now. Meaning: CN=team, OU=DL, OU=Groups, DC=business.com(working), is now CN=Team, OU=SubDL, OU=DL, OU=Groups, DC=business.com (Not working).  Just curious if the AD functionality should be able to read it or maybe I am missing something?
       
      ElseIf _AD_IsMemberOf("CN=Team,OU=Distribution Lists,OU=Groups,DC=business,DC=com", $sFQDN_User) Then #works for primary Distro ElseIf _AD_IsMemberOf("CN=Team,OU=SubDL,OU=Distribution Lists,OU=Groups,DC=business,DC=com", $sFQDN_User) Then #fails for subOU of DL How I am accessing AD to get the information:
      _AD_Open() Global $aUser = _AD_GetObjectsInOU("", "(&(objectCategory=person)(objectClass=user)(samaccountname=" & @UserName & "))", 2, "ADsPath,Displayname,distinguishedName") Global $sDisplayName0 = $aUser[1][1] ; Displayname ;MsgBox(0,"", $sDisplayName0) If StringLeft($sDisplayName0, 2) = "9-" Then $Displaynamestring = StringTrimLeft($sDisplayName0, 2) $Displaynamestring1 = StringTrimRight($Displaynamestring, 6) The error code generated is a 1 with a 0 extended. I assume it is because it cannot find the SubOU.
       
      Thanks for any assistance.
    • antmar904
      By antmar904
      I'm trying to read all cells used in column "C" in excel to an array but not sure how.
       
      Local $NameArray = _Excel_RangeRead($oWorkbook, $oWorkbook.Activesheet, $oWorkbook.Range["C"].End)  
×