Dialog Help, please

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
nowind
Newbie
Posts: 10
Joined: Thu Jul 10, 2008 11:51 am

Dialog Help, please

Post by nowind » Sat Feb 27, 2010 3:10 pm

Have some problems with dialog. I created a dialog to install some programs.
I want checkboxes to change when I choose radiobuttons and/or make choices from another checkbox. Searched and found some on the forum, but I can not get it to work properly. I'm sure this has been solved before, maybe it's my search criteria which is why I cannot find it. Hopefully someone here can help...

Examples: When I choose New Inst, the checkboxes Copying and Registry should be checked (this is the default). When I choose Old Inst, they should be unchecked - this works. If I then choose New Inst again, the do not get checked.
Also if I uncheck the COM Disable, the COM1,2,3 should also be unchecked. I also would like to know if it's possible to disable checkboxes.

This porogram is to be used on both XP and Windows 7...

Code: Select all


/* Find Windows Version ******************************************************************************* */
RegistryReadKey>HKEY_LOCAL_MACHINE,SOFTWARE\Microsoft\Windows NT\CurrentVersion,ProductName,WinName
/* **************************************************************************************************** */

If>%WinName%=Microsoft Windows XP
  Let>mC_COMDis=True
   Let>mC_COMDis1=True
   Let>mC_COMDis2=False
   Let>mC_COMDis3=False
 Else
  Let>mC_COMDis=False
   Let>mC_COMDis1=False
   Let>mC_COMDis2=False
   Let>mC_COMDis3=False
Endif


Dialog>tst_Install
   Caption=TEST Install
   Width=461
   Height=418
   Top=157
   Left=CENTER
   RadioGroup=tst_Radio1,Type,16,24,137,83,New Inst%CRLF%Old Inst,0
   Label=Copying:,168,24,true
   CheckBox=mC_test1,Backgrounds,176,48,139,True
   CheckBox=mC_test2,Registry,176,80,139,True
   Label=Install:,16,128,true
   CheckBox=mC_Prog3,Program 1,24,152,97,True
   CheckBox=mC_Prog2,Program 2,176,152,97,True
   CheckBox=mC_Prog1,Program 3,328,152,97,True
   CheckBox=tst_COMDisable,COM Disable,24,192,97,%mC_COMDis%
   CheckBox=tst_COM1,COM 1,176,192,57,%mC_COMDis1%
   CheckBox=tst_COM2,COM 2,256,192,57,%mC_COMDis2%
   CheckBox=tst_COM3,COM 3,328,192,57,%mC_COMDis3%
   CheckBox=tst_Prog4,Program 4,24,248,129,False
   CheckBox=tst_Prog5,Program 5,176,248,97,False
   CheckBox=tst_Prog6,Program 6,328,248,97,False
   Button=OK,126,314,75,25,1
   Button=CANCEL,241,314,75,25,2
EndDialog>tst_Install

OnEvent>DIALOG_CHANGE,tst_Install,mC_Radio1,mC_test1

SRT>tst_TEST
    GetDialogAction>mC_Install,r

    If>%tst_Install.tst_TypeInst%=0
        Let>tst_Install.tst_test1=True
        Let>tst_Install.tst_test2=True
        ResetDialogAction>tst_Install
       Else
        Let>tst_Install.tst_OEMInfo=False
        Let>tst_Install.tst_Branding=False
        ResetDialogAction>tst_Install
    EndIf
END>tst_TEST


Show>tst_Install

GetDialogAction>tst_Install,r

ResetDialogAction>tst_Install

Label>tst_Install_ActionLoop
    GetDialogAction>tst_Install,r

    If>r=1
        MDL>Go to the next screen
        GoTo>tst_Install_ActionLoop_Exit
    EndIf
    If>{(%r%=2) OR (%r%=3)}
        Goto>Final_Exit
    EndIf
    Wait>0.3
Goto>tst_Install_ActionLoop

Label>tst_Install_ActionLoop_Exit
CloseDialog>tst_Install_ActionLoop
Label>Final_Exit


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

Post by Marcus Tettmar » Mon Mar 01, 2010 10:34 am

Hi,

Your OnEvent had the a non-existant object name in it and a non-existent subroutine name. This works:

Code: Select all

/* Find Windows Version ******************************************************************************* */
RegistryReadKey>HKEY_LOCAL_MACHINE,SOFTWARE\Microsoft\Windows NT\CurrentVersion,ProductName,WinName
/* **************************************************************************************************** */

If>%WinName%=Microsoft Windows XP
  Let>mC_COMDis=True
   Let>mC_COMDis1=True
   Let>mC_COMDis2=False
   Let>mC_COMDis3=False
 Else
  Let>mC_COMDis=False
   Let>mC_COMDis1=False
   Let>mC_COMDis2=False
   Let>mC_COMDis3=False
Endif


Dialog>tst_Install
   Caption=TEST Install
   Width=461
   Height=418
   Top=157
   Left=CENTER
   RadioGroup=tst_Radio1,Type,16,24,137,83,New Inst%CRLF%Old Inst,0
   Label=Copying:,168,24,true
   CheckBox=mC_test1,Backgrounds,176,48,139,True
   CheckBox=mC_test2,Registry,176,80,139,True
   Label=Install:,16,128,true
   CheckBox=mC_Prog3,Program 1,24,152,97,True
   CheckBox=mC_Prog2,Program 2,176,152,97,True
   CheckBox=mC_Prog1,Program 3,328,152,97,True
   CheckBox=tst_COMDisable,COM Disable,24,192,97,%mC_COMDis%
   CheckBox=tst_COM1,COM 1,176,192,57,%mC_COMDis1%
   CheckBox=tst_COM2,COM 2,256,192,57,%mC_COMDis2%
   CheckBox=tst_COM3,COM 3,328,192,57,%mC_COMDis3%
   CheckBox=tst_Prog4,Program 4,24,248,129,False
   CheckBox=tst_Prog5,Program 5,176,248,97,False
   CheckBox=tst_Prog6,Program 6,328,248,97,False
   Button=OK,126,314,75,25,1
   Button=CANCEL,241,314,75,25,2
EndDialog>tst_Install

OnEvent>DIALOG_CHANGE,tst_Install,tst_Radio1,SetCheckBoxes

Show>tst_Install

GetDialogAction>tst_Install,r

ResetDialogAction>tst_Install

Label>tst_Install_ActionLoop
    GetDialogAction>tst_Install,r

    If>r=1
        MDL>Go to the next screen
        GoTo>tst_Install_ActionLoop_Exit
    EndIf
    If>{(%r%=2) OR (%r%=3)}
        Goto>Final_Exit
    EndIf
    Wait>0.3
Goto>tst_Install_ActionLoop

Label>tst_Install_ActionLoop_Exit
CloseDialog>tst_Install_ActionLoop
Label>Final_Exit

SRT>SetCheckBoxes
  GetDialogAction>tst_Install,r
  If>tst_Install.tst_radio1.itemindex=1
    Let>tst_Install.mc_test1=False
    Let>tst_Install.mc_test2=False
  Endif
  If>tst_Install.tst_radio1.itemindex=0
    Let>tst_Install.mc_test1=True
    Let>tst_Install.mc_test2=True
  Endif
  ResetDialogAction>tst_Install
END>SetCheckBoxes
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

nowind
Newbie
Posts: 10
Joined: Thu Jul 10, 2008 11:51 am

Post by nowind » Mon Mar 01, 2010 9:41 pm

Yeah, so I see now....

Thank You!! :)

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