0 in Edit Dialog Box
Moderators: JRL, Dorian (MJT support)
0 in Edit Dialog Box
For some reason I am getting a "0" in an Edit dialog box. However, if I place the same Dialog box in a macro by itself I don't get the "0". Does anyone know what would cause this?
Dialog 0 code
The code is below, the only thing I can think of is the GetDialogAction is causing the error. However, if I don't put them both in it does not seem to get the value in Dialog1.msEdit1
COF
Dialog>Dialog3
Caption=Add Metadata
Width=442
Height=250
Top=CENTER
Left=CENTER
Max=1
Min=1
Close=1
Resize=1
Label=Author,27,63,true
Label=Subject,22,87,true
Label=Title,38,111,true
Label=Keywords,12,135,true
Image=C:\Insertpdfpages\eDocFileBAckground3.bmp,0,0,433,49
Label=Copyright© eDocFile Inc. 2006,148,200,true
Edit=msEdit1,64,59,345,
Edit=msEdit2,64,83,345,
Edit=msEdit3,64,107,345,
Edit=msEdit4,64,131,345,
Button=Continue,146,168,75,25,1
Button=Exit,220,168,75,25,2
EndDialog>Dialog3
Iffileexists>c:\Insertpdfpages\inpdf.ini,readini
Let>base=
Let>in=
Let>out=
Let>page=
Goto>Begin
Label>readini
ReadIniFile>c:\Insertpdfpages\inpdf.ini,Path,RootPDF,base
ReadIniFile>c:\Insertpdfpages\inpdf.ini,Path,PDFin,in
ReadIniFile>c:\Insertpdfpages\inpdf.ini,Path,PDFout,out
ReadIniFile>c:\Insertpdfpages\inpdf.ini,Path,Afterpage,page
ReadIniFile>c:\Insertpdfpages\inpdf.ini,Path,Metadata,md
Label>Begin
Dialog>Dialog1
Caption=Licensed to
Width=514
Height=298
Top=CENTER
Left=CENTER
Max=1
Min=1
Close=1
Resize=1
Label=Note: Output Path and Filename cannot contain spaces,134,62,true
Label=Insert After Page,112,184,true
Label=Copyright© eDocFile Inc. 2006,179,244,true
Image=C:\Insertpdfpages\eDocFileBAckground3.bmp,0,0,505,49
Image=C:\Insertpdfpages\pdfpinst.bmp,200,8,233,25
Edit=basefilen,24,86,273,%base%
Edit=insertfilen,24,118,273,%in%
Button=Exit,260,210,75,25,2
Button=Browse Main File,304,85,177,25,0,,One eMail Address on Each Line
Button=Browse to File to be Inserted,304,117,177,25,0,,Must be Plain ACSII Text File
Button=Continue,178,210,82,25,5
Edit=NewPDF,24,150,273,%out%
Button=Path and Name of New PDF,304,149,177,25,0,,Must be Plain ACSII Text File
Edit=msEdit1,32,180,73,%page%
CheckBox=msCheckBox1,Prompt for Metadata,216,182,145,%md%
FileBrowse=Browse Main File,basefilen
FileBrowse=Browse to File to be Inserted,insertfilen
FileBrowse=Path and Name of New PDF,NewPDF
EndDialog>Dialog1
Label>MainLoop
Show>Dialog1,result
GetDialogAction>Dialog1,result
If>result=2,EOF
If>result=5,Continue
Goto>MainLoop
Label>Continue
VBStart
VBEnd
GetDialogAction>Dialog1,result
Let>basefile=%Dialog1.basefilen%
Let>insertfile=%Dialog1.insertfilen%
Let>output=%Dialog1.NewPDF%
Let>insertpage=%Dialog1.msEdit1%
Let>Meta=%Dialog1.msCheckBox1%
Let>noduppage=%Insertpage%+1
/////////////////////////////////////////////////------------Write the INI
Iffileexists>c:\Insertpdfpages\inpdf.ini
Deletefile>c:\Insertpdfpages\inpdf.ini
Endif
WriteLn>c:\Insertpdfpages\inpdf.ini,[Path]
WriteLn>c:\Insertpdfpages\inpdf.ini,RootPDF=%basefile%
WriteLn>c:\Insertpdfpages\inpdf.ini,PDFin=%insertfile%
WriteLn>c:\Insertpdfpages\inpdf.ini,PDFout=%output%
WriteLn>c:\Insertpdfpages\inpdf.ini,Afterpage=%insertpage%
WriteLn>c:\Insertpdfpages\inpdf.ini,Metadata=%Meta%
Let>Metadatascript=
/////////////////////////////////////////////////------------Finish Write the INI
If>Meta=False,skipmetamenu
Label>metamenuloop
Show>Dialog3,r
If>r=1,gotmeta
If>r=2,EOF
Goto>metamenuloop
Label>gotmeta
COF
Dialog>Dialog3
Caption=Add Metadata
Width=442
Height=250
Top=CENTER
Left=CENTER
Max=1
Min=1
Close=1
Resize=1
Label=Author,27,63,true
Label=Subject,22,87,true
Label=Title,38,111,true
Label=Keywords,12,135,true
Image=C:\Insertpdfpages\eDocFileBAckground3.bmp,0,0,433,49
Label=Copyright© eDocFile Inc. 2006,148,200,true
Edit=msEdit1,64,59,345,
Edit=msEdit2,64,83,345,
Edit=msEdit3,64,107,345,
Edit=msEdit4,64,131,345,
Button=Continue,146,168,75,25,1
Button=Exit,220,168,75,25,2
EndDialog>Dialog3
Iffileexists>c:\Insertpdfpages\inpdf.ini,readini
Let>base=
Let>in=
Let>out=
Let>page=
Goto>Begin
Label>readini
ReadIniFile>c:\Insertpdfpages\inpdf.ini,Path,RootPDF,base
ReadIniFile>c:\Insertpdfpages\inpdf.ini,Path,PDFin,in
ReadIniFile>c:\Insertpdfpages\inpdf.ini,Path,PDFout,out
ReadIniFile>c:\Insertpdfpages\inpdf.ini,Path,Afterpage,page
ReadIniFile>c:\Insertpdfpages\inpdf.ini,Path,Metadata,md
Label>Begin
Dialog>Dialog1
Caption=Licensed to
Width=514
Height=298
Top=CENTER
Left=CENTER
Max=1
Min=1
Close=1
Resize=1
Label=Note: Output Path and Filename cannot contain spaces,134,62,true
Label=Insert After Page,112,184,true
Label=Copyright© eDocFile Inc. 2006,179,244,true
Image=C:\Insertpdfpages\eDocFileBAckground3.bmp,0,0,505,49
Image=C:\Insertpdfpages\pdfpinst.bmp,200,8,233,25
Edit=basefilen,24,86,273,%base%
Edit=insertfilen,24,118,273,%in%
Button=Exit,260,210,75,25,2
Button=Browse Main File,304,85,177,25,0,,One eMail Address on Each Line
Button=Browse to File to be Inserted,304,117,177,25,0,,Must be Plain ACSII Text File
Button=Continue,178,210,82,25,5
Edit=NewPDF,24,150,273,%out%
Button=Path and Name of New PDF,304,149,177,25,0,,Must be Plain ACSII Text File
Edit=msEdit1,32,180,73,%page%
CheckBox=msCheckBox1,Prompt for Metadata,216,182,145,%md%
FileBrowse=Browse Main File,basefilen
FileBrowse=Browse to File to be Inserted,insertfilen
FileBrowse=Path and Name of New PDF,NewPDF
EndDialog>Dialog1
Label>MainLoop
Show>Dialog1,result
GetDialogAction>Dialog1,result
If>result=2,EOF
If>result=5,Continue
Goto>MainLoop
Label>Continue
VBStart
VBEnd
GetDialogAction>Dialog1,result
Let>basefile=%Dialog1.basefilen%
Let>insertfile=%Dialog1.insertfilen%
Let>output=%Dialog1.NewPDF%
Let>insertpage=%Dialog1.msEdit1%
Let>Meta=%Dialog1.msCheckBox1%
Let>noduppage=%Insertpage%+1
/////////////////////////////////////////////////------------Write the INI
Iffileexists>c:\Insertpdfpages\inpdf.ini
Deletefile>c:\Insertpdfpages\inpdf.ini
Endif
WriteLn>c:\Insertpdfpages\inpdf.ini,[Path]
WriteLn>c:\Insertpdfpages\inpdf.ini,RootPDF=%basefile%
WriteLn>c:\Insertpdfpages\inpdf.ini,PDFin=%insertfile%
WriteLn>c:\Insertpdfpages\inpdf.ini,PDFout=%output%
WriteLn>c:\Insertpdfpages\inpdf.ini,Afterpage=%insertpage%
WriteLn>c:\Insertpdfpages\inpdf.ini,Metadata=%Meta%
Let>Metadatascript=
/////////////////////////////////////////////////------------Finish Write the INI
If>Meta=False,skipmetamenu
Label>metamenuloop
Show>Dialog3,r
If>r=1,gotmeta
If>r=2,EOF
Goto>metamenuloop
Label>gotmeta
I'm not seeing a "0" in any of the fields of the edit boxes in dialog1 or dialog3. But I don't have an INI file existing. You are presetting values from an INI so there must be a "0" in there somewhere.
However, I see two other things right off. You have set up your dialogs as modal dialogs. This just means the script is paused until the user selects an action by picking one of your buttons. But since they are modal, the GetActionDialog> statements are unneccesary. I don't think they are hurting anything but you don't need them. I took them out and the values for the edit boxes show up as they should.
The second thing is in your WriteLn> statements you have not included a "result" variable.
From help for WriteLn>
WriteLn>file_name,result,line
your first WriteLn>
WriteLn>c:\Insertpdfpages\inpdf.ini,[Path]
You have what you want to be the line portion of the statement in the position of the result portion of the statement. So you are writing blank lines.
See if these help, let us know.
Later,
Dick
However, I see two other things right off. You have set up your dialogs as modal dialogs. This just means the script is paused until the user selects an action by picking one of your buttons. But since they are modal, the GetActionDialog> statements are unneccesary. I don't think they are hurting anything but you don't need them. I took them out and the values for the edit boxes show up as they should.
The second thing is in your WriteLn> statements you have not included a "result" variable.
From help for WriteLn>
WriteLn>file_name,result,line
your first WriteLn>
WriteLn>c:\Insertpdfpages\inpdf.ini,[Path]
You have what you want to be the line portion of the statement in the position of the result portion of the statement. So you are writing blank lines.
See if these help, let us know.
Later,
Dick
Without the Get Dialog Action and browse button
Without the Get Dialog Action the browse button wll not update the Edit field. As you suggested I removed the GetdialogAction and when I clicked on the button it did not update.
Thank you for noticing the error in my writeln, I corrected that. But still cannot get rid of the "0"s
Thank you for noticing the error in my writeln, I corrected that. But still cannot get rid of the "0"s
The writeln caused 0 in Dialog
JRL, thank you, you were write. I changed the result field in the writeln to a variable (instead of a blank or a space) and it corrected the issue. Unless I am going to put a comma in the text I never set the result as it has never failed me. I know that is cheating and now it caught up to me.
Thanks again for your help
Thanks again for your help
Now I see what you're talking about... Without the GetDialogAction>s, when you pick on one of your browse buttons all of the previously filled in information disappears. I don't understand that phenomenon. But the GetDialogAction> apparently has some functionallity that doesn't make sense to me. I said before, they aren't hurting anything. In reality they seem to be neccesary.
I'm also still puzzeled by the '0's. Can you post a sample of your INI file. With no INI file, I see nice blank fields.
One other thing. You have no EOF label, at least not in the posted code. So exiting the dialog pops an error.
I see you posted while I was thinking... Glad the '0's are cleared up.
Later,
Dick
I'm also still puzzeled by the '0's. Can you post a sample of your INI file. With no INI file, I see nice blank fields.
One other thing. You have no EOF label, at least not in the posted code. So exiting the dialog pops an error.
I see you posted while I was thinking... Glad the '0's are cleared up.
Later,
Dick