Abbreviated dialog definitions

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
bossydog9
Junior Coder
Posts: 29
Joined: Wed Jan 08, 2020 12:46 pm

Abbreviated dialog definitions

Post by bossydog9 » Sat Jan 25, 2020 4:02 pm

In one of the sample scripts, FindImagePos Test.scp, a dialog has been defined by a number of lines in the form:
  • object=propertyvalue1,propertyvalue2,propertyvalue3,...
instead of the verbose code generated by the Dialog Designer. E.g.:

Code: Select all

Dialog>Dialog1
   Caption=Dialog1
   Width=384
   Height=257
   Top=458
   Left=358
   Edit=msEdit1,16,72,249,
   Label=BMP File:,16,56,true
   Button=Browse,280,72,75,25,0
   Label=Browse for a BMP captured with the image capture tool,16,16,true
   Button=Find,280,128,75,25,10
   Edit=msEdit2,16,128,121,0
   Label=Color Tolerance:,16,112,true
   Label=BMPs must be created with the Image Capture Tool%CRLF% (Editor/Tools/Image Capture Tool),16,176,true
   FileBrowse=Browse,msEdit1
EndDialog>Dialog1
I can pretty much guess what the parameters mean, but is there any documentation for defining dialogs in this way? I'm assuming there is, but my searches haven't found anything, yet. I tried searching for FileBrowse in the online help, but it only returned a reference to it in version history.

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

Re: Abbreviated dialog definitions

Post by PepsiHog » Sat Jan 25, 2020 8:01 pm

@bossydog9,
It appears to be out-dated dialog script. In older versions that's how it was done. You pretty much would have to have an out dated version of MS to play around with it.

I believe newer versions can still execute it, but it's so easy to create the same in the newer version, why bother?

Yep. I recreated the dialog using v14. Completely different. Yea, that's old school.

Code: Select all



Dialog>Dialog1
object Dialog1: TForm
  Left = 428
  Top = 122
  HelpContext = 5000
  BorderIcons = [biSystemMenu]
  Caption = 'CustomDialog'
  ClientHeight = 276
  ClientWidth = 349
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = True
  ShowHint = True
  OnTaskBar = False
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 24
    Top = 32
    Width = 263
    Height = 13
    Caption = 'Browse for a BMP captured with the image capture tool.'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -11
    Font.Name = 'MS Sans Serif'
    Font.Style = []
    ParentFont = False
  end
  object Label2: TLabel
    Left = 24
    Top = 96
    Width = 45
    Height = 13
    Caption = 'BMP File:'
  end
  object Label3: TLabel
    Left = 24
    Top = 168
    Width = 78
    Height = 13
    Caption = 'Color Tolerance:'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -11
    Font.Name = 'MS Sans Serif'
    Font.Style = []
    ParentFont = False
  end
  object Label4: TLabel
    Left = 8
    Top = 240
    Width = 244
    Height = 13
    Caption = 'BMP'#39's must be created with the image Capture Tool'
  end
  object Label5: TLabel
    Left = 16
    Top = 256
    Width = 162
    Height = 13
    Caption = '(Editor/Tools/Image Capture Tool)'
  end
  object Edit1: TEdit
    Left = 24
    Top = 112
    Width = 233
    Height = 21
    TabOrder = 8
  end
  object MSButton3: tMSButton
    Left = 264
    Top = 112
    Width = 75
    Height = 25
    Caption = 'Browse'
    TabOrder = 9
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object Edit2: TEdit
    Left = 28
    Top = 188
    Width = 121
    Height = 21
    TabOrder = 10
    Text = '0'
  end
  object MSButton4: tMSButton
    Left = 264
    Top = 187
    Width = 75
    Height = 25
    Caption = 'Find'
    TabOrder = 11
    DoBrowse = False
    BrowseStyle = fbOpen
  end
end
EndDialog>Dialog1

I only did a very basic copy. I didn't bother with the functionality of it.

PepsiHog
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2021) 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!

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

Re: Abbreviated dialog definitions

Post by PepsiHog » Sat Jan 25, 2020 8:55 pm

Here is an example of how to do browse.

Code: Select all

Dialog>Dialog1
object Dialog1: TForm
  Left = 428
  Top = 122
  HelpContext = 5000
  BorderIcons = [biSystemMenu]
  Caption = 'CustomDialog'
  ClientHeight = 212
  ClientWidth = 476
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = True
  ShowHint = True
  OnTaskBar = False
  PixelsPerInch = 96
  TextHeight = 13
  object MSButton1: tMSButton
    Left = 95
    Top = 56
    Width = 75
    Height = 25
    Caption = 'MSButton1'
    TabOrder = 8
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object MSButton2: tMSButton
    Left = 199
    Top = 58
    Width = 75
    Height = 25
    Caption = 'MSButton2'
    TabOrder = 9
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object MSButton3: tMSButton
    Left = 385
    Top = 26
    Width = 32
    Height = 25
    DoubleBuffered = True
    Glyph.Data = {
      F6000000424DF600000000000000760000002800000010000000100000000100
      0400000000008000000000000000000000001000000010000000000000000000
      80000080000000808000800000008000800080800000C0C0C000808080000000
      FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00777777777777
      77777777777777777777000000000007777700333333333077770B0333333333
      07770FB03333333330770BFB0333333333070FBFB000000000000BFBFBFBFB07
      77770FBFBFBFBF0777770BFB0000000777777000777777770007777777777777
      7007777777770777070777777777700077777777777777777777}
    ParentDoubleBuffered = False
    TabOrder = 1
    DoBrowse = False
    Filter = ''
    BrowseStyle = fbOpen
  end
end
EndDialog>Dialog1


AddDialogHandler>Dialog1,MSButton3,OnClick,DoBrowse

Show>Dialog1,r

SRT>DoBrowse
// Note: This is using MSButton3.  If yours differs, change it accordingly.
  //ReadIniFile>%Fpath%\Config.ini,InitialDir,Open,DoOpen
  //SetDialogProperty>Dialog1,MSButton3,InitialDir,%DoOpen%
  SetDialogProperty>Dialog1,MSButton3,DoBrowse,True
  GetDialogProperty>Dialog1,MSButton3,Filename,strFileName
  SetDialogProperty>Dialog1,Edit1,Text,strFileName
  //ReadFile>strFileName,strFileData
  //SetDialogProperty>Dialog1,MSMemo1,Text,strFileData
END>DoBrowse

// This is the code in the dialog when I created it.  Then I replaced it with the above
/*
  object MSButton3: tMSButton
    Left = 304
    Top = 66
    Width = 75
    Height = 25
    Caption = 'MSButton3'
    TabOrder = 10
    DoBrowse = False
    BrowseStyle = fbOpen
  end
I remarked the lines that are not useful as of yet.

I keep this script as my sample. Then you can just copy and paste.

Code: Select all


// Browse Folder Icon
Glyph.Data = {
      F6000000424DF600000000000000760000002800000010000000100000000100
      0400000000008000000000000000000000001000000010000000000000000000
      80000080000000808000800000008000800080800000C0C0C000808080000000
      FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00777777777777
      77777777777777777777000000000007777700333333333077770B0333333333
      07770FB03333333330770BFB0333333333070FBFB000000000000BFBFBFBFB07
      77770FBFBFBFBF0777770BFB0000000777777000777777770007777777777777
      7007777777770777070777777777700077777777777777777777}


// Sample Script Section

object MSButton6: tMSButton
    Left = 385
    Top = 26
    Width = 32
    Height = 25
    DoubleBuffered = True
    Glyph.Data = {
      F6000000424DF600000000000000760000002800000010000000100000000100
      0400000000008000000000000000000000001000000010000000000000000000
      80000080000000808000800000008000800080800000C0C0C000808080000000
      FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00777777777777
      77777777777777777777000000000007777700333333333077770B0333333333
      07770FB03333333330770BFB0333333333070FBFB000000000000BFBFBFBFB07
      77770FBFBFBFBF0777770BFB0000000777777000777777770007777777777777
      7007777777770777070777777777700077777777777777777777}
    ParentDoubleBuffered = False
    TabOrder = 1
    DoBrowse = False
    Filter = ''
    BrowseStyle = fbOpen
  end
  
  
  SRT>DoBrowse
  ReadIniFile>%Fpath%\Config.ini,InitialDir,Open,DoOpen
  SetDialogProperty>Dialog1,MSButton1,InitialDir,%DoOpen%
  SetDialogProperty>Dialog1,MSButton1,DoBrowse,True
  GetDialogProperty>Dialog1,MSButton1,Filename,strFileName
  SetDialogProperty>Dialog1,Edit1,Text,strFileName
  ReadFile>strFileName,strFileData
  SetDialogProperty>Dialog1,MSMemo1,Text,strFileData
END>DoBrowse

Good luck,
PepsiHog
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2021) 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!

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