Sign in to follow this  
Followers 0
francesco

Error lines display

9 posts in this topic

I wrote a little exe that lets me make wmi calls, the problem that I have is that if an error is detected AutoIt displays the offending line in a message box, can I disable this, I would like to get just the error through the Exit () function.

Thanks in advance.

Share this post


Link to post
Share on other sites



I wrote a little exe that lets me make wmi calls, the problem that I have is that if an error is detected AutoIt displays the offending line in a message box, can I disable this, I would like to get just the error through the Exit () function.

Thanks in advance.

<{POST_SNAPBACK}>

it's an option you can use with Opt()

you you just want to use Opt("RunErrorsFatal",0)

RunErrorsFatal Sets if the script should terminate with a fatal error if a Run/RunWait function fails due to bad paths/file not found/Bad login IDs:

1 = fatal error (default)

0 = silent error (@error set to 1)


1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

Thanks but it did not work, I am attaching the code, when it fails it displays the line.

$sScheduleID = "{00000000-0000-0000-0000-000000000001}"

$oWMIservice = ObjGet("winmgmts:\\" & $MyCompName & "/root/ccm")

if @error = 0 then

$oInstance = $oWMIservice.Get("SMS_Client")

if @error = 0 then

$oParams = $oInstance.Methods_("TriggerSchedule").inParameters.SpawnInstance_()

if @error = 0 then

$oParams.sScheduleID = $sScheduleID

if @error = 0 then

$oWMIservice.ExecMethod("SMS_Client", "TriggerSchedule",$oParams) if @error = 0 Then

Exit

Else

Exit(1)

EndIf

EndIf

EndIf

EndIf

EndIf

Exit(1)

Share this post


Link to post
Share on other sites

Thanks but it did not work, I am attaching the code, when it fails it displays the line.

$sScheduleID = "{00000000-0000-0000-0000-000000000001}"

$oWMIservice =  ObjGet("winmgmts:\\" & $MyCompName  & "/root/ccm")

if @error = 0 then

  $oInstance = $oWMIservice.Get("SMS_Client")

  if @error = 0 then

  $oParams = $oInstance.Methods_("TriggerSchedule").inParameters.SpawnInstance_()

  if @error = 0 then

    $oParams.sScheduleID = $sScheduleID

    if @error = 0 then

    $oWMIservice.ExecMethod("SMS_Client", "TriggerSchedule",$oParams)    if @error = 0 Then

      Exit

    Else 

      Exit(1)

    EndIf

    EndIf

  EndIf

  EndIf

EndIf

Exit(1)

<{POST_SNAPBACK}>

what line is being displayed? could you take a screenshot of the error message? it may not be one that is generated by autoit

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

I have attached screenshot

<{POST_SNAPBACK}>

did you add the:

Opt("RunErrorsFatal",0)

to the top of the script? also, another thing i noticed...

$oWMIservice.ExecMethod("SMS_Client", "TriggerSchedule",$oParams)    if @error = 0 Then

      Exit

    Else 

if the call is generating the error, the error would be handled (displayed or disregarded by the Opt()) prior to the execution of your condition check...

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

Yes at the beginning of the script.

Share this post


Link to post
Share on other sites

Thanks but it did not work, I am attaching the code, when it fails it displays the line.

What you need is "COM Error Handling". Search the help file for that string and read the sample code.

In short, you install a new Error handling function.

$oMyError = ObjEvent("AutoIt.Error","MyErrFunc"); Install a custom error handler

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

Thanks, that seems to have fixed the issue.

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