Clear Dialog Values

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
D_S
Junior Coder
Posts: 32
Joined: Sun Apr 24, 2005 6:43 pm

Clear Dialog Values

Post by D_S » Tue Jun 03, 2008 4:38 am

I have a labeling program on 20+ pc's throughout the plant that the supervisors want to limit the users ability to modify the data entered into it. So I put together a frontend that has one input screen, the user scans a 2d barcode and the frontend has all of the necessary data to produce a label. The input scan contains 4 items delimited by a comma; template,partno,no of copies, no of labels.

The first check I make after the scan is whether the template <1...an empty scan. When I start the frontend if I hit enter with no data everything works fine. Then I scan data, it's processed and produces a label. If I scan the same data or a new label series instead of processing the data I get the "empty scan" error message.

Guess what I'm needed to happen is after I process a shipping or other label and I return to the top that all variables are zeroed and the show dialog starts over fresh...but I obviously have something out of sync...could use some more experienced eyes to tell me what I'm missing. Thanks

Code: Select all



Let>APP_TITLE=Tattoo Frontend

VBSTART
	   Function GetFileCreatedInfo(filespec)
   	   			Dim fso, f, s
   				Set fso = CreateObject("Scripting.FileSystemObject")
   				Set f = fso.GetFile(filespec)
   				s = f.DateLastModified
   				' you could use s = f.DateLastAccessed
   				' or s = f.DateLastModified
   				GetFileCreatedInfo = s
		End Function
VBEND

Dialog>Dialog1
			  Caption=Tattoo Front End
			  Width=405
			  Height=217
			  Top=507
			  Left=395
			  Label=Scan Your Card Now !!,24,64,true
			  Edit=msEdit1,24,88,345,
			  Button=Ok,120,136,75,25,2
			  Default=Ok
EndDialog>Dialog1


LABEL>CHECKTATTOO
				Let>WF_TYPE=1
				IfWindowOpen>- print by design*,STARTSCAN

LABEL>STARTUP
			 LET>RP_WINDOWMODE=0
			 RUN PROGRAM>C:\Program Files\ISD\Print By Design\PBD.cmd
			 WaitWindowOpen>- print by design*
			 ReadIniFile>c:\frontend\frontend.ini,settings,PbdOpen,Pbd
			 WAIT>%Pbd%
			 GOTO>CHECKTATTOO

LABEL>STARTSCAN
			  Let>TEMPLATE=
			  LET>BTR=
			  LET>COPIES=
			  LET>LABELS=
			  LET>scan_part_1=
			  LET>scan_part_2=
			  LET>scan_part_3=
			  LET>scan_part_4=
			  LET>scan=
			  Show>Dialog1
Label>startin
			 GetDialogAction>Dialog1,r1
			 If>r1=2,endin
			 Wait>0.0001
			 WindowAction>0,Tattoo Front End
			 Goto>startin

Label>endin
		   Let>SCAN=%Dialog1.msEdit1%
		   WindowAction>3,Tattoo Front End
		   Let>comma=,
		   Separate>%SCAN%,comma,scan_part
		   Let>TEMPLATE=%scan_part_1%
		   Let>BTR=%scan_part_2%
		   Let>COPIES=%scan_part_3%
		   Let>LABELS=%scan_part_4%
		   wait>.1
		   CloseDialog>Dialog1
		   if>%TEMPLATE%<1>Dialog1*/
		   Day>the_day
		   Month>the_month
		   Year>the_year
		   Hour>HR
		   Min>Mn
		   Let>NOW=%the_year%%the_month%%the_day%%HR%%Mn%
		   Let>WF_TYPE=1
		   IfWindowOpen>- print by design*,TEMPLTEST
		   LET>RP_WINDOWMODE=0
		   RUN PROGRAM>C:\Program Files\ISD\Print By Design\PBD.cmd
		   WaitWindowOpen>- print by design*
		   ReadIniFile>c:\frontend\frontend.ini,settings,PbdOpen,Pbd
		   WAIT>%Pbd%

LABEL>TEMPLTEST
			   Let>k=1

LABEL>READTEMPLATE
				  ReadLn>C:\FRONTEND\TEMPLATE.TXT,k,LINE
				  If>line=##EOF##,BADTEMPL
				  IF>%LINE%=%TEMPLATE%,LABELTYPE
				  Let>k=k+1
				  Goto>READTEMPLATE

LABEL>LABELTYPE
			   Let>k=1

LABEL>READXLB
			 ReadLn>C:\FRONTEND\XLB.TXT,k,LINE
			 If>line=##EOF##,SHIPPRINT
			 IF>%LINE%=%TEMPLATE%,XLBPRINT
			 Let>k=k+1
			 Goto>READXLB

LABEL>SHIPPRINT
               ReadIniFile>c:\frontend\frontend.ini,settings,%BTR%,oldtime
			   Let>NEWTIME=%NOW%
			   If>%oldtime%<1>YESBTR

LABEL>NOBTR
		   WRITELN>C:\FRONTEND\FRONTEND.INI,%BTR%=%NOW%
		   GOTO>SHIPLABEL


LABEL>YESBTR
			IF>NEWTIME<OLDTIME>DIF=5
			GOTO>SORRYCHARLIE1

LABEL>YESBTR1
			 Let>DIF2=%NEWTIME%-%OLDTIME%
			 IF>%DIF2%<5>SHIPLABEL
			   Let>WF_TYPE=1
			   IfWindowOpen>- print by design*,SHIP2
			   LET>RP_WINDOWMODE=0
			   RUN PROGRAM>C:\Program Files\ISD\Print By Design\PBD.cmd
			   WaitWindowOpen>- print by design*
			   ReadIniFile>c:\frontend\frontend.ini,settings,PbdOpen,Pbd
			   WAIT>%Pbd%

LABEL>SHIP2
		   EditIniFile>C:\FRONTEND\FRONTEND.INI,settings,%BTR%,%NOW%
		   WindowAction>1,- print by design*
		   setfocus>- print by design*
		   ReadIniFile>c:\frontend\frontend.ini,shipping,PbdOpen,Pbd
		   WAIT>%Pbd%
		   ReadIniFile>c:\frontend\frontend.ini,settings,fip,fip_1
		   Let>FIP_SCANPIXELS=%fip_1%
		   ReadIniFile>c:\frontend\frontend.ini,settings,colort,color_t
		   FindImagePos>C:\FRONTEND\CLEAR.BMP,SCREEN,%color_t%,1,XPS,YPS,NumFound
		   MouseMove>%XPS_0%,%YPS_0%
		   LClick
		   ReadIniFile>c:\frontend\frontend.ini,shipping,MouseClear,MouseC
		   WAIT>%MouseC%
		   Send>%TEMPLATE%
		   Press DOWN
		   ReadIniFile>c:\frontend\frontend.ini,shipping,TemplateWait,TempWait
		   WAIT>%TempWait%
		   Send>%BTR%%CR%
		   ReadIniFile>c:\frontend\frontend.ini,shipping,PnWait,Pnw
		   WAIT>%Pnw%
		   send>%COPIES%%CR%
		   ReadIniFile>c:\frontend\frontend.ini,shipping,CopiesWait,CopW
		   WAIT>%CopW%
		   send>%LABELS%%CR%
		   ReadIniFile>c:\frontend\frontend.ini,shipping,LabelsWait,LabW
		   WAIT>%LabW%
		   send>%CR%
		   ReadIniFile>c:\frontend\frontend.ini,shipping,PrintersWait,PrnW
		   WAIT>%PrnW%
		   send>%CR%
		   ReadIniFile>c:\frontend\frontend.ini,shipping,PrintWait,PntW
		   WAIT>%PntW%
		   WindowAction>2,- print by design*
		   Let>%Dialog1.msEdit1%=
		   IfFileExists>L:\btr_current\db1.mdb,cdbcheck
		   WRITELN>C:\FRONTEND\tattoo.log,%NOW% Could not read from the L drive
		   wait>.5
		   GOTO>CHECKTATTOO

Label>cdbcheck
		   IfFileExists>c:\btr_current\db1.mdb,dbcheck
		   goto>checkpbd

Label>dbcheck
			 VBEVAL>GetFileCreatedInfo("c:\btr_current\db1.mdb"),localdate
			 VBEVAL>GetFileCreatedInfo("L:\btr_current\db1.mdb"),netdate
			 if>netdate<localdate>.5
		   	 GOTO>CHECKTATTOO

label>checkpbd
			  IfWindowOpen>- print by design*,shutdown
			  goto>copynow

label>shutdown
			  setfocus>- print by design*
			  WaitWindowOpen>- print by design*
			  press alt
			  press f4
			  release alt
			  wait>3
			  goto>checkpbd

label>copynow
			 wait>2
			 Let>CF_OVERWRITE=1
			 let>file1=cmd.exe /c copy L:\btr_current\db1.mdb
			 let>file2=c:\btr_current\db1.mdb
			 let>RP_WINDOWMODE=0
			 let>RP_WAIT=1
			 Run Program>%file1%, %file2%
			 wait>.5
		     GOTO>CHECKTATTOO

Label>XLBPRINT
			  Let>WF_TYPE=1
			  IfWindowOpen>- print by design*,XLBPRINT2
			  RUN PROGRAM>C:\Program Files\ISD\Print By Design\PBD.cmd
			  WaitWindowOpen>- print by design*
			  ReadIniFile>c:\frontend\frontend.ini,settings,PbdOpen,Pbd
			  WAIT>%Pbd%

LABEL>XLBPRINT2
			   WindowAction>1,- print by design*
			   setfocus>- print by design*
			   ReadIniFile>c:\frontend\frontend.ini,xlb,PbdOpen,PbdO
			   WAIT>%PbdO%
			   ReadIniFile>c:\frontend\frontend.ini,settings,fip,fip_1
			   Let>FIP_SCANPIXELS=%fip_1%
			   ReadIniFile>c:\frontend\frontend.ini,settings,colort,color_t
			   FindImagePos>C:\FRONTEND\CLEAR.BMP,SCREEN,%color_t%,1,XPS,YPS,NumFound
			   MouseMove>%XPS_0%,%YPS_0%
			   LClick
			   ReadIniFile>c:\frontend\frontend.ini,xlb,MouseClear,MouC
			   WAIT>%MouC%
			   Send>%TEMPLATE%
			   Press DOWN
			   ReadIniFile>c:\frontend\frontend.ini,xlb,TemplateWait,TempW
			   WAIT>%TempW%
			   Send>%COPIES%%CR%
			   ReadIniFile>c:\frontend\frontend.ini,xlb,CopiesWait,CopW
			   WAIT>%CopW%
			   send>%LABELS%%CR%
			   ReadIniFile>c:\frontend\frontend.ini,xlb,LabelsWait,LabWt
			   WAIT>%LabWt%
			   send>%CR%
			   ReadIniFile>c:\frontend\frontend.ini,xlb,PrintersWait,PrnsW
			   WAIT>%PrnsW%
			   send>%CR%
			   ReadIniFile>c:\frontend\frontend.ini,xlb,PrintWait,PntWt
			   WAIT>%PntWt%
			   WindowAction>2,- print by design*
			   IfFileExists>L:\btr_current\db1.mdb,dbcheck2
			   WRITELN>C:\FRONTEND\tattoo.log,%NOW% Could not read from the L drive
			   wait>.5
			   GOTO>CHECKTATTOO

Label>dbcheck2
			  IfFileExists>C:\btr_current\db1.mdb,FILEEVAL2
			  goto>checkpbd2

LABEL>FILEEVAL2
			   VBEVAL>GetFileCreatedInfo("c:\btr_current\db1.mdb"),localdate
			   VBEVAL>GetFileCreatedInfo("L:\btr_current\db1.mdb"),netdate
			   if>netdate<localdate>.5
			   GOTO>CHECKTATTOO

label>checkpbd2
			   IfWindowOpen>- print by design*,shutdown2
			   goto>copynow2

label>shutdown2
			   setfocus>- print by design*
			   WaitWindowOpen>- print by design*
			   press alt
			   press f4
			   release alt
			   wait>3
			   goto>checkpbd2

label>copynow2
			  wait>2
			  Let>CF_OVERWRITE=1
			  let>file1=cmd.exe /c copy L:\btr_current\db1.mdb
			  let>file2=c:\btr_current\db1.mdb
			  let>RP_WINDOWMODE=0
			  let>RP_WAIT=1
			  Run Program>%file1%, %file2%
			  wait>.5
		      GOTO>CHECKTATTOO


LABEL>SORRYCHARLIE
				  LET>DIF=5-%DIF2%
LABEL>SORRYCHARLIE1
				   MESSAGE>You must wait %DIF% minute(s)before you can print this part number again.
				   LET>DIF=
				   GOTO>MSG

LABEL>BADSCAN
			 MESSAGE>The scan was bad, please try again.
			 GOTO>MSG
LABEL>BADTEMPL
			  MESSAGE>This scan card does not work on this label station.%CRLF%%CRLF%Contact your supervisor%CRLF%%CRLF%    %TEMPLATE%%CRLF%
			  WAIT>3
			  GOTO>MSG

LABEL>MSG
		 wait>7
		 Let>WF_TYPE=1
		 WindowAction>3,Tattoo Frontend Mess*
		 wait>.5
		 Let>Dialog1.msEdit1=
		 ResetDialogAction>Dialog1
		 wait>.2
		  GOTO>CHECKTATTOO



D_S
Junior Coder
Posts: 32
Joined: Sun Apr 24, 2005 6:43 pm

Post by D_S » Tue Jun 03, 2008 5:52 pm

Went back and cleaned up the code a bit and then modified the original post. For troubleshooting I put mdl statements in working copy everywhere and this is what I find....

I start the program and scan this string gm_2&4s.tld,11013202266,1,1,label is produced. At the end of the shipping label routine I clear all variables and then loop back to the top and show the dialog.

I scan in ch_rh.tld,10722206024,1,1, label is produced, all variables cleared loop back to top and dialog is reshown.

Now if I enter anything else that starts out with either gm_2&4s.tld or ch_rh.tld the mdl will show that dialog1.msedit1 has the new data but nothing after the showdialog is acted on ....all variables remain cleared. If I scan anything else that has not been previously scanned the program will run that single time for that item and then it will no longer scan and be acted upon.

Anyone see what I'm missing here?

D_S
Junior Coder
Posts: 32
Joined: Sun Apr 24, 2005 6:43 pm

Post by D_S » Tue Jun 03, 2008 10:45 pm

guess you can disregard my post...figured it out. Apparently I wasn't properly clearing the variables in all parts of my script..it's now working fine.

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