Sign in to follow this  
Followers 0
Jac

Autoit Error

7 posts in this topic

I have a script that run when user logon and sometime i get this error

Line -1:

Error: The requested action with this object has failed

How can i debug that kind of error ?

Is it possible that user don't see that kind of error too

Thanks !

Share this post


Link to post
Share on other sites



Hi Jac,

Doing a search of your topic, it's been found many times with the search feature or is listed as a non-descriptive topic.

Please do a search before posting new thread topics.

And please use descriptive topics so that others that do use the search feature may also find what they are seeking.

(You'll also find that using descriptive topics, will get people in your thread that know how to answer your questions, those same people ignore non-descriptive topics).

Thanks.

Share this post


Link to post
Share on other sites

I have a script that run when user logon and sometime i get this error

Line -1:

Error: The requested action with this object has failed

How can i debug that kind of error ?

Is it possible that user don't see that kind of error too

Thanks !

If you are making COM object calls of your own in the script, then add a COM error handler (see help file).

If you have IE.au3 included in your script, add _IEErrorHandlerRegister() to it (see help file).

You can also run the script from SciTE for testing so errors like that go to the console with much more detail.

:)


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

Share this post


Link to post
Share on other sites

If you are making COM object calls of your own in the script, then add a COM error handler (see help file).

If you have IE.au3 included in your script, add _IEErrorHandlerRegister() to it (see help file).

You can also run the script from SciTE for testing so errors like that go to the console with much more detail.

:)

Ok thanks for the tip i ran the script on the computer that have the error and here is the output of the error

The requested action with this object has failed.:

$HD = $pcinfo & String(Round((Number($object.TotalSize) / (1024 * 1024 * 1024)), 2)) & " Gb \ " & String(Round((Number($object.FreeSpace) / (1024 * 1024 * 1024)), 2))

$HD = $pcinfo & String(Round((Number($object.TotalSize^ ERROR

->12:57:19 AutoIT3.exe ended.rc:1

>Exit code: 1 Time: 4.654

Here is the function

$objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")

$DirInventaire = @WorkingDir & "\"

$NOM_PC = @ComputerName & ".txt"

$NOM_PC = $DirInventaire & $NOM_PC

;Drive

$objFSO = ObjCreate("Scripting.FileSystemObject")

$colDrives = $objFSO.Drives

For $object In $colDrives

IF $object.DriveType == 1 Then

$RemovableDrive = "Removable Drive"

IniWrite($NOM_PC,"HARDWARE",$object.DriveLetter & ":\" ,$RemovableDrive)

$RemovableDrive = ""

ElseIf $object.DriveType == 2 Then

$HD = $pcinfo & String(Round((Number($object.TotalSize) / (1024 * 1024 * 1024)), 2)) & " Gb \ " & String(Round((Number($object.FreeSpace) / (1024 * 1024 * 1024)), 2))

IniWrite($NOM_PC,"HARDWARE",$object.DriveLetter & ":\" ,$HD)

ElseIf $object.DriveType == 3 Then

$MapDrive = "Map Drive to " & DriveMapGet($object.DriveLetter & ":")

IniWrite($NOM_PC,"HARDWARE",$object.DriveLetter & ":\" ,$MapDrive)

$MapDrive = ""

ElseIf $object.DriveType == 4 Then

$Opticaldrives = "CD-ROM"

IniWrite($NOM_PC,"HARDWARE",$object.DriveLetter & ":\" ,$Opticaldrives)

$Opticaldrives = ""

EndIf

Next

On all my other pc (around 200 ) i have no problem

Can it help you ?

Thanks!

Share this post


Link to post
Share on other sites

Ok thanks for the tip i ran the script on the computer that have the error and here is the output of the error

The requested action with this object has failed.:

$HD = $pcinfo & String(Round((Number($object.TotalSize) / (1024 * 1024 * 1024)), 2)) & " Gb \ " & String(Round((Number($object.FreeSpace) / (1024 * 1024 * 1024)), 2))

$HD = $pcinfo & String(Round((Number($object.TotalSize^ ERROR

->12:57:19 AutoIT3.exe ended.rc:1

>Exit code: 1 Time: 4.654

Here is the function

$objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")

$DirInventaire = @WorkingDir & "\"

$NOM_PC = @ComputerName & ".txt"

$NOM_PC = $DirInventaire & $NOM_PC

;Drive

$objFSO = ObjCreate("Scripting.FileSystemObject")

$colDrives = $objFSO.Drives

For $object In $colDrives

IF $object.DriveType == 1 Then

$RemovableDrive = "Removable Drive"

IniWrite($NOM_PC,"HARDWARE",$object.DriveLetter & ":\" ,$RemovableDrive)

$RemovableDrive = ""

ElseIf $object.DriveType == 2 Then

$HD = $pcinfo & String(Round((Number($object.TotalSize) / (1024 * 1024 * 1024)), 2)) & " Gb \ " & String(Round((Number($object.FreeSpace) / (1024 * 1024 * 1024)), 2))

IniWrite($NOM_PC,"HARDWARE",$object.DriveLetter & ":\" ,$HD)

ElseIf $object.DriveType == 3 Then

$MapDrive = "Map Drive to " & DriveMapGet($object.DriveLetter & ":")

IniWrite($NOM_PC,"HARDWARE",$object.DriveLetter & ":\" ,$MapDrive)

$MapDrive = ""

ElseIf $object.DriveType == 4 Then

$Opticaldrives = "CD-ROM"

IniWrite($NOM_PC,"HARDWARE",$object.DriveLetter & ":\" ,$Opticaldrives)

$Opticaldrives = ""

EndIf

Next

On all my other pc (around 200 ) i have no problem

Can it help you ?

Thanks!

Ive had the function

$oMyError = ObjEvent("AutoIt.Error", "ComError")

;COM Error function

Func ComError()

If IsObj($oMyError) Then

$HexNumber = Hex($oMyError.number, 8)

SetError($HexNumber)

Else

SetError(1)

EndIf

Return 0

EndFunc

And now i dont get any error message

Thanks !

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Ive had the function

$oMyError = ObjEvent("AutoIt.Error", "ComError")

;COM Error function

Func ComError()

If IsObj($oMyError) Then

$HexNumber = Hex($oMyError.number, 8)

SetError($HexNumber)

Else

SetError(1)

EndIf

Return 0

EndFunc

And now i dont get any error message

Thanks !

Well, you don't SEE the error because you are handling it. Unless you test for @error <> 0 after that call, you'll never know it happened, but it did. To see the error (assuming you want to) modify the error handler:
;COM Error function
Func ComError()
    If IsObj($oMyError) Then
        $HexNumber = Hex($oMyError.number, 8)
        MsgBox(16, "COM Error!", "$HexNumber = " & $HexNumber)
        SetError($HexNumber)
    Else
        SetError(1)
    EndIf
    Return 0
EndFunc ;==>ComError

If you want to find the actual problem, you'll have to dig into why that machine has drives that don't have the .TotalSize property (perhaps a different OS or SP level).

:)

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

Share this post


Link to post
Share on other sites

Well, you don't SEE the error because you are handling it. Unless you test for @error <> 0 after that call, you'll never know it happened, but it did. To see the error (assuming you want to) modify the error handler:

;COM Error function
Func ComError()
    If IsObj($oMyError) Then
        $HexNumber = Hex($oMyError.number, 8)
        MsgBox(16, "COM Error!", "$HexNumber = " & $HexNumber)
        SetError($HexNumber)
    Else
        SetError(1)
    EndIf
    Return 0
EndFunc;==>ComError

If you want to find the actual problem, you'll have to dig into why that machine has drives that don't have the .TotalSize property (perhaps a different OS or SP level).

:)

Ok great idea !

Thanks !

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