Refreshing Dialog Box difficulty

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Refreshing Dialog Box difficulty

Post by kpassaur » Tue Jul 12, 2005 1:50 pm

I am having difficulty with the Reset Dialog Action Command. It will work sometimes and not on others. I have tried putting it in various places thinking I did something wrong. But I still cannot seem to get it to work consistantly. The script is part of a larger one that creates a list of directories and subdirectories and allow the user to edit the list of directories. For instance, a user could choose Program files and the directory Program files would be added to the list or they could choose directories and sub directories and a list would be created with all the subdirectories of Progam files. Once the screen is updated the user could manually edit the list.

Oh yeah, the rest seems to work correctly as I put the line in MDL>%listselect% in which displays the correct list; however, it is not always updated when the dialog box is displayed.

Any ideas on where I am going wrong?




Dialog>Dialog1
Caption=Dialog1
Top=273
Width=451
Left=302
Height=361
Label=File Folders that will be processed,128,8
Label=Folder List can be edited in the Window Below,104,24
Memo=msMemo1,8,48,417,217,%listselect%
Button=Exit,272,288,75,25,2
Button=Add Folder,80,288,75,25,3
Button=Save and Exit,176,288,81,25,5
EndDialog>Dialog1

Let>rp=0

Label>refresh
Let>rp=rp+1
Let>listselect=
Let>filename=
Let>basepath=
Iffileexists>C:\TextSearchTiffs\tpath.txt,readlist

SRT>readlist
Let>z=1
Label>startlist
ReadLn>C:\TextSearchTiffs\tpath.txt,z,line1
If>line1=##EOF##,finishlist
Let>z=z+1
Length>%line1%,isitblank
/MDL>%line1% %isitblank%
If>%isitblank%%line1%=%CRLF%,startlist
If>%listselect%=0
Let>listselect=%line1%
Goto>skipthebull
Endif

ConCat>listselect,%line1%
Label>skipthebull
ConCat>listselect,%CRLF%
Goto>startlist
Label>finishlist

END>readlist



If>rp=1,skiptheresetdialog
MDL>RP is %rp% %CRLF% List Select is %CRLF% %listselect%
Let>Dialog1.msedit1=%listselect%
ResetDialogAction>Dialog1
Label>skiptheresetdialog



Show>Dialog1
Label>ActionLoop
GetDialogAction>Dialog1,r
If>r=3,Update
if>r=2,Exit
if>r=5,writeit
Goto>ActionLoop

Label>Update
CloseDialog>Dialog1
Input>filename,Browse to a Tiff image in a folder to be Processed
Let>IsItafile={if(pos(".",%filename%)>0,"yes","no")}
If>IsItafile=yes,processfile,readytowrite

SRT>processfile
Len>%filename%,endofline
Sub>endofline,4
Label>repeat
MidStr>%filename%,%endofline%,1,backslash
If>%backslash%=\,gotit,again
Label>again
Sub>endofline,1
If>%endofline%=0
MDL>Error
Endif
Goto>repeat
Label>gotit
MidStr>%filename%,1,%endofline%,basepath
End>processfile

SRT>readytowrite
Let>basepath=%filename%
End>readytowrite


Label>startit
Let>processdir=%basepath%
MDL>%basepath%
Let>OutFile=C:\TextSearchTiffs\tempflist.txt
IfFileExists>OutFile,DelFile
Goto>Start
Label>DelFile
DeleteFile>OutFile
Label>Start
//Create the File List (Hide Dos Window Too)
Ask>Do you want to include the sub directories of %basepath%?,addroot
Let>RP_WINDOWMODE=0
Let>RP_WAIT=1
If>%addroot%=NO
Run Program>cmd.exe /c dir "%processdir%" /ad > C:\TextSearchTiffs\tempflist.txt
Else
Run Program>cmd.exe /c dir "%processdir%" /ad /s > C:\TextSearchTiffs\tempflist.txt
Endif
//Wait for it to finish
Let>RP_WAIT=0

Let>k=1
Label>startparse
ReadLn>C:\TextSearchTiffs\tempflist.txt,k,line
If>line=##EOF##,finish
Length>%line%,Len
If>len>0,dmsg
Let>k=k+1
Goto>startparse


SRT>dmsg
MidStr>%line%,1,10,isdir
If>%isdir%= Directory,dmess
End>dmsg


SRT>dmess
MidSrt>%line%,15,%len%,nline
WriteLn>C:\TextSearchTiffs\tpath.txt,%nline%
Label>skipwriteline
End>dmess

Label>finish
Goto>refresh


Label>writeit
CloseDialog>Dialog1
Deletefile>C:\TextSearchTiffs\tpath.txt
WriteLn>C:\TextSearchTiffs\tpath.txt,result,%Dialog1.msMemo1%

Label>Exit


kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Works on first two tries

Post by kpassaur » Tue Jul 12, 2005 2:36 pm

I caught one mistake, when testing the posted script above I accidently renamed the Dialog1.msMemo1 Dialog1.msEdit1; however, that is not the issue. It still only works sometimes. Usually the first two, sometimes it will work 20 times in a row. Other times it does not work at all

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