The problem I have is that after the first image has been tagged Macro scheduler throws an error telling me that dialog1 alread exists, if anyone can help me solve this problem it would be greatly appreciated. I have just starting using dialogs and dont really understand why this dialog is remaining open between loops.
Code: Select all
//Set IGNORESPACES to 1 to force script interpreter to ignore spaces.
//If using IGNORESPACES quote strings in {" ... "}
//Let>IGNORESPACES=1
Label>Loop
Wait>1
// Choose Form Data Row
ReadIniFile>C:\imageparsing.ini,FormData,CurrentRow,CurrentContentRow
GoSub>GetFormData
Let>ImageURL=%fields_1%
Let>Color=%fields_2%
Let>Description=%fields_3%
// Build Custom HTML
Let>MockPage=<!doctype html><html><head><title>Image Tagger</title></head><body><center><img src="%ImageURL%" /></center></body></html>
// Dialog Form
Dialog>Dialog1
object Dialog1: TForm
Left = 231
Top = 127
HelpContext = 5000
BorderIcons = [biSystemMenu]
Caption = 'Image Tagger'
ClientHeight = 800
ClientWidth = 1000
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 MSHTMLViewer1: tMSHTMLViewer
Left = -5
Top = -2
Width = 1078
Height = 451
TabOrder = 0
BorderStyle = htFocused
DefFontName = 'Times New Roman'
DefPreFontName = 'Courier New'
HistoryMaxCount = 0
NoSelect = False
PrintMarginBottom = 2.000000000000000000
PrintMarginLeft = 2.000000000000000000
PrintMarginRight = 2.000000000000000000
PrintMarginTop = 2.000000000000000000
PrintScale = 1.000000000000000000
end
object Label1: Tlabel
Left =10
Top = 450
Width = 200
Height = 13
Caption = 'Color:'
end
object ColorField: TEdit
Left = 10
Top = 467
Width = 975
Height = 110
TabOrder = 1
end
object Label2: Tlabel
Left =10
Top = 535
Width = 200
Height = 13
Caption = 'Description:'
end
object DescriptionField: TEdit
Left = 8
Top = 552
Width = 977
Height = 110
TabOrder = 2
end
object MSButton1: tMSButton
Left = 50
Top = 720
Width = 430
Height = 50
Caption = 'OK'
ModalResult = 1
TabOrder = 4
DoBrowse = False
BrowseStyle = fbOpen
end
object MSButton2: tMSButton
Left = 520
Top = 720
Width = 430
Height = 50
Caption = 'Cancel'
ModalResult = 2
TabOrder = 5
DoBrowse = False
BrowseStyle = fbOpen
end
end
EndDialog>Dialog1
AddDialogHandler>Dialog1,,OnClose,DoClose
// Display Custom HTML
SetDialogProperty>Dialog1,MSHTMLViewer1,html,MockPage
Show>Dialog1,ImageModal
// Dialog Buttons
If>ImageModal=1
GetDialogProperty>Dialog1,ColorField,Text,Color
GetDialogProperty>Dialog1,DescriptionField,Text,Description
Let>result=%CurrentContentRow%
Let>LineToWrite=%ImageURL%,%Color%,%Description%
WriteLn>C:\imageparsing-results.csv,result,LineToWrite
Endif
If>ImageModal=2
// Cancel Button
Endif
Let>CurrentContentRow=%CurrentContentRow%+1
EditIniFile>C:\imageparsing.ini,FormData,CurrentRow,%CurrentContentRow%
Goto>Loop
SRT>GetFormData
Let>Seperator=;
ReadFile>C:\imageparsing-datafile.csv,TheFileData
Separate>TheFileData,CRLF,Lines
Let>CurrentLine=Lines_%CurrentContentRow%
//extract each field
Separate>CurrentLine,Seperator,fields
END>GetFormData
SRT>DoClose
Let>Terminated=TRUE
End>DoClose