Sign in to follow this  
Followers 0
surfdork

How do I create a Message box withing a custom GUI

5 posts in this topic

Questions:

How to I create an output other than a label?

I searched the help and did nt find a command for

GuiCreateMsgBox. I want to create a standard text box that will display a functions output that's triggered by button clcik command.

When I click on the button the function I created executes. THe problem is that it continues to loop. I am unclear how to stop this. I want it to stop when the function completes.

Once I can get this working I'll scale it to call 3 functions from 3 buttons and add another msg box

I've spent allot of time on this and would nnot have made it this far without thhe communities help.

GuiCreate("SkyRoom IP Reconfig",515,130,518,83)

$button1=GuiCtrlCreateButton("10.10 reconfigure",46,105,465,24)

$output1=GUICtrlCreateLabel(@IPAddress1,44,14,403,20)

GuiSetState()

While 1

$msg=GuiGetMsg()

If $msg=-3 Then Exit

If $msg=$button1 Then button1()

Wend

;get the local IP address

Func ResetIP()

RunWait(@ComSpec & ' /c ' & 'IPCONFIG /release', @systemdir, @sw_hide)

$output1=GUICtrlCreateLabel(@IPAddress1,44,14,403,20)

RunWait(@ComSpec & ' /c ' & 'IPCONFIG /renew', @systemdir, @sw_hide)

$output1=GUICtrlCreateLabel(@IPAddress1,44,14,403,20)

endfunc

Func button1()

ResetIP()

EndFunc

;The code below is to be plugged in later, it's simple VBS I need to convert to autoit no help needed

sub UpdateRegistry1

Const HKEY_CURRENT_USER = &H80000001

strComputer = "."

Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings"

strValueName = "ProxyEnable"

dwValue = 1

objRegistry.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, strValueName, dwValue

strValueName = "ProxyServer"

strValue = "web-proxy.fc.hp.com:8080"

objRegistry.SetStringValue HKEY_CURRENT_USER, strKeyPath, strValueName, strValue

strValueName = "ProxyOverride"

strValue = "10.*;*.overture2.com;*.overture.com;*.fc.hp.com;<local>"

objRegistry.SetStringValue HKEY_CURRENT_USER, strKeyPath, strValueName, strValue

End Sub

sub UpdateRegistryForcePeroxy

Const HKEY_CURRENT_USER = &H80000001

strComputer = "."

Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings"

strValueName = "ProxyEnable"

dwValue = 1

objRegistry.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, strValueName, dwValue

strValueName = "ProxyServer"

strValue = "192.168.3.5:8888"

objRegistry.SetStringValue HKEY_CURRENT_USER, strKeyPath, strValueName, strValue

strValueName = "ProxyOverride"

strValue = ""

objRegistry.SetStringValue HKEY_CURRENT_USER, strKeyPath, strValueName, strValue

End Sub

Share this post


Link to post
Share on other sites



GUICreate("SkyRoom IP Reconfig", 515, 130, 518, 83)
$button1 = GUICtrlCreateButton("10.10 reconfigure", 46, 105, 465, 24)
Global $output = GUICtrlCreateEdit(@IPAddress1, 44, 14, 403, 20)
GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = -3 Then Exit
    If $msg = $button1 Then button1()
WEnd
;get the local IP address


Func ResetIP()

    RunWait(@ComSpec & ' /c ' & 'IPCONFIG /release', @SystemDir, @SW_HIDE)

    GUICtrlSetData ($output, @IPAddress1)

    RunWait(@ComSpec & ' /c ' & 'IPCONFIG /renew', @SystemDir, @SW_HIDE)

    GUICtrlSetData ($output, @IPAddress1)

EndFunc   ;==>ResetIP


Func button1()
    ResetIP()
EndFunc   ;==>button1

Func UpdateRegistry1()
    Local $sKeyPath = "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings"

    RegWrite($sKeyPath, "ProxyEnable", "REG_DWORD", 1)
    RegWrite($sKeyPath, "ProxyServer", "REG_SZ", "web-proxy.fc.hp.com:8080")
    RegWrite($sKeyPath, "ProxyOverride", "REG_SZ", "10.*;*.overture2.com;*.overture.com;*.fc.hp.com;<local>")
EndFunc   ;==>UpdateRegistry1

Func UpdateRegistryForcePeroxy()
    Local $sKeyPath = "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings"

    RegWrite($sKeyPath, "ProxyEnable", "REG_DWORD", 1)
    RegWrite($sKeyPath, "ProxyServer", "REG_SZ", "192.168.3.5:8888")
    RegWrite($sKeyPath, "ProxyOverride", "REG_SZ", "")
EndFunc   ;==>UpdateRegistryForcePeroxy

For the second converted function... Are you sure you want it to be called peroxy not proxy? I don't know much about proxys so I left it.

Mat

Share this post


Link to post
Share on other sites

@surfdork

When posting code, please click the button in the editor toolbar that looks like <> to insert the code tags. Then paste your code between the tags. That makes it much easier for us to read.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Mat,

Big thanks for your assistance. I learned allot by working with all of the answers you provided. You gave me a framework that I can expand upon so thanks again. The script is below, enjoy.

Now It's my turn to repay the favor in this forum although I'm sure I'll submit plenty of idiotic questions in the future.

;)

>"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "F:\SkyRoom IP Refresh Tool Final.au3" /autoit3dir "C:\Program Files (x86)\AutoIt3" /UserParams    
+>20:07:18 Starting AutoIt3Wrapper v.2.0.0.3    Environment(Language:0409  Keyboard:00000409  OS:WIN_VISTA/Service Pack 1  CPU:X64 OS:X64)
>Running AU3Check (1.54.14.0)  from:C:\Program Files (x86)\AutoIt3
+>20:07:19 AU3Check ended.rc:0
>Running:(3.3.0.0):C:\Program Files (x86)\AutoIt3\autoit3.exe "F:\SkyRoom IP Refresh Tool Final.au3"    
+>20:07:36 AutoIT3.exe ended.rc:0
+>20:07:37 AutoIt3Wrapper Finished
>Exit code: 0    Time: 18.564

Share this post


Link to post
Share on other sites

Oops, had to fix this

RegWrite($sKeyPath, "ProxyEnable", "REG_DWORD", "1")

The values ned tobe in quotes ;)

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