Jump to content

I'm New to AutoIT, Quick help question. Thanks! :)


Recommended Posts

Hello Everyone!

I really am stuck here, and would appreciate any help anyone could give me. I am trying to create a first program here.. I have a few batch files, that I would like to somehow integrate into the program. These batch files do some system tweaks for computers at work, that I have written.

I am looking to have them all in seperate tabs (Ill only list two tweaks, and two seperate tabs, then I can learn it from here):

TAB ONE: System Tweaks

L CHECK BOX ONE: Increase Cache

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Memory Management]

"SecondLevelDataCache"=dword:00000400

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management]

"SecondLevelDataCache"=dword:00000400

L CHECK BOX TWO: Disable Paging

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Memory Management]

"DisablePagingExecutive"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management]

"DisablePagingExecutive"=dword:00000001

[APPLY ALL ABOVE SELECTED TWEAKS BUTTON HERE]

TAB TWO: Network Tweaks

L CHECK BOX ONE: Diable Checking

[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\RemoteComputer\NameSpace\{D6277990-4C6A-11CF-8D87-00AA0060F5BF}]

If you guys would be so very kind to help me with this, I promise to get good quick and give back to the group quickly! :-) I have no idea, if maybe these should create a batch file, run it, then delete it, or if they can be integraded into my AuotIT script. Either way, Im stuck on figuring out how to do it. I wanted to see if it could display on the program that the fixes were completed.

Also, is there a way to put a password on this file? incase it gets in the hands of one of the End Users? Also, most of the tweaks require Administrator privledges, what could be a solution to this so that it cant be ran under anything less.

I REALLY APPRECIATE ANY HELP! :-) I WOULD LOVE TO GiVE BACK TO THE COMMUNITY, ONCE I HAVE A BETTER UNDERSTANDING OF IT.

Thanks so much everyone in advanced for all your very kind help!

- Joshua

Link to comment
Share on other sites

To design your graphic interface: SCiTe - Tools - Koda Form Designer

Get your GUI as you like it and after that start working on what you want your GUI to do.

A great help will be the help file: SCiTe - Help

Use GUICtrlRead to detect if your checkboxes are checked or not.

Use RegWrite to write/change key values in the registry. (you don't need a batch file for that)

Considering this ... you're pretty good on your way :P

... and ... when you're stuck on something ... ask for help.

Good luck,

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

Thank you!

If you could possibly give me a hint... I'm trying to figure out how to get the check box working with a button. So, for a example, I would have two check boxes, and each one contains a few registry setting cchanges, If selected, then once I hit the apply button, they will be applied and let me know they have completed. How would I get started on that part? I am pretty sure I will be able to pick it up from there. I'm a pretty quick learner!

Thank you very much!

- Josh :P

Link to comment
Share on other sites

Okay, I am finally getting somewhere, but need a little asistance for my next step... :-)

Attatched is my current project, but without tabs. Below is the sample script for the tabs:

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

#include <GuiConstantsEx.au3>

#include <GuiTab.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hTab

; Create GUI

GUICreate("Tab Control Set Extended Style", 400, 300)

$hTab = GUICtrlCreateTab(2, 2, 396, 296, BitOR($TCS_BUTTONS, $TCS_FLATBUTTONS))

GUISetState()

; Add tabs

_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")

_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")

_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Get/Set extended styles

_GUICtrlTab_SetExtendedStyle($hTab, $TCS_EX_FLATSEPARATORS)

MsgBox(4160, "Information", "Extended styles: 0x" & Hex(_GUICtrlTab_GetExtendedStyle($hTab)))

; Loop until user exits

Do

Until GUIGetMsg() = $GUI_EVENT_CLOSE

GUIDelete()

EndFunc ;==>_Main

Could someone tell me how to put the data from my attatched file (current) into this one? I tried a few different things, but to no avail.

I really appreciate all the help guys! You all are the best! :-)

- JoshMyProgram.au3

Link to comment
Share on other sites

I had to rewrite your code - it was not a good exercise to use a tab created via GuiTab.au3 - better stich to normal AutoIt for begining.

I've added some sample code to give you an idea about what happens there.

To put something on a specified tab item just include the code between the line where you created that tabItem and the next tabItem creation line.

Have a look at the code and try to understand what happens there.

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Performance Perfect PC - OFFICIAL USE ONLY!", 459, 373, 193, 125)
$Tab1 = GUICtrlCreateTab(0, 0, 449, 369, $TCS_BUTTONS)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$TabSheet1 = GUICtrlCreateTabItem("TabSheet1")
$Group1 = GUICtrlCreateGroup("Network Tweaks", 8, 32, 137, 137)
$Checkbox1 = GUICtrlCreateCheckbox("Tweak1", 16, 56, 121, 17)
$Checkbox2 = GUICtrlCreateCheckbox("Tweak2", 16, 80, 97, 17)
$Checkbox3 = GUICtrlCreateCheckbox("TweaK3", 16, 104, 97, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("Apply", 344, 336, 97, 25, 0)
$TabSheet2 = GUICtrlCreateTabItem("TabSheet2")
$TabSheet3 = GUICtrlCreateTabItem("TabSheet3")
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Checkbox1     ;when something happens to this control the next part of code will be executed
        ;sample code
            If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then
                MsgBox(32, "Checkbox1 - demo events", "You just checked it.")
            Else
                MsgBox(32, "Checkbox1- demo events", "You just UnChecked it")
            EndIf
            
        Case $Checkbox2
        ;add something here to happen when you check/uncheck
            
        Case $Checkbox3
        ;add something here to happen when you check/uncheck
            
        Case $Button1       ;when you press the button the next part of code will be executed
            If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then
                MsgBox(0, "Checkbox1", "Checked")
            Else
                MsgBox(0, "Checkbox1", "UnChecked")
            EndIf
            If GUICtrlRead($Checkbox2) = $GUI_CHECKED Then
                MsgBox(0, "Checkbox2", "Checked")
            Else
                MsgBox(0, "Checkbox2", "UnChecked")
            EndIf
            If GUICtrlRead($Checkbox3) = $GUI_CHECKED Then
                MsgBox(0, "Checkbox3", "Checked")
            Else
                MsgBox(0, "Checkbox3", "UnChecked")
            EndIf
    EndSwitch
WEnd

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

-snipped-

Also, most of the tweaks require Administrator privledges, what could be a solution to this so that it cant be ran under anything less.

-snipped

Use #RequireAdmin to specify that the script requires full administrator rights.
Link to comment
Share on other sites

Thanks to both of you for your replies! You guys are extra helpful! I will use / study the re-write and attempt to add to it and test/play with it.

I am really thankful for the re-write, as it is much more clear to me now. I will keep eveyone updated. :-)

- Josh

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