Using 2 Non-Modal Dialogs

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

Using 2 Non-Modal Dialogs

Post by kpassaur » Sat Feb 17, 2007 8:55 pm

I have a script that I cannot seem to get right and it should be easy. I want to use 2 Non-Modal boxes. It is a caculator script and the results display in the second Non-Modal Dialog box. The thought is the user can redo it as many times as they want and when they get it right I will put a button on the menu to print it.

As it stands right now, after many tries the script is a little messy, but it appears to work if I display the results in a message box. So, I think the error has to be in the second Non-Modal Box. Also, the error message I was getting said it was with the round function; however that appears to be because it is not getting a value from the first Non-Modal box. Any ideas?

Code: Select all

Dialog>Dialog1
   Caption=PDF Filer ROI Caculator
   Width=326
   Height=428
   Top=CENTER
   Left=CENTER
   Max=0
   Min=0
   Close=1
   Resize=0
   Image=C:\Documents and Settings\Keith Passaur\Desktop\plaincaculatormenu2.bmp,0,0,321,401
   Edit=minutes,72,80,30,
   Edit=volume,72,124,30,
   Edit=profit,72,196,30,
   Edit=employees,72,160,30,
   Label=Time in minutes an employee wastes per,113,76,true
   Label=Average number of Loans closed,113,122,true
   Label=Average Gross Profit per Loan,113,200,true
   Button=Caculate,99,264,75,25,1
   Button=Exit,173,264,75,25,2
   Label=Number of Loan Officers,113,166,true
   Label=Copyright© eDocFile Inc. 2004-2007,66,376,true
   Label= day searching for Documents.,113,88,true
   Label=per month by Loan Officer,113,136,true
EndDialog>Dialog1

Dialog>Dialog2
   Caption=PDF Filer ROI Caculator
   Width=326
   Height=428
   Top=CENTER
   Left=CENTER
   Max=0
   Min=0
   Close=1
   Resize=0
   Image=C:\Documents and Settings\Keith Passaur\Desktop\plaincaculatormenu2.bmp,0,0,321,401
   Button=Repeat,99,264,75,25,1
   Button=Exit,173,264,75,25,2
   Label=Copyright© eDocFile Inc. 2004-2007,66,376,true
   Memo=msMemo1,80,56,185,201,%ResultCaculated%
EndDialog>Dialog2

Label>Showthemenu

Show>Dialog1
Label>Dialog1loop
GetDialogAction>Dialog1,r
If>r=1,Caculate
If>r=2,EOF
Goto>Dialog1loop

Label>Caculate

CloseDialog>Dialog1
Let>minutes=%Dialog1.minutes%
Let>profit=%Dialog1.profit%
Let>volume=%Dialog1.volume%


Let>profitpermonth=%profit%*%volume%
Let>profitperweek=%profitpermonth%/4.16
Let>profitperday=%profitperweek%/5
Let>profitperminute=%profitperday%/480
Let>expense=%profitperminute%*%minutes%
Let>paybackdays=249.95/%expense%
Let>paybackmonths=%paybackdays%/20
Let>savingsperyear=250*%expense%
Let>grosssavingsperyear=%savingsperyear%*%Dialog1.employees%
Let>firstyearsavings=%grosssavingsperyear%-249.95


Position>.,%expense%,1,decimal
Add>decimal,2
MidStr>%expense%,1,decimal,expense

Let>paybackdays={round(%paybackdays%)}

Position>.,%grosssavingsperyear%,1,decimal2
Add>decimal2,2
MidStr>%grosssavingsperyear%,1,decimal2,grosssavingsperyear

Position>.,%firstyearsavings%,1,decimal3
Add>decimal3,2
MidStr>%firstyearsavings%,1,decimal3,firstyearsavings


Let>ResultCaculated=It is currently costing you %expense% per day per employee for employees to search for records.%CRLF%%CRLF%PDF Filer will pay for itself in %paybackdays% days. %CRLF%%CRLF%With %Dialog1.employees% employees: You will save  %firstyearsavings% your first year and %grosssavingsperyear% each year thereafter.
MDL>%ResultCaculated%
/*
Let>%Dialog1.employees%=
Let>%Dialog1.minutes%=
Let>%Dialog1.profit%=
Let>%Dialog1.volume%=
ResetDialogAction>Dialog1



Show>Dialog2,result
Label>Dialog2loop
If>result=1,Repeat
If>result=2,EOF
Wait>.25
Goto>Dialog2loop


Label>Repeat
CloseDialog>Dialog2
Let>%Dialog2.msMemo1%=
ResetDialogAction>Dialog2

*/



Goto>Showthemenu


Label>EOF


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

Post by JRL » Sun Feb 18, 2007 1:04 am

Hi Keith,
First, note that as posted, dialog2 is modal.

Second, try removing the percents from the lines:

Let>%Dialog1.employees%=
Let>%Dialog1.minutes%=
Let>%Dialog1.profit%=
Let>%Dialog1.volume%=


You are inadvertantly setting the value assigned to these variables to "nul".

For example if Dialog1.volume = 1 and you say:

Let>%Dialog1.volume%=

You have just set the number 1 to nul

Maybe there's more to your issue but it would be hard to recalculate using "nul" as a number.

Hope this helps,
Dick

By the way... I like the last label being EOF. Clever.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Sun Feb 18, 2007 10:14 am

>Second, try removing the percents from the lines:
>Let>%Dialog1.employees%=

Yes, you almost NEVER want to use % in the part of an expression being assigned to, or, as Dick says, you will be assigning a value to the VALUE of the variable, not the NAME of the variable. About the only time you might want to be doing that is with arrays.

When assigning values to variables, specify only the variable name.

As a rule of thumb only use % when you are REFERRING to a variable and want it's VALUE. When assigning a value to a variable use its NAME.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

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

Using 2 Non Modal Boxes

Post by kpassaur » Sun Feb 18, 2007 10:52 am

Thanks for your help, I got it. I removed the % signs and then I had to add a counter. The way it works is display the second Dialog, if the second dialog has already been diaplayed update it. I'm not sure it is the right way to do it but it works.

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