Jump to content

need help writing a script


brea
 Share

Recommended Posts

Hello,

I'm quite new to the scripting world and need some help.

I need to write a script that ask a series of questions and then passes those variables to various sections of the script to tell it to use one line of code or the other. The pourpose of this is to automate the installation of a group of applications.

For example. let say when installing notepad it asked if I wanted ASCI or some other type installed.

I want the first portion of the script to ask that question and then pass the answer to this section of the install and run the apropriate lines related to the answer.

I don't mind reading if you want to point me to some good resources. I'm just not getting far on my own.

Link to comment
Share on other sites

$response = InputBox( "Install Notepad", "type 1 for ASCII or 2 for Other." )
If $response = 1 Then
   InstallAscii( )
ElseIf $response = 2 Then
   InstallOther( )
Else
   MsgBox(0,"error","error, wrong info" )
EndIf

Func InstallAscii( )
  ;Ascii install lines here
EndFunc

Func InstallOther( )
  ;other install lines here
EndFunc

[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

Link to comment
Share on other sites

ok that looks like it's what I'm looking for but I think I need a bit more logic into it.

I have at least 10 applications that I am going to be installing and several of them are going to have options associated with them.

It looks like this script takes the input given and jumps directly to that section. I'm going to need the box to allow multiple choices.

I.E.

notepad: ASCII or other

Open Office: associate Microsoft word, excel and ppt or no?

Other: choice 1 or 2

Then taking all those it passes the options and when the script gets to the install for the selected app uses that choice? Or can I just create multiple instances of what was posted above asking the question individually for each app?

Sorry to be a pain if I am.

Link to comment
Share on other sites

I just tried it myslef and you can just recreate it.

However one caveat. I need all the questions to be answered at the begining of the install and then the options to be passed throughout. This script works like so.

install question 1

run associated options

install question 2

run associated options

I need it to work more along the lines of

? 1

? 2

? 3 (or all in one question box)

run each installation seperately while pulling install options when required

complete

Thus the installer has minimal need to be in front of the machine during the install process.

Again thanks for the help.

Link to comment
Share on other sites

Here is a rough idea

#include <GUIConstants.au3>
; == GUI generated with Koda ==);
$Form1 = GUICreate("AForm1", 622, 448, 192, 125)
$Checkbox1 = GUICtrlCreateCheckbox("ACheckbox1", 32, 32, 17, 17)
$Checkbox2 = GUICtrlCreateCheckbox("ACheckbox2", 32, 64, 17, 17)
$Checkbox3 = GUICtrlCreateCheckbox("ACheckbox3", 32, 96, 17, 17)
GUICtrlCreateLabel("Program 1", 8, 8, 86, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUICtrlCreateLabel("Question 1", 48, 32, 55, 17)
GUICtrlCreateLabel("Question 2", 48, 64, 55, 17)
GUICtrlCreateLabel("Question 3", 48, 96, 55, 17)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    ;;;;;;;
    EndSelect
WEnd

It may give you some ideas.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

That definetly gives me some ideas. I've been looking at the sample GUI's provided and it would be great to use them.

It said there that that GUI was created by Koda. Is this something that I can use or not?

It is certainly something that you can use. You will find a link Here in Lookfar's signature.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

  • Moderators

That definetly gives me some ideas. I've been looking at the sample GUI's provided and it would be great to use them.

It said there that that GUI was created by Koda. Is this something that I can use or not?

If you look at BigDods signature he has to links at the very bottom that are fairly important now a days. SciTe editor has 2 GUI builders them... one is called Koda (newest one) and the other GUIBuilder. It helps those that wish to make an interface truck along quite nicely.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Ok,

So these tools are great. I think I'll be able to create a GUI to get what I want. I have no idea how to attach those options to the variables that are then passed into the script.

I'm sure it's here in this editor. I just don't know it yet.

Link to comment
Share on other sites

  • Moderators

Ok,

So these tools are great. I think I'll be able to create a GUI to get what I want. I have no idea how to attach those options to the variables that are then passed into the script.

I'm sure it's here in this editor. I just don't know it yet.

Try studying the help file, and try out Vaulaters AutoIt 123, and if you have more questions on specifics... give that a post, and I'm sure someone will be willing to help you out.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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...