I am hoping that someone can help. I am pulling out one of my last 5 hairs. I am using a script to select a file for reprinting in a production print facility. I use a two dialog boxes and some logic to send the print file selected to the printer. I am attaching the entire script below for reference but the particular problem that I am having revolves around using the IF command with wildcards. The filename that I have been testing with is 9638891.ps and the IF command that should recognize and branch to the appropriate point is below:
if>%Dialog3.msListBox1%=*9638891*.ps,ordered
where %Dialog3.msListBox1% is a variable that contains the file that was selected from the list box. What is happening is that it ignores the wildcard and proceeds to the next line of processing without branching to the label called ordered. I have tried hardcoding the IF statement to match exactly the file name and it works fine so I am really confused. Please help if you can and respond to this post or to me directly at [email protected]. Thanks so much.
Here is the script in its entirety:
cha>d:\atest
let>tagreprintqueue=REPRINT
let>reportreprintqueue=REPRINT
let>mainreprintqueue=REPRINT
let>orderedreprintqueue=REPRINT
let>gary=0
Dialog>Dialog3
Caption=Reprint Window
Top=108
Width=625
Left=85
Height=344
Label=Please Select the file that you wish to reprint and push the button for the printer that you wish to send it to,8,16
ListBox=msListBox1,16,48,465,153,filename
Button=Printer 1,496,56,75,25,10
Button=Printer 2,496,96,75,25,20
Button=Cancel,496,136,75,25,1
EndDialog>Dialog3
Dialog>Confirmation
Caption=Confirmation
Top=108
Width=207
Left=85
Height=110
Label=Are you sure?,16,8
Button=Yes,16,40,75,25,30
Button=No,112,40,75,25,40
EndDialog>Confirmation
Dialog>Dialog5
Caption=Dialog5
Top=220
Width=246
Left=310
Height=141
Label=What type of file are you requesting a reprint,16,8
Button=Mainframe Jobs,24,40,75,25,10
Button=Reports,112,40,75,25,20
Button=Escorte Tags,24,72,75,25,30
EndDialog>Dialog5
GetFileList>*.ps,files
Separate>files,;,file_names
let>filename2=
Let>z=0
Repeat>z
Let>z=z+1
let>filename=file_names_%z%
midstr>filename,2,100,filename
rem>concat>filename2,filename
concat>filename,%CRLF%
rem>messagemodal>%filename2%
Until>z,file_names_count
label>return
show>Dialog3,result2
if>result2=1,end
show>Confirmation,result_confirmation
if>result_confirmation=40,return
if>result2=20,Printer2
messagemodal>Sending %Dialog3.msListBox1% to Printer 1
rem>if>%Dialog3.msListBox1%=*099108*.ps,tags
rem>if>%Dialog3.msListBox1%=*pw*.ps,reports
if>%Dialog3.msListBox1%=*9638891*.ps,ordered
rem>run program>command.com /c lpr -S10.4.117.45 -P %mainreprintqueue% g:\Mainframe\Source~1\%Dialog3.msListBox1%
let>gary=1
goto>end
label>reports
rem>run program>command.com /c lpr -S10.4.117.45 -P %reportreprintqueue% g:\Mainframe\Source~1\%Dialog3.msListBox1%
let>gary=2
goto>end
label>tags
rem>run program>command.com /c lpr -S10.4.117.45 -P %tagreprintqueue% g:\Mainframe\Source~1\%Dialog3.msListBox1%
let>gary=3
goto>end
label>ordered
rem>run program>command.com /c lpr -S10.4.117.45 -P %orderedreprintqueue% g:\Mainframe\Source~1\%Dialog3.msListBox1%
let>gary=4
goto>end
label>Printer2
messagemodal>Sending %Dialog3.msListBox1% to Printer 2
if>%Dialog3.msListBox1%=*099108*.ps,tags
if>%Dialog3.msListBox1%=*pw*.ps,reports
if>%Dialog3.msListBox1%=*963889*.ps,ordered
rem>run program>command.com /c lpr -S10.4.117.46 -P %mainreprintqueue% g:\Mainframe\Source~1\%Dialog3.msListBox1%
let>gary=5
goto>end
label>reports
rem>run program>command.com /c lpr -S10.4.117.46 -P %reportreprintqueue% g:\Mainframe\Source~1\%Dialog3.msListBox1%
let>gary=6
goto>end
label>tags
rem>run program>command.com /c lpr -S10.4.117.46 -P %tagreprintqueue% g:\Mainframe\Source~1\%Dialog3.msListBox1%
let>gary=7
goto>end
label>ordered
rem>run program>command.com /c lpr -S10.4.117.46 -P %orderedreprintqueue% g:\Mainframe\Source~1\%Dialog3.msListBox1%
let>gary=8
goto>end
label>end
messagemodal>%RP_RESULT%,%gary%
Help on script
Moderators: JRL, Dorian (MJT support)
Hi,
There is no such thing as wildcards in IF statements. If you want to check for the existance of one string in another (which appears to be the case here) then use the Position command to return the position of the search string in the string and then use IF on the result. If zero, no match, if larger than zero the substring exists.
There is no such thing as wildcards in IF statements. If you want to check for the existance of one string in another (which appears to be the case here) then use the Position command to return the position of the search string in the string and then use IF on the result. If zero, no match, if larger than zero the substring exists.
MJT Net Support
[email protected]
[email protected]