Sign in to follow this  
Followers 0
Necromorph

Help with gui script

7 posts in this topic

#1 ·  Posted (edited)

im sorry if this is a topic already, but im looking for some help

i have a script that im working on to automate an install of an erp system my company makes, i making this to simplify my testing tasks of having to reinstall all the time, anyway, i made a gui that needs three pecies of information to do all the work but i can't translate it all to make it work. and its probably easy but i have only been scripting for about two weeks. so please, be compassionate. thanks

here is a test script:

#INCLUDE <GUIConstantsEx.au3>

#INCLUDE <ButtonConstants.au3>

GUICREATE("PalMate ERP Auto Installer Wizard", 300, 300)

GUICTRLCREATELABEL("Comapany Name", 25, 25)

$installname=GUICTRLCREATEINPUT("Demo", 25, 40, 250)

GUICTRLCREATELABEL("Port Number", 25, 75)

$installport=GUICTRLCREATEINPUT("3127", 25, 90, 250)

$opt=GUICTRLCREATEGROUP("Database Options", 20, 125, 250, 100)

$installopt_1=GUICTRLCREATERADIO("No Change", 25, 140)

$installopt_2=GUICTRLCREATERADIO("Update Existing Database", 25, 160)

$installopt_3=GUICTRLCREATERADIO("Initialize Database", 25, 180)

$installopt_4=GUICTRLCREATERADIO("Demonstration Database", 25, 200)

$start=GUICTRLCREATEBUTTON("Next >", 125, 250, 75)

$install_cancel=GUICTRLCREATEBUTTON("Cancel", 200, 250, 75)

GUISETSTATE()

GUICTRLSETSTATE($installopt_4, $GUI_CHECKED)

GUICTRLSETSTATE($start, $GUI_DEFBUTTON)

WHILE 1

$msg=GUIGETMSG()

IF $msg=$install_cancel THEN

EXIT

ELSEIF $msg=$GUI_EVENT_CLOSE THEN

EXIT

ELSEIF $msg=$start THEN

EXITLOOP

ENDIF

WEND

GUISETSTATE(@SW_HIDE)

WHILE 2

$msg=GUIGETMSG()

IF $msg=(GUICtrlRead($installopt_1),$GUI_CHECKED)THEN

MSGBOX(0, "TEST", "OPT1")

ELSEIF $msg=BITOR(GUICtrlRead($installopt_2),$GUI_CHECKED)THEN

MSGBOX(0, "TEST", "OPT2")

ELSEIF $msg=BITOR(GUICtrlRead($installopt_3),$GUI_CHECKED)THEN

MSGBOX(0, "TEST", "OPT3")

ELSEIF $msg=BITOR(GUICtrlRead($installopt_4),$GUI_CHECKED)THEN

MSGBOX(0, "TEST", "OPT4")

ENDIF

WEND

the problem is at the end, it always "MSGBOX" the firs IF statement, even if i have picked another RADIO BUTTON. Please help.

Thanx

redLabel

MCP,MCDST

Edited by redLabel

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Change the Ifs in the second while similar to this: If BitAND(GUICtrlRead($installopt_1), $GUI_CHECKED) = $GUI_CHECKED Then, without the $msg=see if that helps.

Also, If GUICtrlRead($installopt_1) = $GUI_CHECKED Then might work, but I've read somewhere here that the BitAND method is better.

Edited by snowmaker

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

Thank you so much, its working now!, had to do some other "fine tunning" to make it work with my actuall script. Thanks again!

Share this post


Link to post
Share on other sites

You bet. Also, use the 'autoit' button (the blue button underneath the B button) when you post your code, it makes it alot easier to read.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

#INCLUDE <GUIConstantsEx.au3>
#INCLUDE <ButtonConstants.au3>

GUICREATE("PalMate ERP Auto Installer", 300, 325)
    GUICTRLCREATELABEL("Comapany Name", 25, 25)
    $installname=GUICTRLCREATEINPUT("Demo", 25, 40, 250)
    GUICTRLCREATELABEL("Port Number", 25, 75)
    $installport=GUICTRLCREATEINPUT("3127", 25, 90, 250)
    GUICTRLCREATEGROUP("Database Options", 20, 125, 250, 100)
    $installopt_1=GUICTRLCREATERADIO("No Change", 25, 140)
    $installopt_2=GUICTRLCREATERADIO("Update Existing Database", 25, 160)
    $installopt_3=GUICTRLCREATERADIO("Initialize Database", 25, 180)
    $installopt_4=GUICTRLCREATERADIO("Demonstration Database", 25, 200)
    $dbbackupopt=GUICTRLCREATECHECKBOX("Backup Database (Only If Updating Installation)", 25, 240)
    $start=GUICTRLCREATEBUTTON("Next >", 125, 275, 75)
    $install_cancel=GUICTRLCREATEBUTTON("Cancel", 200, 275, 75)
    GUISETSTATE()
    GUICTRLSETSTATE($installopt_4, $GUI_CHECKED)
    GUICTRLSETSTATE($start, $GUI_DEFBUTTON)
WHILE 1
    $msg=GUIGETMSG()
        IF $msg=$install_cancel THEN
            EXIT
        ELSEIF $msg=$GUI_EVENT_CLOSE THEN
            EXIT
        ELSEIF $msg=$start THEN
            EXITLOOP
        ENDIF   
WEND

WHILE 1
    IF BITAND(GUICtrlRead($installopt_1),$GUI_CHECKED)=$GUI_CHECKED THEN
        CONTROLCLICK("PalMate Setup", "", "[CLASS:SysTreeView32; INSTANCE:1]", "PRIMARY", 1, 49, 39)
        SEND("{SPACE}")
        EXITLOOP
    ELSEIF BITAND(GUICtrlRead($installopt_2),$GUI_CHECKED)=$GUI_CHECKED THEN
        CONTROLCLICK("PalMate Setup", "", "[CLASS:SysTreeView32; INSTANCE:1]", "PRIMARY", 1, 49, 56)
        SEND("{SPACE}")
        EXITLOOP
    ELSEIF BITAND(GUICtrlRead($installopt_3),$GUI_CHECKED)=$GUI_CHECKED THEN
        CONTROLCLICK("PalMate Setup", "", "[CLASS:SysTreeView32; INSTANCE:1]", "PRIMARY", 1, 49, 73)
        SEND("{SPACE}")
        EXITLOOP
    ELSEIF BITAND(GUICtrlRead($installopt_4),$GUI_CHECKED)=$GUI_CHECKED THEN
        CONTROLCLICK("PalMate Setup", "", "[CLASS:SysTreeView32; INSTANCE:1]", "PRIMARY", 1, 49, 88)        
        SEND("{SPACE}")
        EXITLOOP
    ENDIF
WEND

its works perfect now

there are a few other things i do inbetween, but this is the part i was haveing the most trouble wiht, so thanks again!!!

Share this post


Link to post
Share on other sites

You bet man, glad I could be of help. See what I mean about the autoit tag?


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

FILECHANGEDIR(@DESKTOPDIR)
    FILECOPY("\\server7\Release\PalMate\PalMateServer-*.exe", "*.exe", 1)
    WINKILL("PalMate", "")
     $installerver=FILEREAD(*.exe)

CONTROLSETTEXT("Choose the PalMate Server installation package", "", "[CLASS:Edit; INSTANCE:1]", $installerver)

i want it to copy file "testfile-[current version #].exe

and call that "testfile-*.exe

but assign that a $var

so when i call it later it use what ever the current version number is in the installer.

Edited by redLabel

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0