Jump to content

Multiple Files Locations Locations


grtech
 Share

Recommended Posts

Hi this is my first post and to me it is a bit of a good one.

I am a noob with autoit and have been testing it out and i am realy enjoying using it but i have become stumped with what to do with the following.

basic just of the idea im trying to do.

I want the gui to open with a list of locations you click on the location and then ok and it starts the installation from the location which is picked.

then after the install of the first installation has complete i am wanting it to use the same location info to open a file in another folder and then run through that intallation.

once that installation finished it opens the program and then runs through a config which at the end comes up with another gui for inputting serial numbers and keys.

please have a look and see if there is anyway of me getting this to work.

Thanks

Geoff

CODE
#include <GUIConstants.au3>

$L50PATH = "\SAGEL50V2009"

;MsgBox(4096,"DE-BUG","\\TEST-SERVER\Software" & $L50PATH & "\Setup.exe")

GUICreate("SAGELine50 v2009",200,375) ; will create a dialog box that when displayed is centered

GUICtrlCreateLabel("Please select your nearest office",3,8)

$n1=GUICtrlCreateList ("", 45,35,100,220 )

GUICtrlSetData(-1,"Basingstoke|Sunderland|Chiltern Street|Finsbury|Nottingham|Chorley|Grangemouth|Edinburgh|Inverness|Southampton|Windsor|Brighton|Aber

deen|Glasgow|Perth|Shepton|Preston|Bolton", "Aberdeen")

$n2=GUICtrlCreateButton ("Start Installation",50,290)

GUICtrlSetState(-1,$GUI_FOCUS) ; the focus is on this button

GUICtrlCreatePic("Ten_sm.jpg",0,320,200,54)

GUISetBkColor ( 0xE0DFE3 )

GUISetState (1) ; will display an empty dialog box

; Run the GUI until the dialog is closed

Do

$msg = GUIGetMsg()

if $msg = $n2 then

Select

case GUICtrlRead($n1) = "Basingstoke"

run("\\basiserver\Software" & $L50PATH & "\Install\Setup.exe")

case GUICtrlRead($n1) = "Shepton"

run("\\gbrserver\Software" & $l50PATH & "\INSTALL\Setup.exe")

case GUICtrlRead($n1) = "Sunderland"

run("\\sundserver\Software" & $L50PATH & "\INSTALL\Setup.exe")

case GUICtrlRead($n1) = "Chiltern Street"

run("\\chilserver\Software" & $L50PATH & "\Install\Setup.exe")

case GUICtrlRead($n1) = "Finsbury"

run("\\finsserver\Software" & $L50PATH & "\Install\Setup.exe")

case GUICtrlRead($n1) = "Nottingham"

run("\\nottserver\Software" & $L50PATH & "\Install\Setup.exe")

case GUICtrlRead($n1) = "Chorley"

run("\\chorserver\Software" & $L50PATH & "\Install\Setup.exe")

case GUICtrlRead($n1) = "Grangemouth"

run("\\granserver\Software" & $L50PATH & "\Install\Setup.exe")

case GUICtrlRead($n1) = "Edinburgh"

run("\\edinserver\Software" & $L50PATH & "\Install\Setup.exe")

case GUICtrlRead($n1) = "Inverness"

run("\\inveserver\Software" & $L50PATH & "\Install\Setup.exe")

case GUICtrlRead($n1) = "Southampton"

run("\\chanserver\Software" & $L50PATH & "\Install\Setup.exe")

case GUICtrlRead($n1) = "Windsor"

run("\\windserver\Software" & $L50PATH & "\Install\Setup.exe")

case GUICtrlRead($n1) = "Aberdeen"

run("\\aberserver\Software" & $L50PATH & "\Install\Setup.exe")

case GUICtrlRead($n1) = "Glasgow"

run("\\glasserver\Software" & $L50PATH & "\Install\Setup.exe")

case GUICtrlRead($n1) = "Perth"

run("\\pertserver\Software" & $L50PATH & "\Install\Setup.exe")

case GUICtrlRead($n1) = "Brighton"

run("\\brigserver\Software" & $L50PATH & "\Install\Setup.exe")

case GUICtrlRead($n1) = "Preston"

run("\\presserver\Software" & $L50PATH & "\Install\Setup.exe")

case GUICtrlRead($n1) = "Bolton"

run("\\boltserver\Software" & $L50PATH & "\Install\Setup.exe")

EndSelect

IF GUICtrlRead($N2) Then

WinWaitActive ("Accounts - InstallShield Wizard")

Sleep( 2000 )

Send("!y")

Sleep ( 5000 )

WinWaitActive ("Accounts - InstallShield Wizard", "Select the type of installation")

ControlClick("Accounts - InstallShield Wizard", "", 102)

Sleep( 2000 )

Send("!r")

Sleep( 2000 )

Send("C:\Program Files\Sage\Accountsv2009")

Send( "{ENTER}" )

Sleep( 2000 )

Send("!n")

Sleep( 2000 )

Send("Sage Accounts V2009")

Send("!n")

Sleep( 2000 )

Send("!n")

WinWaitActive("Accounts - InstallShield Wizard", "Finish")

Sleep( 1000 )

send("{space}")

WinWaitClose("Accounts - InstallShield Wizard")

Else

EndIf

;Update Installation point

;use same as above but instead of \install\setup.exe on the end needs to be \update\update.exe

WinWaitActive("Sage Software Update")

Send("!y")

Sleep(3000)

WinWaitActive("Sage Software Update")

Send("{Space}")

;Program Configuration point

Run("C:\Program Files\Sage\Accountsv2009\Sage.exe")

WinWaitActive("Select the type of data you want to use")

Send("{space}")

WinWaitActive("ActiveSetup Wizard")

Send("!n")

Sleep( 1000 )

Send("!n")

Sleep( 1000 )

Send("!n")

Sleep( 1000 )

Send("{down}")

Send("!n")

Sleep( 1000 )

Send("!n")

Sleep( 1000 )

Send ("!n")

Sleep(1000)

;Popup text box

GUICreate("Serial / Key", 260, 260)

GUISetFont(8.5, 800)

GUICtrlCreateLabel("Serial No.", 100, 13)

GUICtrlCreateLabel("Key", 100, 60)

GUISetFont(8.5, 400)

;Button

$input1 = GUICtrlCreateInput("", 10, 29, 240, 20)

$input2 = GUICtrlCreateInput("", 10, 76, 240, 20)

$ok = GUICtrlCreateButton("Ok", 100, 100, 100, 25)

GUISetState(@SW_SHOW)

While 1

$msg2 = GUIGetMsg()

Select

;------------ OK Button - Finished

Case $msg2 = $ok

WinActivate ("ActiveSetup Wizard", "Serial Number")

$sRead1 = GUICtrlRead($input1)

$sRead2 = GUICtrlRead($input2)

ControlSetText("[CLASS:#32770]", "&Next", "Edit14", $sRead1)

ControlSetText("[CLASS:#32770]", "&Next", "Edit15", $sRead2)

ExitLoop

EndSelect

WEnd

Sleep( 1000 )

Send("!n")

Sleep( 1000 )

Send("!F")

Endif

Until $msg = $GUI_EVENT_CLOSE

;Finished

Link to comment
Share on other sites

  • Moderators

grtech,

Welcome to the forums.

I have played about with your code and have come up with the following:

#include <GUIConstantsEx.au3>

$L50PATH = "\SAGEL50V2009"
;MsgBox(4096,"DE-BUG","\\TEST-SERVER\Software" & $L50PATH & "\Setup.exe")

GUICreate("SAGELine50 v2009",200,375); will create a dialog box that when displayed is centered
GUICtrlCreateLabel("Please select your nearest office",3,8)

$n1=GUICtrlCreateList ("", 45,35,100,220 )
GUICtrlSetData(-1,"Basingstoke|Sunderland|Chiltern Street|Finsbury|Nottingham|Chorley|Grangemouth|" & _
"Edinburgh|Inverness|Southampton|Windsor|Brighton|Aberdeen|Glasgow|Perth|Shepton|Preston|Bolton", "Aberdeen")

$n2=GUICtrlCreateButton ("Start Installation",50,290)
GUICtrlSetState(-1,$GUI_FOCUS); the focus is on this button

GUICtrlCreatePic("Ten_sm.jpg",0,320,200,54)

GUISetBkColor ( 0xE0DFE3 )
GUISetState()

; Get location
While 1
    
    $msg = GUIGetMsg()
        
    If $msg = $n2 Then 
        Select
            case GUICtrlRead($n1) = "Basingstoke"
                $Server = "\\basiserver\Software" & $L50PATH
            case GUICtrlRead($n1) = "Shepton"
                $Server = "\\gbrserver\Software" & $l50PATH
            case GUICtrlRead($n1) = "Sunderland"
                $Server = "\\sundserver\Software" & $L50PATH
            case GUICtrlRead($n1) = "Chiltern Street"
                $Server = "\\chilserver\Software" & $L50PATH
            case GUICtrlRead($n1) = "Finsbury"
                $Server = "\\finsserver\Software" & $L50PATH
            case GUICtrlRead($n1) = "Nottingham"
                $Server = "\\nottserver\Software" & $L50PATH
            case GUICtrlRead($n1) = "Chorley"
                $Server = "\\chorserver\Software" & $L50PATH
            case GUICtrlRead($n1) = "Grangemouth"
                $Server = "\\granserver\Software" & $L50PATH
            case GUICtrlRead($n1) = "Edinburgh"
                $Server = "\\edinserver\Software" & $L50PATH
            case GUICtrlRead($n1) = "Inverness"
                $Server = "\\inveserver\Software" & $L50PATH
            case GUICtrlRead($n1) = "Southampton"
                $Server = "\\chanserver\Software" & $L50PATH
            case GUICtrlRead($n1) = "Windsor"
                $Server = "\\windserver\Software" & $L50PATH
            case GUICtrlRead($n1) = "Aberdeen"
                $Server = "\\aberserver\Software" & $L50PATH
            case GUICtrlRead($n1) = "Glasgow"
                $Server = "\\glasserver\Software" & $L50PATH
            case GUICtrlRead($n1) = "Perth"
                $Server = "\\pertserver\Software" & $L50PATH
            case GUICtrlRead($n1) = "Brighton"
                $Server = "\\brigserver\Software" & $L50PATH
            case GUICtrlRead($n1) = "Preston"
                $Server = "\\presserver\Software" & $L50PATH
            case GUICtrlRead($n1) = "Bolton"
                $Server = "\\boltserver\Software" & $L50PATH
        EndSelect
        ExitLoop
    ElseIf $msg = $GUI_EVENT_CLOSE Then
        Exit
    EndIf
WEnd

;Run($Server & "\Install\Setup.exe")
ConsoleWrite($Server & "\Install\Setup.exe" & @CRLF)
#cs
WinWaitActive ("Accounts - InstallShield Wizard")
Sleep( 2000 )
Send("!y")
Sleep ( 5000 )
WinWaitActive ("Accounts - InstallShield Wizard", "Select the type of installation")
ControlClick("Accounts - InstallShield Wizard", "", 102)
Sleep( 2000 )
Send("!r")
Sleep( 2000 )
Send("C:\Program Files\Sage\Accountsv2009")
Send( "{ENTER}" )
Sleep( 2000 )
Send("!n")
Sleep( 2000 )
Send("Sage Accounts V2009")
Send("!n")
Sleep( 2000 )
Send("!n")
WinWaitActive("Accounts - InstallShield Wizard", "Finish")
Sleep( 1000 )
send("{space}")
WinWaitClose("Accounts - InstallShield Wizard")
#ce
;Update Installation point
;Run($Server & "\update\update.exe")
ConsoleWrite($Server & "\update\update.exe" & @CRLF)
#cs
WinWaitActive("Sage Software Update")
Send("!y")
Sleep(3000)
;WinWaitActive("Sage Software Update")
Send("{Space}")
#ce
;Run("C:\Program Files\Sage\Accountsv2009\Sage.exe")
ConsoleWrite("C:\Program Files\Sage\Accountsv2009\Sage.exe" & @CRLF)
#cs
WinWaitActive("Select the type of data you want to use")
Send("{space}")

;WinWaitActive("ActiveSetup Wizard")
Send("!n")

Sleep( 1000 )
Send("!n")

Sleep( 1000 )
Send("!n")

Sleep( 1000 )
Send("{down}")
Send("!n")

Sleep( 1000 )
Send("!n")

Sleep( 1000 )
Send ("!n")

Sleep(1000)
#ce
;Popup text box
GUICreate("Serial / Key", 260, 260)
GUISetFont(8.5, 800)

GUICtrlCreateLabel("Serial No.", 100, 13)

GUICtrlCreateLabel("Key", 100, 60)
GUISetFont(8.5, 400)

;Button
$input1 = GUICtrlCreateInput("", 10, 29, 240, 20)
$input2 = GUICtrlCreateInput("", 10, 76, 240, 20)

$ok = GUICtrlCreateButton("Ok", 100, 100, 100, 25)

GUISetState(@SW_SHOW)

While 1
    If GUIGetMsg() = $ok Then
        WinActivate ("ActiveSetup Wizard", "Serial Number") 
        $sRead1 = GUICtrlRead($input1)
        $sRead2 = GUICtrlRead($input2)
        ControlSetText("[CLASS:#32770]", "&Next", "Edit14", $sRead1)
        ControlSetText("[CLASS:#32770]", "&Next", "Edit15", $sRead2)
        ConsoleWrite($sRead1 & @CRLF)
        ConsoleWrite($sRead2 & @CRLF)
        ExitLoop
    EndIf
WEnd

Sleep( 1000 )
Send("!n")

Sleep( 1000 )
Send("!F")

Exit

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...