Jump to content
Sign in to follow this  
ne0trace

GUICtrlButton does not read&combine Variable

Recommended Posts

ne0trace

Hello,

I wrote this little piece down here. What I would like to achieve is that the $customer button and the $project button will get combined when I press the $createdir button. But right now the msgbox (for just gives me 78 as an output.

In addition I would like to replace every space character with an underscore. I am pretty sure that I misunderstood the whole concept a bit.

thank you

Felix

#include <GUIConstantsEx.au3>

GUICreate("nerve", 300, 300)
GUICtrlCreateLabel("Please select your option. Input might be disabled if needed!", 10, 10)
$sapphirebutton = GUICtrlCreateButton ("Activate/Sapphire", 30, 50, 100)
$trapcodebutton = GUICtrlCreateButton ("Activate/Trapcode", 180, 50, 100)
$wakeonlan = GUICtrlCreateButton ("Start/the/Farm", 105, 90, 100)
$customer = GUICtrlCreateInput ("Customer Code", 105, 160)
$project = GUICtrlCreateInput ("Project Name", 105, 190, 100)
$createdir = GUICtrlCreateButton ("Create Directory", 105, 230, 100)
GUISetState(@SW_SHOW)

While 1
  $msg = GUIGetMsg()

  Select
    Case $msg = $sapphirebutton
        Run ("\\work\administration\scripts_batchdateien\Sapphire_registrieren\plugin_sapphire_aktivieren.exe")
;      MsgBox(0, "GUI Event", "You pressed OK!")

    Case $msg = $trapcodebutton
        Run ("\\work\administration\scripts_batchdateien\Trapcode_registrieren\Trapcode_registrieren.exe")

    Case $msg = $wakeonlan
        Run ("\\work\administration\scripts_batchdateien\FRA_wake_farm.bat")

    Case $msg = $createdir
        $path = $customer & $project
;       StringReplace ($project, " ", "")
        MsgBox (4096, "Test", $path)
        

    Case $msg = $GUI_EVENT_CLOSE
;      MsgBox(0, "GUI Event", "You clicked CLOSE! Exiting...")


        ExitLoop
  EndSelect
WEnd

Share this post


Link to post
Share on other sites
Monamo

Hello,

I wrote this little piece down here. What I would like to achieve is that the $customer button and the $project button will get combined when I press the $createdir button. But right now the msgbox (for just gives me 78 as an output.

In addition I would like to replace every space character with an underscore. I am pretty sure that I misunderstood the whole concept a bit.

thank you

Felix

CODE
#include <GUIConstantsEx.au3>

GUICreate("nerve", 300, 300)

GUICtrlCreateLabel("Please select your option. Input might be disabled if needed!", 10, 10)

$sapphirebutton = GUICtrlCreateButton ("Activate/Sapphire", 30, 50, 100)

$trapcodebutton = GUICtrlCreateButton ("Activate/Trapcode", 180, 50, 100)

$wakeonlan = GUICtrlCreateButton ("Start/the/Farm", 105, 90, 100)

$customer = GUICtrlCreateInput ("Customer Code", 105, 160)

$project = GUICtrlCreateInput ("Project Name", 105, 190, 100)

$createdir = GUICtrlCreateButton ("Create Directory", 105, 230, 100)

GUISetState(@SW_SHOW)

While 1

$msg = GUIGetMsg()

Select

Case $msg = $sapphirebutton

Run ("\\work\administration\scripts_batchdateien\Sapphire_registrieren\plugin_sapphire_aktivieren.exe")

; MsgBox(0, "GUI Event", "You pressed OK!")

Case $msg = $trapcodebutton

Run ("\\work\administration\scripts_batchdateien\Trapcode_registrieren\Trapcode_registrieren.exe")

Case $msg = $wakeonlan

Run ("\\work\administration\scripts_batchdateien\FRA_wake_farm.bat")

Case $msg = $createdir

$path = $customer & $project

; StringReplace ($project, " ", "")

MsgBox (4096, "Test", $path)

Case $msg = $GUI_EVENT_CLOSE

; MsgBox(0, "GUI Event", "You clicked CLOSE! Exiting...")

ExitLoop

EndSelect

WEnd

Try something along the lines of (untested, so check for typos and such):

$path = GuiCtrlRead($customer) & GuiCtrlRead($project)

Edit: resized and changed original autoit box to codebox

Edited by Monamo

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Share this post


Link to post
Share on other sites
ne0trace

Woohoo thank you that worked...

You might not know what I did wrong with the stringreplace because it simply doesn't do anything?

Felix

#include <GUIConstantsEx.au3>

GUICreate("nerve", 300, 300)
GUICtrlCreateLabel("Please select your option. Input might be disabled if needed!", 10, 10)
$sapphirebutton = GUICtrlCreateButton ("Activate/Sapphire", 30, 50, 100)
$trapcodebutton = GUICtrlCreateButton ("Activate/Trapcode", 180, 50, 100)
$wakeonlan = GUICtrlCreateButton ("Start/the/Farm", 105, 90, 100)
$customer = GUICtrlCreateInput ("Customer Code", 105, 160)
$project = GUICtrlCreateInput ("Project Name", 105, 190, 100)
$createdir = GUICtrlCreateButton ("Create Directory", 105, 230, 100)
GUISetState(@SW_SHOW)

While 1
  $msg = GUIGetMsg()

  Select
    Case $msg = $sapphirebutton
        Run ("\\work\administration\scripts_batchdateien\Sapphire_registrieren\plugin_sapphire_aktivieren.exe")
;      MsgBox(0, "GUI Event", "You pressed OK!")

    Case $msg = $trapcodebutton
        Run ("\\work\administration\scripts_batchdateien\Trapcode_registrieren\Trapcode_registrieren.exe")

    Case $msg = $wakeonlan
        Run ("\\work\administration\scripts_batchdateien\FRA_wake_farm.bat")

    Case $msg = $createdir
    StringReplace ($project, " ", "-")
        $path = GuiCtrlRead($customer) & GuiCtrlRead($project)
        MsgBox (4096, "Test", $path)
        

    Case $msg = $GUI_EVENT_CLOSE
;      MsgBox(0, "GUI Event", "You clicked CLOSE! Exiting...")


        ExitLoop
  EndSelect
WEnd

Share this post


Link to post
Share on other sites
ne0trace

Hello,

even this slight modification doesn't do the job:

#include <GUIConstantsEx.au3>

GUICreate("nerve", 300, 300)
GUICtrlCreateLabel("Please select your option. Input might be disabled if needed!", 10, 10)
$sapphirebutton = GUICtrlCreateButton ("Activate/Sapphire", 30, 50, 100)
$trapcodebutton = GUICtrlCreateButton ("Activate/Trapcode", 180, 50, 100)
$wakeonlan = GUICtrlCreateButton ("Start/the/Farm", 105, 90, 100)
$customer = GUICtrlCreateInput ("Customer Code", 105, 160)
$project = GUICtrlCreateInput ("Project Name", 105, 190, 100)
$createdir = GUICtrlCreateButton ("Create Directory", 105, 230, 100)
GUISetState(@SW_SHOW)

While 1
  $msg = GUIGetMsg()

  Select
    Case $msg = $sapphirebutton
        Run ("\\work\administration\scripts_batchdateien\Sapphire_registrieren\plugin_sapphire_aktivieren.exe")
;      MsgBox(0, "GUI Event", "You pressed OK!")

    Case $msg = $trapcodebutton
        Run ("\\work\administration\scripts_batchdateien\Trapcode_registrieren\Trapcode_registrieren.exe")

    Case $msg = $wakeonlan
        Run ("\\work\administration\scripts_batchdateien\FRA_wake_farm.bat")

    Case $msg = $createdir
    
$project_nospace = GuiCtrlRead($project)
StringReplace ($project_nospace, " ", "-")
        $path = GuiCtrlRead($customer) & " " & $project_nospace
        MsgBox (4096, "Test", $path)
        

    Case $msg = $GUI_EVENT_CLOSE

        ExitLoop
  EndSelect
WEnd

Felix

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.