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

    • Trinnon
      By Trinnon
      I have a question about the @error logging features in _AD_CreateUser.  Hopefully I am just missing something obvious.
      In my app I am creating a user if it does not exist then manipulating some attributes. 
      If the user does exist I would then call another function to remove groups from the user and modify some attributes.
      My question is...
      If the user already Exists, the _AD_CreateUser option gives $iValue = 0 and @error = 0.
      How can @error = 1 for the condition that the user already exists?
       
      I copied a small ship of the code in question along with my full .au3. 
      I am using AD UDF 1.4.9.0 (Water, thanks for the awesome work on this!!!).
      $iValue = _AD_CreateUser ($sOU, $sUser, $sCN)
      If $iValue = 1 Then
            _FileWriteLog ($Log, "Func UserCheck() - User '" & $sUser & "' successfully created ==> Calling UserAttribsNewUser Function.")
            Call ("NewUser")
      ElseIf @error = 1 Then
            _FileWriteLog ($Log, $sUser & " already exists ==> Calling UserAttribsExistingUser Function.")
            Call ("ExistingUser")
       
      AccountSettingConfigurations-Test1.au3
       
    • 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-06-01)
      None  
      Things to come: (last changed: 2018-06-01)
      None
      BTW: If you like this UDF please click the "I like this" button. This tells me where to next put my development effort
    • dangr82
      By dangr82
       
      I have created this function for a database, but I can not make it work. I always have two error messages: "not an error" ... and the file created, in the script directory, does not contain anything.
      Global $sDBName = "Hen.db" Func DatabaseTable() Local $sConnDB _SQLite_Startup() If @error Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", "SQLite.dll Can't be Loaded!") Exit -1 EndIf $sConnDB = _SQLite_Open($sDBName) If @error Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", "Can't Load Database!") Exit -1 EndIf If Not _SQLite_Exec($sDBName, 'CREATE TABLE Animal ("Name", "Age");') = $SQLITE_OK Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", _SQLite_ErrMsg()) If Not _SQLite_Exec($sDBName, 'INSERT INTO Animale VALUES ("Charlie","5");') = $SQLITE_OK Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", _SQLite_ErrMsg()) _SQLite_Close($sConnDB) _SQLite_Shutdown() EndFunc  
    • rudi
      By rudi
      Hello,
       
      from this posting of @Jos https://www.autoitscript.com/forum/topic/162005-getting-windows-users-account-type/?do=findComment&comment=1176831
      I can smoothly check, if a user is a *DIRECT* group member. Has anybody some code to check also, if a user is a *INDIRECT* member of a cascaded group construct?  Maybe with @Melba23 's AD UDF?
       
      The required rights are granted to group "Dept_B" User John is member of group "Dept_A" Group "Dept_A" is member of the group "Dept_B" So in the AD / NTFS FS environment John finally has the rights of both groups But when checking his "membership to group Dept_B" the result is "no member". The approach I can think of would be, to check all Group Members of group "Dept_B" whether they are of type group, then check again if "John" is member of than " 2nd level group"
      Func UserInGroup($InGroup,$ThisUser=@LogonDomain & "/" & @UserName) Local $objUser = ObjGet("WinNT://" & $ThisUser ) For $oGroup in $objUser.Groups If $oGroup.Name = $InGroup Then Return 1 EndIf Next Return 0 EndFunc Any suggestions appreciated, regards, Rudi.
    • water
      By water
      ADAT is a tool to simplify common AD administration tasks. Every administration task has its own tab. It is easy to add new functions (tabs) to the tool. Some often used functions are already available: list users, computers, OUs. File ADAT.ini can be customized to hold the AD logon information if necessary.
      Known Bugs:
      2018-03-07: If the Script started from SciTE works but the "Process" button in the compiled exe does not do anything then please add the following line at the top of your script:
      #Au3Stripper_Ignore_Funcs=Process_Tab*
        BTW: If you like this tool please click the "I like this" button. This tells me where to next put my development effort
×