Dialog Help

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
MGuyM
Junior Coder
Posts: 36
Joined: Tue Jul 24, 2007 12:59 am

Dialog Help

Post by MGuyM » Wed Jun 25, 2008 9:44 pm

I need some help with creating two Dialogs.

The First one will allow the user to Select and Input File (I've read about the FileBrowse option, but can't seem to understand it and I've tried searching the forums, but I'm not having any luck).

The Second one, will be a progress display. My Source File will contain about 10000 Records and as my Macro progresses through the file, I'd like to show a status display on screen in a Dialog Box. I want this Dialog box to contain the current record that is being processed as well as data retrieved from the Web Site that is being written to the Output file. My Source File is a CSV File and is there an easy way to get the total number of records in the file before processing without having to take the extra time to do a For Loop setting a value to the number of records read? Maybe the whole file could be retrieved and the number of lines counted pretty easily (not sure and need some help on this).

I'm sure that through my process, I have to call a certain location to display the Dialog Box on Screen with the updated information.

Any Links, Help, Pointers would be greatly appreciated on this problem.

Thank You.

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

Post by JRL » Thu Jun 26, 2008 1:32 pm

is there an easy way to get the total number of records in the file before processing without having to take the extra time to do a For Loop setting a value to the number of records read?
One way to do this is here:
http://www.mjtnet.com/forum/viewtopic.php?t=3069
The First one will allow the user to Select and Input File
Here's a snippet of code to do a filebrowse dialog and then put the contents of the selected file to a variable named "filedata"

Code: Select all

Dialog>Dialog1
   Caption=Select
   Width=817
   Height=133
   Top=CENTER
   Left=CENTER
   Label=msLabel1,16,16
   Edit=msEdit1,8,32,713,
   Button=Ok,360,64,75,25,3
   Button=Browse,728,32,75,25,0
   FileBrowse=Browse,msEdit1,CSV files|*.CSV,open
EndDialog>Dialog1

Show>dialog1,res1

ReadFile>dialog1.msEdit1,filedata
The Second one, will be a progress display. My Source File will contain about 10000 Records and as my Macro progresses through the file, I'd like to show a status display on screen in a Dialog Box
Here is a extension of the previous snippet that will display the line number of the csv file being "processed" and the first field information on the processed line. also notice that the value of variable record_count will be another way to see the total number of lines in the file.

Code: Select all

Dialog>Dialog1
   Caption=Select
   Width=817
   Height=133
   Top=CENTER
   Left=CENTER
   Label=msLabel1,16,16
   Edit=msEdit1,8,32,713,
   Button=Ok,360,64,75,25,3
   Button=Browse,728,32,75,25,0
   FileBrowse=Browse,msEdit1,CSV files|*.CSV,open
EndDialog>Dialog1

Show>dialog1,res1

Dialog>Dialog3
   Caption=Process Status
   Width=348
   Height=119
   Top=203
   Left=314
   Label=Line Number:,48,24
   Label=msLabel2,120,24
   Label=Data Read:,48,48
   Label=msLabel4,120,48
EndDialog>Dialog3

Show>dialog3

ReadFile>dialog1.msEdit1,filedata
Separate>filedata,%CRLF%,record

Let>comma=,
Let>kk=0
Repeat>kk
  GetDialogAction>dialog3,res3
  If>res3=2,EOF
  Add>kk,1
  Let>value=record_%kk%
  Separate>value,comma,field
  Let>dialog3.mslabel2=%kk%
  Let>dialog3.mslabel4=%field_1%
  Wait>0.01
Until>kk,%record_count%

Label>EOF

MGuyM
Junior Coder
Posts: 36
Joined: Tue Jul 24, 2007 12:59 am

Post by MGuyM » Thu Jun 26, 2008 4:33 pm

Thank You So Much for your Reply.

That gives me a start on my project.

The more time I spend with MS, the More I love it and wonder why it took me so long to sit down and start working with it :).

Thank You again.

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