Katharsis

Possible ObjCreate problem with new AutoIt version

27 posts in this topic

#1 ·  Posted (edited)

...or maybe with the way it now communicates with CDO.DropDirectory.

We have a script that monitors e-mails that come in to a drop directory. The script looks at the e-mails and sends a response accordingly to the user that sent the e-mail. However, after updating to the latest AutoIt, I cannot compile due to a supposed syntax error which does not exist.

Here is the relevant code:

$objDropDirectory = ObjCreate("CDO.DropDirectory")
$colMessageCollection = $objDropDirectory.GetMessages($DropFolder)
If $colMessageCollection.Count > 0 Then
   For $msg In $colMessageCollection
   $fileFullPath = $colMessageCollection.Filename($msg)
      If StringInStr($msg.To, "daily", 2) Then
         ...do stuff...
      EndIf
   Next
EndIf
The error I receive upon compiling is this:

(36,26) : ERROR: missing separator character after keyword.
   If StringInStr($msg.To,

Clearly, there is a separator character. The comma is right there. This wasn't happening before 3.3.8.x. Any ideas?

Edited by Katharsis

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Is this error from Au3Check or from the compiler? If possible try to ignore it. What happens if you add a space after .To?

Propably Au3Check messes up since To is a keyword when using the for-loop.

Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

What version of AU3check you are getting this warning from as the current Beta doesn't give this error for me with the posted snippet.


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

AU3Check (1.54.22.0) throws the same error message for me too. Maybe just change $msg.To to $msg.To()?

Edited by KaFu

Share this post


Link to post
Share on other sites

The parentheses fixed it. Thanks!

Also, the Au3Check is version 1.54.22.0.

Share this post


Link to post
Share on other sites

Katharsis,

This was covered in the v3.3.8.0 changelog: ;)

"Changed: Parentheses are required when invoking objects after all method names in order to have correct internal handling"

Always worth a look in there when you upgrade. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

How would AU3Check know if .To is method or property?

This has nothing to do with that. This was a bug in AU3Check where it was confusing AutoIt's keywords and object prop/methods. It was fixed some time ago.

It's wrong to use parentheses here.

Edited by trancexx

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

I have instaled today latest autoit (Scite 14.01.22.21, AU3 v3.3.12.0, Beta v3.3.13.19) and encounter the same issue.

I added parentheses to the method name and this not help to rsolve the error:

Here is the error and the function (from SMTP UDF):

>Running AU3Check (3.3.12.0)  from:C:\Program Files (x86)\AutoIt3  input:C:\Automation\tmp\UI7.au3
"C:\Automation\tmp\includes\OnAutoItErrorRegister.au3"(565,15) : error: missing separator character before keyword.
    $objEmail.To
~~~~~~~~~~~~~~^
"C:\Automation\tmp\includes\mailer.au3"(33,15) : error: missing separator character before keyword.
    $objEmail.To
~~~~~~~~~~~~~~^
Func __OnAutoItErrorRegister_INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $s_Body = "", $s_CcAddress = "", $s_BccAddress = "", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0)
    Local $objEmail = ObjCreate("CDO.Message")
    If Not IsObj($objEmail) Then Return SetError(1, 0, 0)

    $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
    $objEmail.To = $s_ToAddress

    Local $i_Error = 0
    Local $i_Error_desciption = ""

    If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress
    If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress

What am I supposed to do to resolve this issue?

Thanks


Be Green Now or Never (BGNN)!

Share this post


Link to post
Share on other sites

Install the latest Beta version of AutoIt.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Install the latest Beta version of AutoIt.

 

I did it and mentioned the version in my previous post.

It is 3.3.13.19.

Downloaded from here: https://www.autoitscript.com/autoit3/files/beta/autoit/

 

It is not working.

Thanks

Edited by lsakizada

Be Green Now or Never (BGNN)!

Share this post


Link to post
Share on other sites

Sorry, missed that :>

This >bug has been reported a few times and the latest beta always resolved the issue.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Sorry, missed that :>

This >bug has been reported a few times and the latest beta always resolved the is

 

 

Is there any chance that the bug was inserted in the latest beta again?

As much as I understood this is a bug of AU3Check,

maybe this tool is still buggy?

Regards


Be Green Now or Never (BGNN)!

Share this post


Link to post
Share on other sites

DIdn't have this problem myself. But it seems that the latest beta solved the problem for the other users.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

Hi Water, thanks for the reply.

Anyway, I reinstall and install the all Autoit components several times with different options for 32/64 bit and made sure the installation folder is clean

but, the error still exists.

I think it is a bug that was not resolved completely.

Edited by lsakizada

Be Green Now or Never (BGNN)!

Share this post


Link to post
Share on other sites

When I run the SciTE "SyntaxCheck Prod" tool for your code I get the same error.

When I run the SciTE "SyntaxCheck Beta" tool for your code I get no error. Beta = 3,3.13.19

You are sure you run the Beta version?

Can you post the Scite output?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

The problem isn't in AutoIt, it's in Au3Check and has been fixed in the latest version of that tool.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

But Au3Check is part of the AutoIt download as described in post #10, isn't it?

I suspect the OP has installed the latest beta, but doesn't run the SyntaxCheck Beta.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

When I run the SciTE "SyntaxCheck Prod" tool for your code I get the same error.

When I run the SciTE "SyntaxCheck Beta" tool for your code I get no error. Beta = 3,3.13.19

You are sure you run the Beta version?

Can you post the Scite output?

 

This is the output:

Look like it is indeed running the  AU3Check (3.3.12.0). How come?

BTW: The Compiler is running the same version AU3Check (3.3.12.0).

In the compiler: Running Beta + "Run AU3Check before compilation" checkbox is checked BUT the AU3Check version is still kept AU3Check (3.3.12.0).

EDIT: There is a little bug in the presentation of the AU3Check (3.3.12.0). Its corrected itself after running as beta and restarting the UI.

I think my issue is resolved.

>"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Automation\tmp\UI7.au3" /UserParams    
+>08:30:43 Starting AutoIt3Wrapper v.14.801.2025.0 SciTE v.3.4.4.0   Keyboard:00000409  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64    Environment(Language:0409)
+>         SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE   UserDir => C:\Users\bik\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\Users\bik\AppData\Local\AutoIt v3\SciTE 
>Running AU3Check (3.3.12.0)  from:C:\Program Files (x86)\AutoIt3  input:C:\Automation\tmp\UI7.au3
"C:\Automation\tmp\includes\OnAutoItErrorRegister.au3"(566,12) : error: missing separator character before keyword.
    $objEmail.To
    ~~~~~~~~~~^
"C:\Automation\tmp\includes\mailer.au3"(33,15) : error: missing separator character before keyword.
    $objEmail.To
~~~~~~~~~~~~~~^
C:\Automation\tmp\UI7.au3 - 2 error(s), 0 warning(s)
!>08:30:44 AU3Check ended. Press F4 to jump to next error.rc:2
+>08:30:44 AutoIt3Wrapper Finished.
>Exit code: 2    Time: 1.458
Edited by lsakizada

Be Green Now or Never (BGNN)!

Share this post


Link to post
Share on other sites

Great. I knew the problem would be solved by using the correct version of Au3Check.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#20 ·  Posted (edited)

Sorry for posting on a 3 years old post, but 3 years later this bug seems not to have been fixed on the production version...

I can't use properties that have names like keywords (I'm having the exact problem, the property name is also 'To').

Luckly, I'm developing the object, so I'm able to change the "To" property name to something else. Do I still need to use Beta version to have the fix?

Edited by Jefrey

My stuff

Spoiler

My UDFs  _AuThread multithreading emulation for AutoIt · _ExtInputBox an inputbox with multiple inputs and more features · forceUTF8 fix strings encoding without knowing its original charset · JSONgen JSON generator · _TCPServer UDF multi-client and multi-task (run on background) event-based TCP server easy to do · _TCPClient_UDF multi-server and multi-task (runs on background) event-based TCP client easy to do · ParseURL and ParseStr functions ported from PHP · _CmdLine UDF easily parse command line parameters, keys or flags · AutoPHP Create documents (bills, incomes) from HTML by sending variables/arrays from AutoIt to PHP · (Un)Serialize Convert arrays and data into a storable string (PHP compatible) · RTTL Plays and exports to MP3 Nokia-format monophonic ringtones (for very old cellphones) · I18n library Simple and easy to use localization library · Scripting.Dictionary OOP and OOP-like approach · Buffer/stack limit arrays to N items by removing the last one once the limit is reached · NGBioAPI UDF to work with Nitgen fingerprint readers · Serial/Licensing system require license key based on unique machine ID from your users · HTTP a simple WinHTTP library that allows GET, POST and file uploads · Thread true AutoIt threads (under-dev) · RC4 RC4 encryption compatible with PHP and JS Classes _WKHtmlToX uses wkhtmlto* to convert HTML files and webpages into PDF or images (jpg, bmp, gif, png...) Snippets _Word_DocFindReplaceByLongText replace strings using Word UDF with strings longer than 255 characters (MSWord limit) rangeparser parser for printing-like pages interval (e.g.: "1,2,3-5") EnvParser parse strings/paths with environment variables and get full path Random stuff Super Mario beep sound your ears will hurt

 

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

  • Similar Content

    • GarnetDagger
      By GarnetDagger
      I would love to have some help or guidance 
      I am able to Query from my database but I am not able to Update or insert etc because I lack the knowledge for it
       
      this is my code for to retrieve some data from and works perfect
       
      Dim $ueberschriften = "" Dim $anzahl = 0 Dim $dsncount = 1 Global $DSN = "MTXXV5" Global $Query = "Select * from VIEWS" Func SSSQL($SSQuery) ;SuperSonicSQL     ConsoleWrite($SSQuery & @LF)     $cmboVal = ""     $adoCon = ObjCreate("ADODB.Connection")     $adoCon.Open($DSN)     $adoRs = ObjCreate("ADODB.Recordset")     $adoSQL = $SSQuery     $adoRs.CursorType = 2     $adoRs.LockType = 3     $adoRs.Open($adoSQL, $adoCon)     With $adoRs         Global $QueryAnswer = .GetRows     EndWith     Return $QueryAnswer EndFunc   ;==>SSSQL and this is my failed attempt, The Query is correct but I want to able to use it in autoit instead of have to manual update or insert into flamerobin
       
      $SS_SQL_Insert_or_Update = "INSERT INTO DETECTION (DNAME,DTYPE,WINNAME,AREA,COLOR,MOUSE) VALUES ('PopUpTradeInviteYes        s                    ','SEARCH','XXX','175,240,550,240,65,228,82,234','5062478','0') " Func SSSQLIU($SS_SQL_Insert_or_Update) ;SuperSonicSQL :P     $cmboVal = ""     $adoCon = ObjCreate("ADODB.Connection")     $adoCon.Open($DSN)     $adoRs = ObjCreate("ADODB.Record")     $adoSQL =$SS_SQL_Insert_or_Update ;~     $adoRs.CursorType = 2     $adoRs.LockType = 4     $adoRs.Open($adoSQL, $adoCon) ;~     With $adoRs ;~         Global $QueryAnswer = .GetRows ;~     EndWith ;~     Return $QueryAnswer EndFunc   ;==>SSSQL I am at a total loss and I am just trying this at random but I am also going to sleep now
      I would love to have some minor examples
      "C:\_CC_V10_DetectionTAB.au3" (174) : ==> The requested action with this object has failed.:
      $adoRs.Open($adoSQL, $adoCon)
      $adoRs^ ERROR
    • RichardL
      By RichardL
      Local $sAxName Local $oMSComm $sAxName = "MSCOMMLib.MSComm.1" $oMSComm = ObjCreate($sAxName) MsgBox(0, Default, StringFormat("Name: %s, Obj %d, Err %d", $sAxName, IsObj($oMSComm), @error)) I'm talking to serial ports (for Arduino) using the MSComm object.  It all runs fine from SciTE or .exe.  If I compile to .a3x the object is not created.  I could manage without .a3x but I like it because it compiles faster.
       
       
    • BobRoss
      By 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
    • kokoilie
      By kokoilie
      I'm using irrlight to display 3D models in a window but I can't create any controls in this window
      and I thought I could compile the code and use objcreate () to display the irrlight (3D) part and overlay it with the autoit gui controls

      if it won't work is there a way to add gui controls on to the window created by the .dll?
    • AndyS01
      By AndyS01
      I have a test file that creates an Excel.Application object, and it works OK when I run it with F5, but when I compile it and run the executble, the operation fails.   Here is my code: Opt('MustDeclareVars', 1) Global $oMyError, $oExcel _Main() Exit (1) Func _Main() Local $str $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") ; Initialize a COM error handler If IsObj($oMyError) Then $oExcel = ObjCreate("Excel.Application") If IsObj($oExcel) Then $str = "Created the Excel.Application object OK" Else $str = "ObjCreate() FAILED!" EndIf Else $str = "ObjEvent() FAILED!" EndIf MsgBox(0, "results", $str) EndFunc ;==>_Main Func MyErrFunc() Local $str $str = "We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & Hex($oMyError.number, 8) & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext ClipPut($str) MsgBox(0, "AutoItCOM Test", $str & @CRLF & "(results are in the clipboard)") Exit (1) EndFunc ;==>MyErrFunc Here is the error info:
      We intercepted a COM Error ! err.description is: err.windescription: Not enough storage is available to complete this operation. err.number is: 8007000E err.lastdllerror is: 0 err.scriptline is: -1 err.source is: err.helpfile is: err.helpcontext is: