Jump to content

NOOB Script Help!


Recommended Posts

Forgive me, but I am a noob at this. I am in the process of creating a script, and could use some assistance. I want to create a menu system containg programs and the ability to install them. I have created the front end which shows the programs and a descripton via a tree menu.

The problem I am having is when I click on the program in the tree I want the ability to click on the install button and have the program install. I can't seem to figure out how to install based on what item is selected in my tree. Below is my code. Any help is appreciated. No laughing, this is my first script.

; Malware Spectre v.1

;

; 1/17/2007

#include <GUIConstants.au3>

; Gui code

#Region ### START Koda GUI section ### Form=C:\Program Files\AutoIt3\Examples\GUI\Advanced\MWv2.kxf

$MW = GUICreate("Malware Spectre v.1", 457, 574, 326, 125)

$Header = GUICtrlCreateLabel("Malware Spectre v.1", 100, 48, 252, 42, BitOR($SS_CENTER,$SS_CENTERIMAGE,$SS_SUNKEN))

GUICtrlSetFont(-1, 14, 800, 2, "Arial")

$pic = GUICtrlCreatePic("C:\Program Files\AutoIt3\Examples\GUI\Advanced\130.jpg", 120, 121, 220, 190, BitOR($SS_NOTIFY,$WS_GROUP))

$bar1 = GUICtrlCreateLabel("", 96, 103, 260, 4, $SS_SUNKEN)

$bar2 = GUICtrlCreateLabel("", 96, 330, 260, 4, $SS_SUNKEN)

; buttons

$Install = GUICtrlCreateButton("&Install", 370, 400, 75, 25, 0)

$Exit = GUICtrlCreateButton("&Exit", 370, 467, 75, 25, 0)

#EndRegion ### END Koda GUI section ###

; Tree code

$maintree = GUICtrlCreateTreeView (20,349,169,208)

GUICtrlSetBkColor($maintree,0xEEEEEE)

$mwgroup = GUICtrlCreateTreeViewItem ("Malware Spectre",$maintree)

GUICtrlSetColor(-1, 0x0000C0)

$portgroup = GUICtrlCreateTreeViewItem ("Port Scan",$maintree)

GUICtrlSetColor(-1, 0x0000C0)

$procgroup = GUICtrlCreateTreeViewItem ("Process Scan",$maintree)

GUICtrlSetColor(-1, 0x0000C0)

$scangroup = GUICtrlCreateTreeViewItem ("System Scan",$maintree)

GUICtrlSetColor(-1, 0x0000C0)

$intgroup = GUICtrlCreateTreeViewItem ("Internet Investigation",$maintree)

GUICtrlSetColor(-1, 0x0000C0)

$proggroup = GUICtrlCreateTreeViewItem ("Program Scan",$maintree)

GUICtrlSetColor(-1, 0x0000C0)

$portitem = GUICtrlCreateTreeViewItem ("Fport v.2",$portgroup)

$procitem1 = GUICtrlCreateTreeViewItem ("Process Explorer v.10.21",$procgroup)

$procitem2 = GUICtrlCreateTreeViewItem ("LordPE",$procgroup)

$scanitem = GUICtrlCreateTreeViewItem ("Spybot v.1.4",$scangroup)

$intitem = GUICtrlCreateTreeViewItem ("Web Historian",$intgroup)

$progitem1 = GUICtrlCreateTreeViewItem ("RunAlyzer",$proggroup)

$progitem2 = GUICtrlCreateTreeViewItem ("FileAlyzer v.1.4",$proggroup)

; description box

$descgroup = GUICtrlCreateGroup ("Description",199,398,145,100)

; lables for the description box

$portlabel = GUICtrlCreateLabel ("Port scanner",210,439,128,50)

$proclabel1 = GUICtrlCreateLabel ("Detects running process",210,439,128,50)

$proclabel2 = GUICtrlCreateLabel ("PE and process dump utility",210,439,128,50)

$scanlabel = GUICtrlCreateLabel ("Spyware, malware,adware scanner",210,439,128,50)

$intlabel = GUICtrlCreateLabel ("Index.dat viewer",210,439,128,50)

$proglabel1 = GUICtrlCreateLabel ("Autostart and configuration manager",210,439,128,50)

$proglabel2 = GUICtrlCreateLabel ("Displays file properties and contents in a hex dump format",210,439,128,50)

$startlabel = GUICtrlCreateLabel ("Malware Spectre v.1",210,439,128,50)

GUICtrlSetState($procgroup, BitOr($GUI_EXPAND,$GUI_DEFBUTTON))

GUICtrlSetState($proggroup, BitOr($GUI_EXPAND,$GUI_DEFBUTTON))

GUICtrlSetState($scangroup, BitOr($GUI_EXPAND,$GUI_DEFBUTTON))

GUICtrlSetState($intgroup, BitOr($GUI_EXPAND,$GUI_DEFBUTTON))

GUICtrlSetState($portgroup, BitOr($GUI_EXPAND,$GUI_DEFBUTTON))

GUISetState()

; change of labels for description box

While 1

$msg = GUIGetMsg() ;exit button close

If $msg = $exit Then ;exit button close

Exit ;exit button close

EndIf ;exit button close

Select

;Case $msg = -3 Or $msg = -1

;ExitLoop

; start label

Case $msg = $mwgroup

GUIctrlSetState ($proclabel1,$GUI_HIDE)

GUIctrlSetState ($proclabel2,$GUI_HIDE)

GUIctrlSetState ($scanlabel,$GUI_HIDE)

GUIctrlSetState ($intlabel,$GUI_HIDE)

GUIctrlSetState ($proglabel1,$GUI_HIDE)

GUIctrlSetState ($proglabel2,$GUI_HIDE)

GUIctrlSetState ($portlabel,$GUI_HIDE)

GUIctrlSetState ($startlabel,$GUI_SHOW)

; fport label

Case $msg = $portitem

GUIctrlSetState ($proclabel1,$GUI_HIDE)

GUIctrlSetState ($proclabel2,$GUI_HIDE)

GUIctrlSetState ($scanlabel,$GUI_HIDE)

GUIctrlSetState ($intlabel,$GUI_HIDE)

GUIctrlSetState ($proglabel1,$GUI_HIDE)

GUIctrlSetState ($proglabel2,$GUI_HIDE)

GUIctrlSetState ($startlabel,$GUI_HIDE)

GUIctrlSetState ($portlabel,$GUI_SHOW)

; process label process explorer

Case $msg = $procitem1

GUIctrlSetState ($scanlabel,$GUI_HIDE)

GUIctrlSetState ($proclabel2,$GUI_HIDE)

GUIctrlSetState ($intlabel,$GUI_HIDE)

GUIctrlSetState ($proglabel1,$GUI_HIDE)

GUIctrlSetState ($proglabel2,$GUI_HIDE)

GUIctrlSetState ($portlabel,$GUI_HIDE)

GUIctrlSetState ($startlabel,$GUI_HIDE)

GUICtrlSetState($proclabel1,$GUI_SHOW)

Case $msg = $procitem2

GUIctrlSetState ($scanlabel,$GUI_HIDE)

GUIctrlSetState ($intlabel,$GUI_HIDE)

GUIctrlSetState ($proglabel1,$GUI_HIDE)

GUIctrlSetState ($proglabel2,$GUI_HIDE)

GUIctrlSetState ($portlabel,$GUI_HIDE)

GUIctrlSetState ($startlabel,$GUI_HIDE)

GUICtrlSetState($proclabel1,$GUI_HIDE)

GUIctrlSetState ($proclabel2,$GUI_SHOW)

; spybot label

Case $msg = $scanitem

GUIctrlSetState ($portlabel,$GUI_HIDE)

GUIctrlSetState ($proclabel1,$GUI_HIDE)

GUIctrlSetState ($proclabel2,$GUI_HIDE)

GUIctrlSetState ($intlabel,$GUI_HIDE)

GUIctrlSetState ($proglabel1,$GUI_HIDE)

GUIctrlSetState ($proglabel2,$GUI_HIDE)

GUIctrlSetState ($startlabel,$GUI_HIDE)

GUIctrlSetState ($scanlabel,$GUI_SHOW)

Case $msg = $intitem

GUIctrlSetState ($portlabel,$GUI_HIDE)

GUIctrlSetState ($proclabel1,$GUI_HIDE)

GUIctrlSetState ($proclabel2,$GUI_HIDE)

GUIctrlSetState ($proglabel1,$GUI_HIDE)

GUIctrlSetState ($proglabel2,$GUI_HIDE)

GUIctrlSetState ($scanlabel,$GUI_HIDE)

GUIctrlSetState ($startlabel,$GUI_HIDE)

GUIctrlSetState ($intlabel,$GUI_SHOW)

Case $msg = $progitem1

GUIctrlSetState ($portlabel,$GUI_HIDE)

GUIctrlSetState ($proclabel1,$GUI_HIDE)

GUIctrlSetState ($proclabel2,$GUI_HIDE)

GUIctrlSetState ($scanlabel,$GUI_HIDE)

GUIctrlSetState ($intlabel,$GUI_HIDE)

GUIctrlSetState ($startlabel,$GUI_HIDE)

GUIctrlSetState ($proglabel2,$GUI_HIDE)

GUIctrlSetState ($proglabel1,$GUI_SHOW)

Case $msg = $progitem2

GUIctrlSetState ($portlabel,$GUI_HIDE)

GUIctrlSetState ($proclabel1,$GUI_HIDE)

GUIctrlSetState ($proclabel2,$GUI_HIDE)

GUIctrlSetState ($scanlabel,$GUI_HIDE)

GUIctrlSetState ($intlabel,$GUI_HIDE)

GUIctrlSetState ($startlabel,$GUI_HIDE)

GUIctrlSetState ($proglabel1,$GUI_HIDE)

GUIctrlSetState ($proglabel2,$GUI_SHOW)

EndSelect

WEnd

GUIDelete()

Exit

Link to comment
Share on other sites

Try this...and see if it gets what you want.

;   Malware Spectre v.1
;   
;   1/17/2007

#include <GUIConstants.au3>
;   Gui code
#Region ### START Koda GUI section ### Form=C:\Program Files\AutoIt3\Examples\GUI\Advanced\MWv2.kxf
$MW = GUICreate("Malware Spectre v.1", 457, 574, 326, 125)
$Header = GUICtrlCreateLabel("Malware Spectre v.1", 100, 48, 252, 42, BitOR($SS_CENTER,$SS_CENTERIMAGE,$SS_SUNKEN))
GUICtrlSetFont(-1, 14, 800, 2, "Arial")
$pic = GUICtrlCreatePic("C:\Program Files\AutoIt3\Examples\GUI\Advanced\130.jpg", 120, 121, 220, 190, BitOR($SS_NOTIFY,$WS_GROUP))
$bar1 = GUICtrlCreateLabel("", 96, 103, 260, 4, $SS_SUNKEN)
$bar2 = GUICtrlCreateLabel("", 96, 330, 260, 4, $SS_SUNKEN)

;   buttons
$Install = GUICtrlCreateButton("&Install", 370, 400, 75, 25, 0)
$Exit = GUICtrlCreateButton("&Exit", 370, 467, 75, 25, 0)

#EndRegion ### END Koda GUI section ###

;   Tree code
$maintree = GUICtrlCreateTreeView (20,349,169,208)
GUICtrlSetBkColor($maintree,0xEEEEEE)
$mwgroup = GUICtrlCreateTreeViewItem ("Malware Spectre",$maintree)
GUICtrlSetColor(-1, 0x0000C0)
$portgroup = GUICtrlCreateTreeViewItem ("Port Scan",$maintree)
GUICtrlSetColor(-1, 0x0000C0)
$procgroup = GUICtrlCreateTreeViewItem ("Process Scan",$maintree)
GUICtrlSetColor(-1, 0x0000C0)
$scangroup = GUICtrlCreateTreeViewItem ("System Scan",$maintree)
GUICtrlSetColor(-1, 0x0000C0)
$intgroup = GUICtrlCreateTreeViewItem ("Internet Investigation",$maintree)
GUICtrlSetColor(-1, 0x0000C0)
$proggroup = GUICtrlCreateTreeViewItem ("Program Scan",$maintree)
GUICtrlSetColor(-1, 0x0000C0)
$portitem = GUICtrlCreateTreeViewItem ("Fport v.2",$portgroup)
$procitem1 = GUICtrlCreateTreeViewItem ("Process Explorer v.10.21",$procgroup)
$procitem2 = GUICtrlCreateTreeViewItem ("LordPE",$procgroup)
$scanitem = GUICtrlCreateTreeViewItem ("Spybot v.1.4",$scangroup)
$intitem = GUICtrlCreateTreeViewItem ("Web Historian",$intgroup)
$progitem1 = GUICtrlCreateTreeViewItem ("RunAlyzer",$proggroup)
$progitem2 = GUICtrlCreateTreeViewItem ("FileAlyzer v.1.4",$proggroup)

;   description box
$descgroup = GUICtrlCreateGroup ("Description",199,398,145,100)

;   lables for the description box
$portlabel = GUICtrlCreateLabel ("Port scanner",210,439,128,50)
$proclabel1 = GUICtrlCreateLabel ("Detects running process",210,439,128,50)
$proclabel2 = GUICtrlCreateLabel ("PE and process dump utility",210,439,128,50)
$scanlabel = GUICtrlCreateLabel ("Spyware, malware,adware scanner",210,439,128,50)
$intlabel = GUICtrlCreateLabel ("Index.dat viewer",210,439,128,50)
$proglabel1 = GUICtrlCreateLabel ("Autostart and configuration manager",210,439,128,50)
$proglabel2 = GUICtrlCreateLabel ("Displays file properties and contents in a hex dump format",210,439,128,50)
$startlabel = GUICtrlCreateLabel ("Malware Spectre v.1",210,439,128,50)

GUICtrlSetState($procgroup, BitOr($GUI_EXPAND,$GUI_DEFBUTTON))
GUICtrlSetState($proggroup, BitOr($GUI_EXPAND,$GUI_DEFBUTTON))
GUICtrlSetState($scangroup, BitOr($GUI_EXPAND,$GUI_DEFBUTTON))
GUICtrlSetState($intgroup, BitOr($GUI_EXPAND,$GUI_DEFBUTTON))
GUICtrlSetState($portgroup, BitOr($GUI_EXPAND,$GUI_DEFBUTTON))

GUISetState()

;   change of labels for description box
While 1
    
    $msg = GUIGetMsg()          ;exit button close
    If $msg = $exit Then        ;exit button close
    Exit                        ;exit button close
EndIf                           ;exit button close  

    Select
        ;Case $msg = -3 Or $msg = -1 
            ;ExitLoop
; start label
        Case $msg = $mwgroup
            GUIctrlSetState ($proclabel1,$GUI_HIDE)
            GUIctrlSetState ($proclabel2,$GUI_HIDE)
            GUIctrlSetState ($scanlabel,$GUI_HIDE)
            GUIctrlSetState ($intlabel,$GUI_HIDE)
            GUIctrlSetState ($proglabel1,$GUI_HIDE)
            GUIctrlSetState ($proglabel2,$GUI_HIDE)
            GUIctrlSetState ($portlabel,$GUI_HIDE)
            GUIctrlSetState ($startlabel,$GUI_SHOW)
;   fport label         
        Case $msg = $portitem
            GUIctrlSetState ($proclabel1,$GUI_HIDE)
            GUIctrlSetState ($proclabel2,$GUI_HIDE)
            GUIctrlSetState ($scanlabel,$GUI_HIDE)
            GUIctrlSetState ($intlabel,$GUI_HIDE)
            GUIctrlSetState ($proglabel1,$GUI_HIDE)
            GUIctrlSetState ($proglabel2,$GUI_HIDE)
            GUIctrlSetState ($startlabel,$GUI_HIDE)
            GUIctrlSetState ($portlabel,$GUI_SHOW)
            
;   process label process explorer      
        Case $msg = $procitem1
            GUIctrlSetState ($scanlabel,$GUI_HIDE)
            GUIctrlSetState ($proclabel2,$GUI_HIDE)
            GUIctrlSetState ($intlabel,$GUI_HIDE)
            GUIctrlSetState ($proglabel1,$GUI_HIDE)
            GUIctrlSetState ($proglabel2,$GUI_HIDE)
            GUIctrlSetState ($portlabel,$GUI_HIDE)
            GUIctrlSetState ($startlabel,$GUI_HIDE)
            GUICtrlSetState($proclabel1,$GUI_SHOW)
            
            Case $msg = $procitem2
            GUIctrlSetState ($scanlabel,$GUI_HIDE)
            GUIctrlSetState ($intlabel,$GUI_HIDE)
            GUIctrlSetState ($proglabel1,$GUI_HIDE)
            GUIctrlSetState ($proglabel2,$GUI_HIDE)
            GUIctrlSetState ($portlabel,$GUI_HIDE)
            GUIctrlSetState ($startlabel,$GUI_HIDE)
            GUICtrlSetState($proclabel1,$GUI_HIDE)
            GUIctrlSetState ($proclabel2,$GUI_SHOW)
            
;   spybot label                    
        Case $msg = $scanitem
            GUIctrlSetState ($portlabel,$GUI_HIDE)
            GUIctrlSetState ($proclabel1,$GUI_HIDE)
            GUIctrlSetState ($proclabel2,$GUI_HIDE)
            GUIctrlSetState ($intlabel,$GUI_HIDE)
            GUIctrlSetState ($proglabel1,$GUI_HIDE)
            GUIctrlSetState ($proglabel2,$GUI_HIDE)
            GUIctrlSetState ($startlabel,$GUI_HIDE)
            GUIctrlSetState ($scanlabel,$GUI_SHOW)
            
            
            Case $msg = $intitem
            GUIctrlSetState ($portlabel,$GUI_HIDE)
            GUIctrlSetState ($proclabel1,$GUI_HIDE)
            GUIctrlSetState ($proclabel2,$GUI_HIDE)
            GUIctrlSetState ($proglabel1,$GUI_HIDE)
            GUIctrlSetState ($proglabel2,$GUI_HIDE)
            GUIctrlSetState ($scanlabel,$GUI_HIDE)
            GUIctrlSetState ($startlabel,$GUI_HIDE)
            GUIctrlSetState ($intlabel,$GUI_SHOW)
            
            Case $msg = $progitem1
            GUIctrlSetState ($portlabel,$GUI_HIDE)
            GUIctrlSetState ($proclabel1,$GUI_HIDE)
            GUIctrlSetState ($proclabel2,$GUI_HIDE)
            GUIctrlSetState ($scanlabel,$GUI_HIDE)
            GUIctrlSetState ($intlabel,$GUI_HIDE)
            GUIctrlSetState ($startlabel,$GUI_HIDE)
            GUIctrlSetState ($proglabel2,$GUI_HIDE)
            GUIctrlSetState ($proglabel1,$GUI_SHOW)
            
            Case $msg = $progitem2
            GUIctrlSetState ($portlabel,$GUI_HIDE)
            GUIctrlSetState ($proclabel1,$GUI_HIDE)
            GUIctrlSetState ($proclabel2,$GUI_HIDE)
            GUIctrlSetState ($scanlabel,$GUI_HIDE)
            GUIctrlSetState ($intlabel,$GUI_HIDE)
            GUIctrlSetState ($startlabel,$GUI_HIDE)
            GUIctrlSetState ($proglabel1,$GUI_HIDE)
            GUIctrlSetState ($proglabel2,$GUI_SHOW)
            
            Case $msg = $Install
            $item = GUICtrlRead($maintree)      ; Get the controlID of the current selected treeview item
            If $item = 0 Then
                MsgBox(64, "TreeView Demo", "No item currently selected")
            Else
                $text = GUICtrlRead($item, 1) ; Get the text of the treeview item
                If $text == "" Then
                    MsgBox(16, "Error", "Error while retrieving infos about item")
                Else
                    MsgBox(64, "TreeView Demo", "Current item selected is: " & $text)  ; $advmsg[0] contains the text and $advmsg[1] the state value of the treeview item
                EndIf
            EndIf       
            
            
    EndSelect
WEnd

GUIDelete()
Exit
Edit Removed tags - Also this was right from the help file example with your variables added.

Edit2 Fix tags

Edited by nitekram

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

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