Access Violation error

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
jsmyong55
Newbie
Posts: 18
Joined: Thu Aug 29, 2013 4:14 am

Access Violation error

Post by jsmyong55 » Tue Nov 05, 2013 4:08 pm

I am facing an access violation error at address 0020003D. Before this error, a debugging error shows, saying that the dialog already exists. I have been using the same script for other macros without any problems. Can anyone try to help me debug?

Code: Select all

Let>InsertCount=1
Let>ErrorCount=0
Let>UpdateCount=0
OnEvent>Custom,DialogTimeOut,UnusedVar,UnUsedSub

Timer>StartTime
Dialog>Dialog1
object Dialog1: TForm
  Left = 247
  Top = 97
  HelpContext = 5000
  BorderIcons = [biSystemMenu]
  Caption = 'POS Attendance HQ'
  ClientHeight = 114
  ClientWidth = 301
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = True
  Position = poScreenCenter
  ShowHint = True
  OnTaskBar = False
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 32
    Top = 8
    Width = 3
    Height = 13
    Alignment = taCenter
  end
  object Label2: TLabel
    Left = 32
    Top = 32
    Width = 3
    Height = 13
    Alignment = taCenter
  end
  object Label3: TLabel
    Left = 32
    Top = 56
    Width = 3
    Height = 13
  end
  object MSButton1: tMSButton
    Left = 112
    Top = 80
    Width = 75
    Height = 25
    Caption = 'Show Log'
    TabOrder = 0
    DoBrowse = False
    BrowseStyle = fbOpen
  end
end
EndDialog>Dialog1

    //Display Log message by setting Label1 caption
    SetDialogProperty>Dialog1,Label1,Caption,Total of %InsertCount% record(s) inserted!
    SetDialogProperty>Dialog1,Label2,Caption,Total of %UpdateCount% record(s) updated!
    SetDialogProperty>Dialog1,Label3,Caption,Total of %ErrorCount% record(s) with error!

  IF>%ErrorCount%>0
    //Display Log message by setting Label1 caption
    SetDialogProperty>Dialog1,Label1,Caption,An error has occurred. Please check Log for info
    SetDialogProperty>Dialog1,Label2,Caption,
    SetDialogProperty>Dialog1,Label3,Caption,
  ENDIF

AddDialogHandler>Dialog1,MSButton1,OnClick,ShowLog

Show>Dialog1,

    SRT>DialogTimeOut

      Timer>TestTime
      Let>Time=%TestTime%-%StartTime%
      If>{%Time%>5000}
        IfWindowOpen>POS Attendance HQ
          CloseDialog>Dialog1
        EndIf
      EndIf

    END>DialogTimeOut

Timer>StartTime
EndIf


User avatar
JRL
Automation Wizard
Posts: 3502
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Tue Nov 05, 2013 4:57 pm

Running your script and not getting any errors. I'm running v14.0.17 on WinXP SP3.

Have you tried closing Macro Scheduler and reopening it?

User avatar
PepsiHog
Automation Wizard
Posts: 514
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

Post by PepsiHog » Tue Nov 05, 2013 11:51 pm

@ jsmyong55,

It sounds as if your Dialog is being read in more than once. Maybe a delay between the OnEvent and the actual Dialog would prevent the error - Dialog already exists. I have v12, but it appears you have a timeout for your Dialog and your Dialog may not be closing fast enough before it is read in again. Or instead of a delay, just a CloseDialog command.

I find that a window handle sometimes works better for closing a window.

In you srt DialogTimeOut replace your CloseDialog with

let>win_usehandle=1
CloseWindow>%Dialog1.Handle%
let>win_usehandle=0

It may help to guarantee a close.

I hope this helps,
PepsiHog
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

jsmyong55
Newbie
Posts: 18
Joined: Thu Aug 29, 2013 4:14 am

Post by jsmyong55 » Wed Nov 06, 2013 12:58 am

JRL wrote:Running your script and not getting any errors. I'm running v14.0.17 on WinXP SP3.

Have you tried closing Macro Scheduler and reopening it?
Sometimes the easiest problems can be solved by just opening and closing (or rebooting). After restarting MS, I can't simulate the problem any longer.

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