Jump to content

Autoit error


miki
 Share

Recommended Posts

I have an autoit script that check all the time some cells of an xls file that receive data from DDE.

For this job I use also ExcelCOM udf.

Sometimes I receive a message of error like this one:

Autoit Error

Line 212 (File "C:\ilta\ExcelCom.au3")

If $s_i_Sheet > $oExcel.Worksheets.count Then $s_i_Sheet = $oExcel.Worksheets.count

If $s_i_Sheet > $oExcel.Worksheets^ERROR

Error: The requested action with this object has failed

Normally there isn't a real problem but my script is forced to stop and I dont want it.

In general is there a way to avoid that error messages stop the script?

Link to comment
Share on other sites

I have an autoit script that check all the time some cells of an xls file that receive data from DDE.

For this job I use also ExcelCOM udf.

Sometimes I receive a message of error like this one:

Autoit Error

Line 212 (File "C:\ilta\ExcelCom.au3")

If $s_i_Sheet > $oExcel.Worksheets.count Then $s_i_Sheet = $oExcel.Worksheets.count

If $s_i_Sheet > $oExcel.Worksheets^ERROR

Error: The requested action with this object has failed

Normally there isn't a real problem but my script is forced to stop and I dont want it.

In general is there a way to avoid that error messages stop the script?

You need a com error function defined early in your script, before you start calling COM objects:

; Declare COM Object error handler:
Global $oComError = ObjEvent("AutoIt.Error", "_ComErrFunc")oÝ÷ Ù8^~éܶ*'uçâçjvÞjË"^jwlíjÆ®¶­sc²4ôÒW'&÷"æFÆW ¤gVæ2ô6öÔW'$gVæ2¢6WDW'&÷"¤VæDgVæoÝ÷ ØêâµÆ§v¨­ëhµéeÊ°«aj^çH¶§n¶Øb²Þ¶¶«~º&¦-±¼ iúè²Ö§t^«­¢+Øì´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´(ìչѥ½¸}
½µÉÉÕ¹ ¤(ì
ÕÍѽ´
=4½©ÐÉɽȡ¹±È(ì´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´)Õ¹}
½µÉÉÕ¹ ¤(1½°ÀÌØí!á9ÕµÈô!à ÀÌØí½
½µÉɽȹ¹ÕµÈ°à¤(5Í    ½à ÄØ°ÅÕ½Ðí
=4II=HÌÌìÅÕ½Ðì°ÅÕ½ÐíÕѽ%P
=4ÉɽÈ=ÕÉÌÌìÅÕ½ÐìµÀì
I1µÀì|(QµÀìÅÕ½ÐíÉɽÈ9ÕµÈèÅÕ½ÐìµÀìÀÌØí!á9յȵÀì
I1µÀì|(QµÀìÅÕ½Ðí1¥¹9ÕµÈèÅÕ½ÐìµÀìÀÌØí½
½µÉɽȹÍÉ¥Áѱ¥¹µÀì
I1µÀì|(QµÀìÅÕ½ÐíÍÉ¥ÁÑ¥½¸èÅÕ½ÐìµÀìÀÌØí½
½µÉɽȹÍÉ¥ÁÑ¥½¸µÀì
I1µÀì|(QµÀìÅÕ½Ðí]¥¹ÍÉ¥ÁÑ¥½¸èÅÕ½ÐìµÀìÀÌØí½
½µÉɽȹݥ¹ÍÉ¥ÁÑ¥½¸¤(MÑÉÉ½È Ä¤ìͽµÑ¡¥¹Ñ¼¡¬½ÈÝ¡¸Ñ¡¥Ìչѥ½¸ÉÑÕɹÌ)¹Õ¹ìôôÐí}
½µÉÉÕ¹oÝ÷ ØÌ¢ËZ[®*m±©e«ÞÓ~¢bè%¡¶¥É×wjwlW§¶¥¢«®ìo+aɨv'âq«b¢v®¶­sc²ÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒУ²gVæ7Föâô6öÔW'$gVæ2£²7W7FöÒ4ôÒö&¦V7BW'&÷"æFÆW £²ÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒФgVæ2ô6öÔW'$gVæ2¢Æö6Âb33c´WçVÖ&W"ÒWb33c¶ô6öÔW'&÷"æçVÖ&W"ÂÂb33c´W'&÷$×6p¢b33c´W'&÷$×6rÒbÂgV÷C´4ôÒU%$õ"b333²gV÷C²ÂgV÷C´WFôB4ôÒW'&÷"ö67W&VBb333²gV÷C²fײ5$Äbfײð¢D"fײgV÷C´W'&÷"çVÖ&W#¢gV÷C²fײb33c´WçVÖ&W"fײ5$Äbfײð¢D"fײgV÷C´ÆæRçVÖ&W#¢gV÷C²fײb33c¶ô6öÔW'&÷"ç67&FÆæRfײ5$Äbfײð¢D"fײgV÷C´FW67&Föã¢gV÷C²fײb33c¶ô6öÔW'&÷"æFW67&Föâfײ5$Äbfײð¢D"fײgV÷CµväFW67&Föã¢gV÷C²fײb33c¶ô6öÔW'&÷"çvæFW67&Föà¢ôfÆUw&FTÆörb33c´ÆötfÆRÂb33c´W'&÷$×6r¢6WDW'&÷"²6öÖWFærFò6V6²f÷"vVâF2gVæ7Föâ&WGW&ç0¤VæDgVæ2³ÓÒfwCµô6öÔW'$gVæoÝ÷ Ù8^IëD®º+Õ«mç§víçîËb¢x"½ë2¢ë(ëax-¢×¬µú+§ʮ±à1«­¢+ØÀÌØíÍ}¥}
½Õ¹ÐôÀÌØí½á°¹]½É­Í¡Ñ̹½Õ¹Ð(%¹½ÐÉɽÈQ¡¸(%ÀÌØíÍ}¥}M¡ÐÐìÀÌØíÍ}¥}
½Õ¹ÐQ¡¸ÀÌØíÍ}¥}M¡ÐôÀÌØíÍ}¥}
½Õ¹Ð((ìѸ((¹%(¹%

This is all stuff I learned on this forum, I hope it helps you too! :P

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

You need a com error function defined early in your script, before you start calling COM objects:

; Declare COM Object error handler:
Global $oComError = ObjEvent("AutoIt.Error", "_ComErrFunc")oÝ÷ Ù8^~éܶ*'uçâçjvÞjË"^jwlíjÆ®¶­sc²4ôÒW'&÷"æFÆW ¤gVæ2ô6öÔW'$gVæ2¢6WDW'&÷"¤VæDgVæoÝ÷ ØêâµÆ§v¨­ëhµéeÊ°«aj^çH¶§n¶Øb²Þ¶¶«~º&¦-±¼ iúè²Ö§t^«­¢+Øì´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´(ìչѥ½¸}
½µÉÉÕ¹ ¤(ì
ÕÍѽ´
=4½©ÐÉɽȡ¹±È(ì´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´)Õ¹}
½µÉÉÕ¹ ¤(1½°ÀÌØí!á9ÕµÈô!à ÀÌØí½
½µÉɽȹ¹ÕµÈ°à¤(5Í    ½à ÄØ°ÅÕ½Ðí
=4II=HÌÌìÅÕ½Ðì°ÅÕ½ÐíÕѽ%P
=4ÉɽÈ=ÕÉÌÌìÅÕ½ÐìµÀì
I1µÀì|(QµÀìÅÕ½ÐíÉɽÈ9ÕµÈèÅÕ½ÐìµÀìÀÌØí!á9յȵÀì
I1µÀì|(QµÀìÅÕ½Ðí1¥¹9ÕµÈèÅÕ½ÐìµÀìÀÌØí½
½µÉɽȹÍÉ¥Áѱ¥¹µÀì
I1µÀì|(QµÀìÅÕ½ÐíÍÉ¥ÁÑ¥½¸èÅÕ½ÐìµÀìÀÌØí½
½µÉɽȹÍÉ¥ÁÑ¥½¸µÀì
I1µÀì|(QµÀìÅÕ½Ðí]¥¹ÍÉ¥ÁÑ¥½¸èÅÕ½ÐìµÀìÀÌØí½
½µÉɽȹݥ¹ÍÉ¥ÁÑ¥½¸¤(MÑÉÉ½È Ä¤ìͽµÑ¡¥¹Ñ¼¡¬½ÈÝ¡¸Ñ¡¥Ìչѥ½¸ÉÑÕɹÌ)¹Õ¹ìôôÐí}
½µÉÉÕ¹oÝ÷ ØÌ¢ËZ[®*m±©e«ÞÓ~¢bè%¡¶¥É×wjwlW§¶¥¢«®ìo+aɨv'âq«b¢v®¶­sc²ÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒУ²gVæ7Föâô6öÔW'$gVæ2£²7W7FöÒ4ôÒö&¦V7BW'&÷"æFÆW £²ÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒФgVæ2ô6öÔW'$gVæ2¢Æö6Âb33c´WçVÖ&W"ÒWb33c¶ô6öÔW'&÷"æçVÖ&W"ÂÂb33c´W'&÷$×6p¢b33c´W'&÷$×6rÒbÂgV÷C´4ôÒU%$õ"b333²gV÷C²ÂgV÷C´WFôB4ôÒW'&÷"ö67W&VBb333²gV÷C²fײ5$Äbfײð¢D"fײgV÷C´W'&÷"çVÖ&W#¢gV÷C²fײb33c´WçVÖ&W"fײ5$Äbfײð¢D"fײgV÷C´ÆæRçVÖ&W#¢gV÷C²fײb33c¶ô6öÔW'&÷"ç67&FÆæRfײ5$Äbfײð¢D"fײgV÷C´FW67&Föã¢gV÷C²fײb33c¶ô6öÔW'&÷"æFW67&Föâfײ5$Äbfײð¢D"fײgV÷CµväFW67&Föã¢gV÷C²fײb33c¶ô6öÔW'&÷"çvæFW67&Föà¢ôfÆUw&FTÆörb33c´ÆötfÆRÂb33c´W'&÷$×6r¢6WDW'&÷"²6öÖWFærFò6V6²f÷"vVâF2gVæ7Föâ&WGW&ç0¤VæDgVæ2³ÓÒfwCµô6öÔW'$gVæoÝ÷ Ù8^IëD®º+Õ«mç§víçîËb¢x"½ë2¢ë(ëax-¢×¬µú+§ʮ±à1«­¢+ØÀÌØíÍ}¥}
½Õ¹ÐôÀÌØí½á°¹]½É­Í¡Ñ̹½Õ¹Ð(%¹½ÐÉɽÈQ¡¸(%ÀÌØíÍ}¥}M¡ÐÐìÀÌØíÍ}¥}
½Õ¹ÐQ¡¸ÀÌØíÍ}¥}M¡ÐôÀÌØíÍ}¥}
½Õ¹Ð((ìѸ((¹%(¹%

This is all stuff I learned on this forum, I hope it helps you too! :P

Thank you very much, I will try :nuke:
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...