Re-Using Dialog Variable

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
gchichester
Pro Scripter
Posts: 132
Joined: Mon Dec 22, 2008 4:56 pm
Location: St Augustine FL

Re-Using Dialog Variable

Post by gchichester » Mon Jun 01, 2009 6:44 pm

I'm back and working some enhancements to my automation project.

One enhancement I would like to have is the ability for a user to reuse data
that was keyed into a dialog box.
When they open a new dialog box, click on “Use Last Recordâ€

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

Post by JRL » Tue Jun 02, 2009 3:15 am

Is something like this what you're looking for?

Code: Select all

//Predefine a file name of your choice for storing the
//edit box entries.
Let>StorageFile=%temp_dir%EditBoxSave.ini

Dialog>Dialog1
   Caption=Remember Me
   Width=280
   Height=172
   Top=116
   Left=26
   Edit=msEdit1,35,22,121,
   Edit=msEdit2,35,54,121,
   Button=Ok,58,99,75,25,2
   Button=Use Last,179,39,75,25,3
EndDialog>Dialog1

Show>Dialog1

Label>Loop
  GetDialogAction>Dialog1,res1
  If>res1=2
    //On exit, save the new values of teh edit boxes to the ini file
    EditIniFile>StorageFile,Last,Box1,Dialog1.msedit1
    EditIniFile>StorageFile,Last,Box2,Dialog1.msedit2
    Exit>0
  EndIf
  If>res1=3
    GoSub>UseLast
  EndIf
Goto>Loop


SRT>UseLast
  //If the ini file exists read the previously saved values
//Else create the ini file with empty values
IfFileExists>StorageFile
  ReadIniFile>StorageFile,Last,Box1,Dialog1.msedit1
  ReadIniFile>StorageFile,Last,Box2,Dialog1.msedit2
Else
  WriteLn>StorageFile,wres,[Last]
  WriteLn>StorageFile,wres,Box1=
  WriteLn>StorageFile,wres,Box2=
EndIf

//Reset Dialog1 to reflect the predefined edit box variables
ResetDialogAction>Dialog1
END>UseLast

gchichester
Pro Scripter
Posts: 132
Joined: Mon Dec 22, 2008 4:56 pm
Location: St Augustine FL

Re-Using Dialog Variable

Post by gchichester » Tue Jun 02, 2009 2:43 pm

Thanks, Yes this is exactly what I need.
It’s all working except for one small issue,
I can’t read the file back into the dialog,
I can see the data in the file, so I know is writing the data
There must be a piece of the logic that I missing.
I have included both script, BolDialog, DialogActon for your review.
Thanks again for your insite.

Gilc

BolDialog
--------------------------------------------------------
Let>IGNORESPACES=1
//Let>WW_TIMEOUT=5
Step_Delay=300
Let>vWait=0.45
Let>SW=0.15
CapsOn
Dialog>BoLDialog
Caption=Bill of Lading Info
Left=430
Top=100
Width=340
Height=500
Label=Shipper Name:,10,20
Edit=ShpName,100,20,120,
Label=Booking Number:,10,45
Edit=BkNum,100,45,120,
Label=Bill of Lading #:,10,70
Edit=BoLNum,100,70,120,
Label=Reference:,10,95
Edit=RefNum,100,95,120,
Label=Carrier Code:,10,120
Edit=SLCode,100,120,120,
Label=Departure Date:,10,145
Edit=DDate,100,145,120,
Label=Loading Port:,10,170
Edit=LPort,100,170,120,
Label=Port of Discharge:,10,195
Edit=DPort,100,195,120,
Label=Vessel Name:,10,220
Edit=VName,100,220,120,
Label=Container #:,10,245
Edit=ContNum,100,245,120,
//Label= Num of Containers:,225,230
//Edit=NumOfCont,250,245,40,
Label=Seal Number:,10,270
Edit=SNum,100,270,120,
Label=Quantity:,10,295
Edit=CtnQty,100,295,120,
Label=Weight:,10,320
Edit=ContWgt,100,320,120,
Label=Service Contract:,10,345
Edit=SrvContract,100,345,120,
Label=Temp:,10,370
Edit=Temp,100,370,120,
Label=Vents:,10,395
Edit=Vents,100,395,120,
Label=Total Cartons:,10,420
Edit=Cartons,100,420,120,
Button=Done,10,445,75,20,2
Button=Update,216,445,75,20,1
Button=Use Last,116,445,75,20,3
EndDialog>BoLDialog
Show>BoLDialog
Include>c:\CP_Macros\JohnW\DialogAction.scp


DialogAction
--------------------------------------------------------
Step_Delay=200
Let>vWait=0.50
Let>SW=0.15
Let>UpdateFlag=1
Let>StorageFile=c:\cp_macros\johnw\BolSave.ini
Label>ActionLoop
GetDialogAction>BoLDialog,r

If>{(%BoLDialog.ShpName% = "DIVE") AND (%BoLDialog.SLCode% = "APLU")}
Let>SrvContNum= TA08/0134
EndIf

If>{(%BoLDialog.ShpName% = "DIVE") AND (%BoLDialog.SLCode% = "HJSC")}
Let>SrvContNum=ANE25230
EndIf

If>{(%BoLDialog.ShpName% = "DIVE") AND (%BoLDialog.SLCode% = "MAEU")}
Let>SrvContNum=297908
EndIf

//------------------------------------------------------------------------------
If>{(%BoLDialog.ShpName% = "DLF") AND (%BoLDialog.SLCode% = "APLU")}
Let>SrvContNum=GB08/0285
EndIf

If>{(%BoLDialog.ShpName% = "DLF") AND (%BoLDialog.SLCode% = "HJSC")}
Let>SrvContNum=ANE25236
EndIf

If>{(%BoLDialog.ShpName% = "DLF") AND (%BoLDialog.SLCode% = "MAEU")}
Let>SrvContNum=297917
EndIf

//------------------------------------------------------------------------------
If>{(%BoLDialog.ShpName% = "DNE") AND (%BoLDialog.SLCode% = "APLU")}
Let>SrvContNum=TA8/0128
EndIf

If>{(%BoLDialog.ShpName% = "DNE") AND (%BoLDialog.SLCode% = "CMDU")}
Let>SrvContNum=08 1373
EndIf

If>{(%BoLDialog.ShpName% = "DNE") AND (%BoLDialog.SLCode% = "ELGV")}
Let>SrvContNum=SC35384
EndIf

If>{(%BoLDialog.ShpName% = "DNE") AND (%BoLDialog.SLCode% = "HJSC")}
Let>SrvContNum=ANE25189
EndIf

If>{(%BoLDialog.ShpName% = "DNE") AND (%BoLDialog.SLCode% = "HLCU")}
Let>SrvContNum=S8NSE033
EndIf

If>{(%BoLDialog.ShpName% = "DNE") AND (%BoLDialog.SLCode% = "MAEU")}
Let>SrvContNum=295657
EndIf

If>{(%BoLDialog.ShpName% = "DNE") AND (%BoLDialog.SLCode% = "OOLU")}
Let>SrvContNum=AE085703
EndIf

//------------------------------------------------------------------------------
If>{(%BoLDialog.ShpName% = "DUDA") AND (%BoLDialog.SLCode% = "APLU")}
Let>SrvContNum=TA08/0170
EndIf

//------------------------------------------------------------------------------
If>{(%BoLDialog.ShpName% = "GREENE") AND (%BoLDialog.SLCode% = "APLU")}
Let>SrvContNum=WB08/0279
EndIf

If>{(%BoLDialog.ShpName% = "GREENE") AND (%BoLDialog.SLCode% = "CMDU")}
Let>SrvContNum=09 0087
EndIf

If>{(%BoLDialog.ShpName% = "GREENE") AND (%BoLDialog.SLCode% = "HJSC")}
Let>SrvContNum=ANE25240
EndIf

If>{(%BoLDialog.ShpName% = "GREENE") AND (%BoLDialog.SLCode% = "HLCU")}
Let>SrvContNum=S8NSE035
EndIf

If>{(%BoLDialog.ShpName% = "GREENE") AND (%BoLDialog.SLCode% = "MAEU")}
Let>SrvContNum=299454
EndIf

//------------------------------------------------------------------------------
If>{(%BoLDialog.ShpName% = "HELLER") AND (%BoLDialog.SLCode% = "MAEU")}
Let>SrvContNum=300297
EndIf

//------------------------------------------------------------------------------LEROY SMITH
If>{(%BoLDialog.ShpName% = "LEROY") AND (%BoLDialog.SLCode% = "HJSC")}
Let>SrvContNum=ANE25237
EndIf

If>{(%BoLDialog.ShpName% = "LEROY") AND (%BoLDialog.SLCode% = "HLCU")}
Let>SrvContNum=S8NSE042
EndIf

If>{(%BoLDialog.ShpName% = "LEROY") AND (%BoLDialog.SLCode% = "MAEU")}
Let>SrvContNum=298208
EndIf

//------------------------------------------------------------------------------
If>{(%BoLDialog.ShpName% = "PACKERS") AND (%BoLDialog.SLCode% = "APLU")}
Let>SrvContNum=TA08/0136
EndIf

If>{(%BoLDialog.ShpName% = "PACKERS") AND (%BoLDialog.SLCode% = "HJSC")}
Let>SrvContNum=ANE25235
EndIf

If>{(%BoLDialog.ShpName% = "PACKERS") AND (%BoLDialog.SLCode% = "MAEU")}
Let>SrvContNum=297926
EndIf

If>{(%BoLDialog.ShpName% = "PACKERS") AND (%BoLDialog.SLCode% = "OOLU")}
Let>SrvContNum=AE085074
EndIf

//------------------------------------------------------------------------------
If>{(%BoLDialog.ShpName% = "PIONEER") AND (%BoLDialog.SLCode% = "APLU")}
Let>SrvContNum=TA08/0166
EndIf

//------------------------------------------------------------------------------
If>{(%BoLDialog.ShpName% = "PREMIER") AND (%BoLDialog.SLCode% = "APLU")}
Let>SrvContNum=WB08/0273
EndIf

If>{(%BoLDialog.ShpName% = "PREMIER") AND (%BoLDialog.SLCode% = "CMDU")}
Let>SrvContNum=08 1478
EndIf

If>{(%BoLDialog.ShpName% = "PREMIER") AND (%BoLDialog.SLCode% = "HJSC")}
Let>SrvContNum=ANE25233
EndIf

If>{(%BoLDialog.ShpName% = "PREMIER") AND (%BoLDialog.SLCode% = "HLCU")}
Let>SrvContNum=S8NSE036
EndIf

If>{(%BoLDialog.ShpName% = "PREMIER") AND (%BoLDialog.SLCode% = "MAEU")}
Let>SrvContNum=299578
EndIf

//------------------------------------------------------------------------------
If>{(%BoLDialog.ShpName% = "RIVER") AND (%BoLDialog.SLCode% = "APLU")}
Let>SrvContNum=WB08/0274
EndIf

//------------------------------------------------------------------------------
If>{(%BoLDialog.ShpName% = "SCOTT") AND (%BoLDialog.SLCode% = "APLU")}
Let>SrvContNum=GB08/0276
EndIf

If>{(%BoLDialog.ShpName% = "SCOTT") AND (%BoLDialog.SLCode% = "HJSC")}
Let>SrvContNum=ANE25239
EndIf

If>{(%BoLDialog.ShpName% = "SCOTT") AND (%BoLDialog.SLCode% = "HLCU")}
Let>SrvContNum=S8NES045
EndIf

If>{(%BoLDialog.ShpName% = "SCOTT") AND (%BoLDialog.SLCode% = "MAEU")}
Let>SrvContNum=297928
EndIf

//------------------------------------------------------------------------------
If>{(%BoLDialog.ShpName% = "SEALD") AND (%BoLDialog.SLCode% = "APLU")}
Let>SrvContNum=GB08/0280
EndIf

If>{(%BoLDialog.ShpName% = "SEALD") AND (%BoLDialog.SLCode% = "HJSC")}
Let>SrvContNum=ANE25264
EndIf

If>{(%BoLDialog.ShpName% = "SEALD") AND (%BoLDialog.SLCode% = "HLCU")}
Let>SrvContNum=S8NSE046
EndIf

If>{(%BoLDialog.ShpName% = "SEALD") AND (%BoLDialog.SLCode% = "MAEU")}
Let>SrvContNum=299579
EndIf
//------------------------------------------------------------------------------
If>{(%BoLDialog.ShpName% = "SUNNY") AND (%BoLDialog.SLCode% = "APLU")}
Let>SrvContNum=TA08/0156
EndIf

//------------------------------------------------------------------------------
Length>BoLDialog.DDate,vLen
If>{(%vlen%=6)and(%UpdateFlag%=1)},Update
If>r=1,Update
If>r=2,Exit
If>r=6,Close
GoTo>ActionLoop
Label>Exit

//------------------------------------------------------------------------------
SRT>Update
Let>UpdateFlag=0
Let>BoLDialog.SrvContract=%SrvContNum%
ResetDialogAction>BoLDialog
END>Update

//------------------------------------------------------------------------------
Label>Loop
GetDialogAction>BolDialog,res1
If>res1=2
//On exit, save the new values of the edit boxes to the ini file
EditIniFile>StorageFile,Last,Box1,BolDialog.ShpName
EditIniFile>StorageFile,Last,Box2,BolDialog.BkNum
EditIniFile>StorageFile,Last,Box3,BolDialog.BoLNum
EditIniFile>StorageFile,Last,Box4,BolDialog.RefNum
EditIniFile>StorageFile,Last,Box5,BolDialog.SLCode
EditIniFile>StorageFile,Last,Box6,BolDialog.DDate
EditIniFile>StorageFile,Last,Box7,BolDialog.LPort
EditIniFile>StorageFile,Last,Box8,BolDialog.DPort
EditIniFile>StorageFile,Last,Box9,BolDialog.VName
EditIniFile>StorageFile,Last,Box10,BolDialog.ContNum
EditIniFile>StorageFile,Last,Box11,BolDialog.SNum
EditIniFile>StorageFile,Last,Box12,BolDialog.CtnQty
EditIniFile>StorageFile,Last,Box13,BolDialog.ContWgt
EditIniFile>StorageFile,Last,Box14,BolDialog.SrvContract
EditIniFile>StorageFile,Last,Box15,BolDialog.Temp
EditIniFile>StorageFile,Last,Box16,BolDialog.Vents
EditIniFile>StorageFile,Last,Box17,BolDialog.Cartons
Exit>0
EndIf
If>res1=3
GoSub>UseLast
EndIf
Goto>Loop

SRT>UseLast
//If the ini file exists read the previously saved values
//Else create the ini file with empty values
IfFileExists>StorageFile
ReadIniFile>StorageFile,Last,Box1,BolDialog.ShpName
ReadIniFile>StorageFile,Last,Box2,BolDialog.BkNum
ReadIniFile>StorageFile,Last,Box3,BolDialog.BoLNum
ReadIniFile>StorageFile,Last,Box4,BolDialog.RefNum
ReadIniFile>StorageFile,Last,Box5,BolDialog.SLCode
ReadIniFile>StorageFile,Last,Box6,BolDialog.DDate
ReadIniFile>StorageFile,Last,Box7,BolDialog.LPort
ReadIniFile>StorageFile,Last,Box8,BolDialog.DPort
ReadIniFile>StorageFile,Last,Box9,BolDialog.VName
ReadIniFile>StorageFile,Last,Box10,BolDialog.ContNum
ReadIniFile>StorageFile,Last,Box11,BolDialog.SNum
ReadIniFile>StorageFile,Last,Box12,BolDialog.CtnQty
ReadIniFile>StorageFile,Last,Box13,BolDialog.ContWgt
ReadIniFile>StorageFile,Last,Box14,BolDialog.SrvContract
ReadIniFile>StorageFile,Last,Box15,BolDialog.Temp
ReadIniFile>StorageFile,Last,Box16,BolDialog.Vents
ReadIniFile>StorageFile,Last,Box17,BolDialog.Cartons
Else
WriteLn>StorageFile,wres,[Last]
WriteLn>StorageFile,wres,Box1=
WriteLn>StorageFile,wres,Box2=
WriteLn>StorageFile,wres,Box3=
WriteLn>StorageFile,wres,Box4=
WriteLn>StorageFile,wres,Box5=
WriteLn>StorageFile,wres,Box6=
WriteLn>StorageFile,wres,Box7=
WriteLn>StorageFile,wres,Box8=
WriteLn>StorageFile,wres,Box9=
WriteLn>StorageFile,wres,Box10=
WriteLn>StorageFile,wres,Box11=
WriteLn>StorageFile,wres,Box12=
WriteLn>StorageFile,wres,Box13=
WriteLn>StorageFile,wres,Box14=
WriteLn>StorageFile,wres,Box15=
WriteLn>StorageFile,wres,Box16=
WriteLn>StorageFile,wres,Box17=
EndIf

//Reset Dialog1 to reflect the predefined edit box variables
ResetDialogAction>BolDialog
END>UseLast

//------------------------------------------------------------------------------
SRT>Close
CloseDialog>BoLDialog
Let>r=2
END>Close

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

Post by JRL » Tue Jun 02, 2009 3:03 pm

Your logic was a bit off due to too many loops, you would never get to the read of the ini file. This is not tested but I think its right. I moved the test for the "Use Last" button press back to your ActionLoop and completely removed the loop named "Loop". Also, the result variable for the button press was changed from "res1" to "r" to be consistent with your GetDialogAction> line.

Try it... see if it works. Coincidentally I'm also working on shipping scripts today.

Edit:
OOPS:
Just realized I remarked out two lines so I could step through this on my computer. They are now fixed in this post. Sorry.

Code: Select all

Let>IGNORESPACES=1
//Let>WW_TIMEOUT=5
Step_Delay=300
Let>vWait=0.45
Let>SW=0.15
CapsOn
Dialog>BoLDialog
Caption=Bill of Lading Info
Left=430
Top=100
Width=340
Height=500
Label=Shipper Name:,10,20
Edit=ShpName,100,20,120,
Label=Booking Number:,10,45
Edit=BkNum,100,45,120,
Label=Bill of Lading #:,10,70
Edit=BoLNum,100,70,120,
Label=Reference:,10,95
Edit=RefNum,100,95,120,
Label=Carrier Code:,10,120
Edit=SLCode,100,120,120,
Label=Departure Date:,10,145
Edit=DDate,100,145,120,
Label=Loading Port:,10,170
Edit=LPort,100,170,120,
Label=Port of Discharge:,10,195
Edit=DPort,100,195,120,
Label=Vessel Name:,10,220
Edit=VName,100,220,120,
Label=Container #:,10,245
Edit=ContNum,100,245,120,
//Label= Num of Containers:,225,230
//Edit=NumOfCont,250,245,40,
Label=Seal Number:,10,270
Edit=SNum,100,270,120,
Label=Quantity:,10,295
Edit=CtnQty,100,295,120,
Label=Weight:,10,320
Edit=ContWgt,100,320,120,
Label=Service Contract:,10,345
Edit=SrvContract,100,345,120,
Label=Temp:,10,370
Edit=Temp,100,370,120,
Label=Vents:,10,395
Edit=Vents,100,395,120,
Label=Total Cartons:,10,420
Edit=Cartons,100,420,120,
Button=Done,10,445,75,20,2
Button=Update,216,445,75,20,1
Button=Use Last,116,445,75,20,3
EndDialog>BoLDialog
Show>BoLDialog
Include>c:\CP_Macros\JohnW\DialogAction.scp


DialogAction
--------------------------------------------------------
Step_Delay=200
Let>vWait=0.50
Let>SW=0.15
Let>UpdateFlag=1
Let>StorageFile=c:\cp_macros\johnw\BolSave.ini
Label>ActionLoop
GetDialogAction>BoLDialog,r

If>{(%BoLDialog.ShpName% = "DIVE") AND (%BoLDialog.SLCode% = "APLU")}
Let>SrvContNum= TA08/0134
EndIf

If>{(%BoLDialog.ShpName% = "DIVE") AND (%BoLDialog.SLCode% = "HJSC")}
Let>SrvContNum=ANE25230
EndIf

If>{(%BoLDialog.ShpName% = "DIVE") AND (%BoLDialog.SLCode% = "MAEU")}
Let>SrvContNum=297908
EndIf

//------------------------------------------------------------------------------
If>{(%BoLDialog.ShpName% = "DLF") AND (%BoLDialog.SLCode% = "APLU")}
Let>SrvContNum=GB08/0285
EndIf

If>{(%BoLDialog.ShpName% = "DLF") AND (%BoLDialog.SLCode% = "HJSC")}
Let>SrvContNum=ANE25236
EndIf

If>{(%BoLDialog.ShpName% = "DLF") AND (%BoLDialog.SLCode% = "MAEU")}
Let>SrvContNum=297917
EndIf

//------------------------------------------------------------------------------
If>{(%BoLDialog.ShpName% = "DNE") AND (%BoLDialog.SLCode% = "APLU")}
Let>SrvContNum=TA8/0128
EndIf

If>{(%BoLDialog.ShpName% = "DNE") AND (%BoLDialog.SLCode% = "CMDU")}
Let>SrvContNum=08 1373
EndIf

If>{(%BoLDialog.ShpName% = "DNE") AND (%BoLDialog.SLCode% = "ELGV")}
Let>SrvContNum=SC35384
EndIf

If>{(%BoLDialog.ShpName% = "DNE") AND (%BoLDialog.SLCode% = "HJSC")}
Let>SrvContNum=ANE25189
EndIf

If>{(%BoLDialog.ShpName% = "DNE") AND (%BoLDialog.SLCode% = "HLCU")}
Let>SrvContNum=S8NSE033
EndIf

If>{(%BoLDialog.ShpName% = "DNE") AND (%BoLDialog.SLCode% = "MAEU")}
Let>SrvContNum=295657
EndIf

If>{(%BoLDialog.ShpName% = "DNE") AND (%BoLDialog.SLCode% = "OOLU")}
Let>SrvContNum=AE085703
EndIf

//------------------------------------------------------------------------------
If>{(%BoLDialog.ShpName% = "DUDA") AND (%BoLDialog.SLCode% = "APLU")}
Let>SrvContNum=TA08/0170
EndIf

//------------------------------------------------------------------------------
If>{(%BoLDialog.ShpName% = "GREENE") AND (%BoLDialog.SLCode% = "APLU")}
Let>SrvContNum=WB08/0279
EndIf

If>{(%BoLDialog.ShpName% = "GREENE") AND (%BoLDialog.SLCode% = "CMDU")}
Let>SrvContNum=09 0087
EndIf

If>{(%BoLDialog.ShpName% = "GREENE") AND (%BoLDialog.SLCode% = "HJSC")}
Let>SrvContNum=ANE25240
EndIf

If>{(%BoLDialog.ShpName% = "GREENE") AND (%BoLDialog.SLCode% = "HLCU")}
Let>SrvContNum=S8NSE035
EndIf

If>{(%BoLDialog.ShpName% = "GREENE") AND (%BoLDialog.SLCode% = "MAEU")}
Let>SrvContNum=299454
EndIf

//------------------------------------------------------------------------------
If>{(%BoLDialog.ShpName% = "HELLER") AND (%BoLDialog.SLCode% = "MAEU")}
Let>SrvContNum=300297
EndIf

//------------------------------------------------------------------------------LEROY SMITH
If>{(%BoLDialog.ShpName% = "LEROY") AND (%BoLDialog.SLCode% = "HJSC")}
Let>SrvContNum=ANE25237
EndIf

If>{(%BoLDialog.ShpName% = "LEROY") AND (%BoLDialog.SLCode% = "HLCU")}
Let>SrvContNum=S8NSE042
EndIf

If>{(%BoLDialog.ShpName% = "LEROY") AND (%BoLDialog.SLCode% = "MAEU")}
Let>SrvContNum=298208
EndIf

//------------------------------------------------------------------------------
If>{(%BoLDialog.ShpName% = "PACKERS") AND (%BoLDialog.SLCode% = "APLU")}
Let>SrvContNum=TA08/0136
EndIf

If>{(%BoLDialog.ShpName% = "PACKERS") AND (%BoLDialog.SLCode% = "HJSC")}
Let>SrvContNum=ANE25235
EndIf

If>{(%BoLDialog.ShpName% = "PACKERS") AND (%BoLDialog.SLCode% = "MAEU")}
Let>SrvContNum=297926
EndIf

If>{(%BoLDialog.ShpName% = "PACKERS") AND (%BoLDialog.SLCode% = "OOLU")}
Let>SrvContNum=AE085074
EndIf

//------------------------------------------------------------------------------
If>{(%BoLDialog.ShpName% = "PIONEER") AND (%BoLDialog.SLCode% = "APLU")}
Let>SrvContNum=TA08/0166
EndIf

//------------------------------------------------------------------------------
If>{(%BoLDialog.ShpName% = "PREMIER") AND (%BoLDialog.SLCode% = "APLU")}
Let>SrvContNum=WB08/0273
EndIf

If>{(%BoLDialog.ShpName% = "PREMIER") AND (%BoLDialog.SLCode% = "CMDU")}
Let>SrvContNum=08 1478
EndIf

If>{(%BoLDialog.ShpName% = "PREMIER") AND (%BoLDialog.SLCode% = "HJSC")}
Let>SrvContNum=ANE25233
EndIf

If>{(%BoLDialog.ShpName% = "PREMIER") AND (%BoLDialog.SLCode% = "HLCU")}
Let>SrvContNum=S8NSE036
EndIf

If>{(%BoLDialog.ShpName% = "PREMIER") AND (%BoLDialog.SLCode% = "MAEU")}
Let>SrvContNum=299578
EndIf

//------------------------------------------------------------------------------
If>{(%BoLDialog.ShpName% = "RIVER") AND (%BoLDialog.SLCode% = "APLU")}
Let>SrvContNum=WB08/0274
EndIf

//------------------------------------------------------------------------------
If>{(%BoLDialog.ShpName% = "SCOTT") AND (%BoLDialog.SLCode% = "APLU")}
Let>SrvContNum=GB08/0276
EndIf

If>{(%BoLDialog.ShpName% = "SCOTT") AND (%BoLDialog.SLCode% = "HJSC")}
Let>SrvContNum=ANE25239
EndIf

If>{(%BoLDialog.ShpName% = "SCOTT") AND (%BoLDialog.SLCode% = "HLCU")}
Let>SrvContNum=S8NES045
EndIf

If>{(%BoLDialog.ShpName% = "SCOTT") AND (%BoLDialog.SLCode% = "MAEU")}
Let>SrvContNum=297928
EndIf

//------------------------------------------------------------------------------
If>{(%BoLDialog.ShpName% = "SEALD") AND (%BoLDialog.SLCode% = "APLU")}
Let>SrvContNum=GB08/0280
EndIf

If>{(%BoLDialog.ShpName% = "SEALD") AND (%BoLDialog.SLCode% = "HJSC")}
Let>SrvContNum=ANE25264
EndIf

If>{(%BoLDialog.ShpName% = "SEALD") AND (%BoLDialog.SLCode% = "HLCU")}
Let>SrvContNum=S8NSE046
EndIf

If>{(%BoLDialog.ShpName% = "SEALD") AND (%BoLDialog.SLCode% = "MAEU")}
Let>SrvContNum=299579
EndIf
//------------------------------------------------------------------------------
If>{(%BoLDialog.ShpName% = "SUNNY") AND (%BoLDialog.SLCode% = "APLU")}
Let>SrvContNum=TA08/0156
EndIf

//------------------------------------------------------------------------------
Length>BoLDialog.DDate,vLen
If>{(%vlen%=6)and(%UpdateFlag%=1)},Update
If>r=1,Update
If>r=2,Exit
If>r=6,Close
If>r=3
GoSub>UseLast
EndIf
GoTo>ActionLoop


//------------------------------------------------------------------------------
SRT>Update
Let>UpdateFlag=0
Let>BoLDialog.SrvContract=%SrvContNum%
ResetDialogAction>BoLDialog
END>Update

//------------------------------------------------------------------------------
Label>Exit

//On exit, save the new values of the edit boxes to the ini file
EditIniFile>StorageFile,Last,Box1,BolDialog.ShpName
EditIniFile>StorageFile,Last,Box2,BolDialog.BkNum
EditIniFile>StorageFile,Last,Box3,BolDialog.BoLNum
EditIniFile>StorageFile,Last,Box4,BolDialog.RefNum
EditIniFile>StorageFile,Last,Box5,BolDialog.SLCode
EditIniFile>StorageFile,Last,Box6,BolDialog.DDate
EditIniFile>StorageFile,Last,Box7,BolDialog.LPort
EditIniFile>StorageFile,Last,Box8,BolDialog.DPort
EditIniFile>StorageFile,Last,Box9,BolDialog.VName
EditIniFile>StorageFile,Last,Box10,BolDialog.ContNum
EditIniFile>StorageFile,Last,Box11,BolDialog.SNum
EditIniFile>StorageFile,Last,Box12,BolDialog.CtnQty
EditIniFile>StorageFile,Last,Box13,BolDialog.ContWgt
EditIniFile>StorageFile,Last,Box14,BolDialog.SrvContract
EditIniFile>StorageFile,Last,Box15,BolDialog.Temp
EditIniFile>StorageFile,Last,Box16,BolDialog.Vents
EditIniFile>StorageFile,Last,Box17,BolDialog.Cartons
Exit>0


SRT>UseLast
//If the ini file exists read the previously saved values
//Else create the ini file with empty values
IfFileExists>StorageFile
ReadIniFile>StorageFile,Last,Box1,BolDialog.ShpName
ReadIniFile>StorageFile,Last,Box2,BolDialog.BkNum
ReadIniFile>StorageFile,Last,Box3,BolDialog.BoLNum
ReadIniFile>StorageFile,Last,Box4,BolDialog.RefNum
ReadIniFile>StorageFile,Last,Box5,BolDialog.SLCode
ReadIniFile>StorageFile,Last,Box6,BolDialog.DDate
ReadIniFile>StorageFile,Last,Box7,BolDialog.LPort
ReadIniFile>StorageFile,Last,Box8,BolDialog.DPort
ReadIniFile>StorageFile,Last,Box9,BolDialog.VName
ReadIniFile>StorageFile,Last,Box10,BolDialog.ContNum
ReadIniFile>StorageFile,Last,Box11,BolDialog.SNum
ReadIniFile>StorageFile,Last,Box12,BolDialog.CtnQty
ReadIniFile>StorageFile,Last,Box13,BolDialog.ContWgt
ReadIniFile>StorageFile,Last,Box14,BolDialog.SrvContract
ReadIniFile>StorageFile,Last,Box15,BolDialog.Temp
ReadIniFile>StorageFile,Last,Box16,BolDialog.Vents
ReadIniFile>StorageFile,Last,Box17,BolDialog.Cartons
Else
WriteLn>StorageFile,wres,[Last]
WriteLn>StorageFile,wres,Box1=
WriteLn>StorageFile,wres,Box2=
WriteLn>StorageFile,wres,Box3=
WriteLn>StorageFile,wres,Box4=
WriteLn>StorageFile,wres,Box5=
WriteLn>StorageFile,wres,Box6=
WriteLn>StorageFile,wres,Box7=
WriteLn>StorageFile,wres,Box8=
WriteLn>StorageFile,wres,Box9=
WriteLn>StorageFile,wres,Box10=
WriteLn>StorageFile,wres,Box11=
WriteLn>StorageFile,wres,Box12=
WriteLn>StorageFile,wres,Box13=
WriteLn>StorageFile,wres,Box14=
WriteLn>StorageFile,wres,Box15=
WriteLn>StorageFile,wres,Box16=
WriteLn>StorageFile,wres,Box17=
EndIf

//Reset Dialog1 to reflect the predefined edit box variables
ResetDialogAction>BolDialog
END>UseLast

//------------------------------------------------------------------------------
SRT>Close
CloseDialog>BoLDialog
Let>r=2
END>Close

gchichester
Pro Scripter
Posts: 132
Joined: Mon Dec 22, 2008 4:56 pm
Location: St Augustine FL

Re-Using Dialog Variable

Post by gchichester » Tue Jun 02, 2009 6:23 pm

JRL,
Thanks - Script working as designed

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