Runtime error 216, Help me

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Liberty
Pro Scripter
Posts: 56
Joined: Wed Jun 06, 2007 11:56 am
Location: Sweden

Runtime error 216, Help me

Post by Liberty » Sun Dec 14, 2008 4:10 pm

I have been using similar macros on different computers.
The major difference from computer to computer is a drive letter used.

However now after a minor change of a macro I get
Runtime error 216 at 013934e6 just at the end of the macro
on the computer I export the .exe file to - I am using XP.

What to do?

Best Regards

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Sun Dec 14, 2008 5:00 pm

Would need to see the script file, and know which line causes the error. Google throws up 56,000+ results for runtime error 216

First one is:
http://support.microsoft.com/kb/259279
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Liberty
Pro Scripter
Posts: 56
Joined: Wed Jun 06, 2007 11:56 am
Location: Sweden

Post by Liberty » Sun Dec 14, 2008 6:01 pm

Thanks for the quick reply.

The last line is
Gosub>MaximizeAllWindows
which seem to have worked.
As I am using an .exe file on an second computer I cannot use logging or could I? How?

The script on the original computer works well as well as similar and the old (on both computers) ones

I have tried some "cleaning" but no result.

I may present an example script in the next step

Thank you
Liberty

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Sun Dec 14, 2008 6:27 pm

Yes, you can use logging. Run the .exe with the /LOGFILE= parm - as long as it has not been compiled with logging disabled (if it has, recompile it with logging allowed).
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Liberty
Pro Scripter
Posts: 56
Joined: Wed Jun 06, 2007 11:56 am
Location: Sweden

Post by Liberty » Sun Dec 14, 2008 9:35 pm

Again many thanks.

No error found in the logfile. The program finished with start/end of the maximizing of windows.
Several seconds after this finish I get
1. A new OK-window from the macro program with:
Operation error at 013934e6 causing runtime error at .....

2. Then a new window from Windows, I suppose, with
Runtime error 216 at 013934e6

The error could however now not be reproduced at the second and third trial!!

(It also disappeared when I shortened the macro and took away some repetitious actions before the new 3 trials where the first showed an error)

Your comments? Could further delays in the macro improve the situation?

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Dec 15, 2008 8:17 am

Did you look at the first google search result I posted - it suggests you could have a virus.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Liberty
Pro Scripter
Posts: 56
Joined: Wed Jun 06, 2007 11:56 am
Location: Sweden

Post by Liberty » Mon Dec 15, 2008 8:45 am

Yes, thank you.
This comment is very old and I could not find the
mentioned file on my computer.
I am using F-Secure and have made several computer scans
without any detection. I also made some cleeaning as some other people have proposed.

I just have this error in the macro - I will see if it will come back. I have incresed the delays in the macro even if the reults always have been correct except the error message described.

Liberty
Pro Scripter
Posts: 56
Joined: Wed Jun 06, 2007 11:56 am
Location: Sweden

Post by Liberty » Tue Dec 16, 2008 11:55 am

The error is still there again.
The error message is

Application Error (for the macroexe)
The instruction at "0x012f34e6" referenced memory at "0x0137204e".
The memory could not be "read"
Click on OK to terminate the program


And then
Error
Runtime error 216 at 012f34e6

The result of the macro seems to quite OK otherwise

Any suggestions?
Could I send the complete code separately to you?

(the reduced version has not yet showed the error)

Liberty
Pro Scripter
Posts: 56
Joined: Wed Jun 06, 2007 11:56 am
Location: Sweden

Can you help me now

Post by Liberty » Sun Dec 21, 2008 9:05 pm

I give you an example of a script that gives the error sometimes:

Code: Select all

Remark>Capture Elspotprice from homepage and save the result to an ascii file

VBSTART
Rem This VB library contains the following functions
Rem ConvertInput
Rem ConvertOutput
Rem GetgInt
Rem GetTodayDate, GetNextWDate, GetPrevWDateOption Explicit

Option Explicit

Function ConvertInput (instr)
Rem Input assumed to be YYMMDD or YMMDD
Dim ilen
Dim str

ilen=Len(instr)
If ilen=5 Then
  str="0"&Mid(instr,1,1)&"-"
  str=str&Mid(instr,2,2)&"-"
  str=str&Mid(instr,4,2)
Else
  str=Mid(instr,1,2)&"-"
  str=str&Mid(instr,3,2)&"-"
  str=str&Mid(instr,5,2)
End If

ConvertInput=str

End Function


Function ConvertOutput (instr)
Rem Input assumed to be YY-MM-DD or YYYY-MM-DDConvert output
Dim ilen
Dim str

ilen=Len(instr)
If ilen=8 Then
   str=Mid(instr,1,2)
   str=str&Mid(instr,4,2)
   str=str&Mid(instr,7,2)
Else
   str=Mid(instr,3,2)
   str=str&Mid(instr,6,2)
   str=str&Mid(instr,9,2)
End If

ConvertOutput=str

End Function


Function GetInt (str)

GetInt=CLng(str)

End Function


Function GetTodayDate
Dim ilen
Dim str,istr

istr=Date

Rem Convert output
str=ConvertOutput(istr)

GetTodayDate=str

End Function


Function GetNextWDate (indate)

Dim str,istr,xdate
Dim ilen


Rem Convert input
str=ConvertInput(indate)

Rem Calculate next date
xdate=DateAdd("d",1,str)
If Weekday(xdate,vbMonday)>5 Then
  xdate=DateAdd("d",1,xdate)
End If
If Weekday(xdate,vbMonday)>5 Then
  xdate=DateAdd("d",1,xdate)
End If


Rem Convert output
str=ConvertOutput(xdate)

GetNextWDate=str

End Function


Function GetPrevWDate (indate)

Dim str,istr,xdate
Dim ilen

Rem Convert input
str=ConvertInput(indate)

Rem Calculate next date
xdate=DateAdd("d",-1,str)
If Weekday(xdate,vbMonday)>5 Then
  xdate=DateAdd("d",-1,xdate)
End If
If Weekday(xdate,vbMonday)>5 Then
  xdate=DateAdd("d",-1,xdate)
End If

Rem Convert output
str=ConvertOutput(xdate)

GetPrevWDate=str

End Function

VBEND



*********************************************************************
Remark>Capture Elspotprice from homepage and save the result to ascii file
Let>YES=1
Let>NO=0

Let>file1=C:\InData\Stock\ELSPOTDATA.TXT
Let>file2=C:\InData\Stock\EL.TXT
Let>address=http://wwwdynamic.nordpool.com/marketinfo/elspot/stockholm/elspot.cgi?interval=last8&ccurrency=sek&type=html
Let>addressDI=http://www.di.se/Nyheter/
Let>HomePage=di.se*
Let>TraderPage=DI Trader - Windows Internet Explorer
Let>ElspotPage=Elspot for Sweden*

CapsOff
IfWindowOpen>%HomePage%
  CloseWindow>%HomePage%
  WaitWindowClosed>%HomePage%
EndIf
IfWindowOpen>%TraderPage%
  CloseWindow>%TraderPage%
  WaitWindowClosed>%TraderPage%
EndIf
IfWindowOpen>Elspot for Sweden*
  CloseWindow>Elspot for Sweden*
  WaitWindowClosed>Elspot for Sweden*
EndIf
Gosub>MinimizeAllWindows
Wait>0.2

Remark>Open the DI page and then move to elspot page
Remark> Use the IEAuto here
LibLoad>IEAuto.dll,hIE
Remark>Open the DI homepage
LibFunc>hIE,CreateIE,IE,0
LibFunc>hIE,Navigate,r,%IE%,%addressDI%
LibFunc>hIE,WaitIE,r,%IE%
Wait>1
WaitWindowOpen>%HomePage%
WindowAction>1,%HomePage%
SetFocus>%HomePage%
MouseMove>0,0
Wait>1

Remark>Slow down Send Key somewhat
Let>SK_DELAY=2

Remark>Move to the elspot page
Press ALT
Send>f
Release ALT
Wait>0.5
WaitReady>0
Send>o
Wait>0.5
WaitWindowOpen>Open
Wait>0.2
SetFocus>Open
WaitReady>0
Send>address
Press Enter
WaitWindowOpen>%ElspotPage%
Wait>1.5

Remark>Save the page into the text file
IfFileExists>file1
  DeleteFile>file1
EndIf
IfFileExists>file2
  DeleteFile>file2
EndIf

SetFocus>%ElspotPage%
WaitReady>0
Let>SK_DELAY=2
Press ALT
Send>f
Release ALT
WaitReady>0
Send>a
WaitWindowOpen>Save Webpage
SetFocus>Save Webpage
WaitReady>0
Send>file1
Wait>1
WaitReady>0
Press ALT
Send>t
Release ALT
Wait>0.5
WaitReady>0
Send>t
Wait>0.5
WaitReady>0
Press ALT
Send>s
Release ALT
WaitReady>0
Wait>1

Remark>Read the captured page file and find the value
IfFileExists>file1
Else
  Wait>4
EndIf
Let>k=20
Let>found=NO
Repeat>found
  Let>k=k+1
  ReadLn>file1,k,line
  Pos>Avg,line,1,res,TRUE
  //MessageModal>line
  If>res>0
    Let>found=YES
  EndIf
  If>k>200
    Message>No line found
	Goto>Ready
  EndIf
Until>found=YES
//MessageModal>line
Let>k=%res%+3
Let>k=k+42

//MessageModal>k
MidStr>line,k,6,value
//MessageModal>value
Pos>.,value,1,res,TRUE
//MessageModal>res
If>res<4>k=k-1
  MidStr>line,k,6,value
  //MessageModal>value
EndIf
Wait>0.5

Remark>Build a new line
VBEval>GetTodayDate,xdate
Let>symbol=ELSPOT
Let>xnull=0.00
Let>ynull=0
Let>newline=%xdate%
WriteLn>file2,result,newline
Wait>0.5
Let>newline=%symbol%,%xdate%,%xnull%,%xnull%,%value%,%ynull%
WriteLn>file2,result,newline
Wait>0.2

Label>Ready
Remark>End of program
SetFocus>%ElspotPage%
Wait>0.5
WaitReady>0
Press ALT
Press F4
Release ALT
Wait>0.1
Gosub>MaximizeAllWindows

**********************************************************************

SRT>MinimizeAllWindows
Press LWinkey
Send>d
Release LWinkey
END>MinimizeAllWindows

SRT>MaximizeAllWindows
Press LWinkey
Press Shift
Send>m
Release Shift
Release LWinkey
END>MaximizeAllWindows



************************************
There are some VB-routines in the beginning.
The special code to put the result in a .txt file 
is of no interest.

The question is if something could be done at the end to avoid
the error - the result of the macro is quite OK even after the error - 
on the main computer where I have the MS I never get the error.

I cannot live with this error.
I have tried a lot of cleaning and I do not think I have any virus.

Liberty, after a week 



Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts