Jump to content
Sign in to follow this  
richietheprogrammer

COM reference

Recommended Posts

richietheprogrammer

Hi guys, running into an issue where autoit itself is crashing, not the script. I have a vbscript (COM reference) that works, and I am trying to convert it to an autoit script. Here are the details:

set QPST = CreateObject("QPSTAtmnServer.Application")
   set SelectedPort = QPST.GetSelectedPort
 set Provisioning = SelectedPort.Provisioning


   Data = Provisioning.GetNVItem(Item)

My autoit code:

$oQPST = ObjCreate("QPSTAtmnServer.Application")     

$SelectedPort = $oQPST.GetSelectedPort

  $Provisioning = $SelectedPort.Provisioning
$item= 0
 $Provisioning.GetNVItem($Item)

When the script gets to "$Provisioning.GetNVItem($Item)" , I get an unhandled autoit exception. Any ideas are much much appreciated !!

Edited by richietheprogrammer

Share this post


Link to post
Share on other sites
trancexx

You need COM error handler running to capture errors for you.

Add this at top of your script:

; Error monitoring
Global $oError = ObjEvent("AutoIt.Error", "_ErrFunc")
Func _ErrFunc()
    ConsoleWrite("COM Error, ScriptLine(" & $oError.scriptline & ") : Number 0x" & Hex($oError.number, 8) & " - " & $oError.windescription & @CRLF)
EndFunc

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
richietheprogrammer

You need COM error handler running to capture errors for you.

Add this at top of your script:

; Error monitoring
Global $oError = ObjEvent("AutoIt.Error", "_ErrFunc")
Func _ErrFunc()
    ConsoleWrite("COM Error, ScriptLine(" & $oError.scriptline & ") : Number 0x" & Hex($oError.number, 8) & " - " & $oError.windescription & @CRLF)
EndFunc

Thanks for this. The same thing happens, and console write:

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Documents and Settings\user\Desktop\com.au3"

>Exit code: 0 Time: 3.507

after I choose to not debug the exception.

Share this post


Link to post
Share on other sites
trancexx

Thanks for this. The same thing happens, and console write:

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Documents and Settings\user\Desktop\com.au3"

>Exit code: 0 Time: 3.507

after I choose to not debug the exception.

Your exit code is 0. :) What exception?

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
richietheprogrammer

Your exit code is 0. :) What exception?

I hope this is not asking for too much, but I did a screencapture little avi, that you can get from

http://www.megaupload.com/?d=4J3RNOS6

this way we are on the same page. But to answer your confusion, the unhandled exception shows in a separate window. Please see video. I appreciate all your help!

Share this post


Link to post
Share on other sites
ProgAndy

Since you said there is a debug button, it seems it is a crash reported by windows. Did you already try the new beta? [out]-Parameters like $item in your example arent't supported in the current stable yet.


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

Your video shows nothing particularly useful.

Post the exact code you run.

Post the whole console output.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
richietheprogrammer

Since you said there is a debug button, it seems it is a crash reported by windows. Did you already try the new beta? [out]-Parameters like $item in your example arent't supported in the current stable yet.

Yes, it is reported by windows. Can you please guide me in the right direction to get the new beta? What are you saying does make sense in this case, and I hope the beta will fix this. :)

Share this post


Link to post
Share on other sites
richietheprogrammer

Your video shows nothing particularly useful.

Post the exact code you run.

Post the whole console output.

Sorry about this. My code is the same mentioned in the original post. And the console output:

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Documents and Settings\user\Desktop\com.au3"

>Exit code: 0 Time: 8.262

which is not informative :)

Edited by richietheprogrammer

Share this post


Link to post
Share on other sites
trancexx

Sorry about this. My code is the same mentioned in the original post. And the console output:

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Documents and Settings\user\Desktop\com.au3"

>Exit code: 0 Time: 8.262

which is not informative :)

The code in the first post doesn't have 46th nor 49th line.

Post the freaking code you run.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
richietheprogrammer

The code in the first post doesn't have 46th nor 49th line.

Post the freaking code you run.

Please disregard the first couple seconds in the video, as they are from another code, sorry to get you upset..

Share this post


Link to post
Share on other sites
trancexx

Please disregard the first couple seconds in the video, as they are from another code, sorry to get you upset..

Oh, sorry is not enough mister.

Now you have to promise and do few things. Promise to use public transport, to support Green Peace, to recycle your cans, to reuse your plastic bags and condoms, to stop smoking, not to buy products that are harmful to the environment, to run and post the suggested code.

Then, you'll be forgiven.

(ehh, forget part about condoms)

Edited by trancexx

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
richietheprogrammer

Oh, sorry is not enough mister.

Now you have to promise and do few things. Promise to use public transport, to support Green Peace, to recycle your cans, to reuse your plastic bags and condoms, to stop smoking, not to buy products that are harmful to the environment, to run and post the suggested code.

Then, you'll be forgiven.

(ehh, forget part about condoms)

hahaha you actually made me laugh :)

Share this post


Link to post
Share on other sites
richietheprogrammer

Since you said there is a debug button, it seems it is a crash reported by windows. Did you already try the new beta? [out]-Parameters like $item in your example arent't supported in the current stable yet.

No go :) Same results with beta. This is strangeeee..

Share this post


Link to post
Share on other sites
trancexx

hahaha you actually made me laugh :)

Good. How does this make you feel?

Post the fucking code.

Post the fucking console output.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
richietheprogrammer

Good. How does this make you feel?

Post the fucking code.

Post the fucking console output.

Not sure why you are saying this... here is beta's:

Code:

$oQPST = ObjCreate("QPSTAtmnServer.Application")     

$SelectedPort = $oQPST.GetSelectedPort

  $Provisioning = $SelectedPort.Provisioning()
$item= 0
 $Provisioning.GetNVItem($Item)

Console:

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Program Files\AutoIt3\Beta\Examples\count-do.au3"

>Exit code: 0 Time: 3.357

And I got the unhandled exception the same way the video shows.

Share this post


Link to post
Share on other sites
trancexx

Not sure why you are saying this... here is beta's:

Code:

$oQPST = ObjCreate("QPSTAtmnServer.Application")     

$SelectedPort = $oQPST.GetSelectedPort

  $Provisioning = $SelectedPort.Provisioning()
$item= 0
 $Provisioning.GetNVItem($Item)

Console:

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Program Files\AutoIt3\Beta\Examples\count-do.au3"

>Exit code: 0 Time: 3.357

And I got the unhandled exception the same way the video shows.

And where is the COM error handler there?

How do you expect anyone to help you if you do that?

Edited by trancexx

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
richietheprogrammer

And where is the COM error handler there?

How do you expect anyone to help you if you do that?

COM error handler did not change anything when I tried it. I know the handler works because it worked on another script, but that appears to work when the function actually fails. What is happening in my case is that Autoit is crashing, and when I hit cancel to debug, the console is saying exit code 0. I found a similar issue, here:

Could this be that autoit doesnt support the "item" variable in this case, as stated previously? And how can i fix that? Any help is much appreciated.

Edited by richietheprogrammer

Share this post


Link to post
Share on other sites
ProgAndy

It seems I was wrong with $item, I looked up "GetNVItem" and $item is no [out]-parameter. It was just a guess.

But I found some docs in which $provisioning is no IDispatch-interface, just IUnknwon. That could be a problem, too. Without the acutal object to examine and test, this is only a guessing game.

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
richietheprogrammer

It seems I was wrong with $item, I looked up "GetNVItem" and $item is no [out]-parameter. It was just a guess.

You'll have to remove one line after another from your example until it does not crash anymore. Then you can tell us the exact command that causes the crash.

Thanks for this. I know already exactly where it is happening. It is in the following:

$data= $Provisioning.GetNVItem($Item)

So something about what you said earlier might be right, no?

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  

×