Jump to content

GUICtrlRead multiple " mark problem


Recommended Posts

How could this be?

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=


$Form1 = GUICreate("Form1", 248, 324, 445, 192)
$Combo1 = GUICtrlCreateCombo("--parameter1", 40, 48, 161, 25)
GUICtrlSetData(-1, "--parameter2|--parameter3")
$Button1 = GUICtrlCreateButton("Button1", 96, 96, 75, 25)
$Input1 = GUICtrlCreateInput("Input1", 56, 144, 153, 21)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
Global $gaddparameter = GUICtrlRead($Combo1)
Global $gmethod= " abcd" & """$gaddparameter""" &  " defg"

Case $Button1
 GUICtrlSetData($Input1,$gmethod)

    EndSwitch
WEnd

 

Link to comment
Share on other sites

2 hours ago, youtuber said:

Help me please

Use parentheses. (')

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=


$Form1 = GUICreate("Form1", 248, 324, 445, 192)
$Combo1 = GUICtrlCreateCombo("--parameter1", 40, 48, 161, 25)
GUICtrlSetData(-1, "--parameter2|--parameter3")
$Button1 = GUICtrlCreateButton("Button1", 96, 96, 75, 25)
$Input1 = GUICtrlCreateInput("Input1", 56, 144, 153, 21)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
            Global $gaddparameter = GUICtrlRead($Combo1)
            Global $gmethod = " abcd" & '"' & $gaddparameter & '"' & " defg"
;~          Global $gmethod = ' abcd' & '"' & $gaddparameter & '"' & ' defg'
        Case $Button1
            GUICtrlSetData($Input1, $gmethod)

    EndSwitch
WEnd

 

Edited by VIP

Regards,
 

Link to comment
Share on other sites

@youtuber: it's nonsence trying declaring and assignig a a variable after exit, it will be never assigned.

@VIP: same noncene but using tidy so better formated nonsence.

The variable has to be assigned in the case (-node) she is needed to be actual. Declaring of varaiables make sence in top of script.

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=

Global $gaddparameter, $gmethod
$Form1 = GUICreate("Form1", 248, 324, 445, 192)
$Combo1 = GUICtrlCreateCombo("--parameter1", 40, 48, 161, 25)
GUICtrlSetData(-1, "--parameter2|--parameter3")
$Button1 = GUICtrlCreateButton("Button1", 96, 96, 75, 25)
$Input1 = GUICtrlCreateInput("Input1", 56, 144, 153, 21)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $gaddparameter = GUICtrlRead($Combo1)
            $gmethod = " abcd " & '"' & $gaddparameter & ' "' & " defg"
            GUICtrlSetData($Input1, $gmethod)
    EndSwitch
WEnd

 

Link to comment
Share on other sites

1 hour ago, AutoBert said:

@youtuber: it's nonsence trying declaring and assignig a a variable after exit, it will be never assigned.

@VIP: same noncene but using tidy so better formated nonsence.

The variable has to be assigned in the case (-node) she is needed to be actual. Declaring of varaiables make sence in top of script.

 

Yeah, I missed them. I'm only interested in the question ^^

Simple:

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
Global $Form1 = GUICreate("Form1", 248, 324, 445, 192)
Global $Combo1 = GUICtrlCreateCombo("--parameter1", 40, 48, 161, 25)
GUICtrlSetData(-1, "--parameter2|--parameter3")
Global $Button1 = GUICtrlCreateButton("Button1", 96, 96, 75, 25)
Global $Input1 = GUICtrlCreateInput("Input1", 56, 144, 153, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Global $gaddparameter, $gmethod

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
            Global $gaddparameter = GUICtrlRead($Combo1)
            $gmethod = ' abcd' & '"' & $gaddparameter & '"' & ' defg'
;~          $gmethod = " abcd" & '"' & $gaddparameter & '"' & " defg"
;~          $gmethod = " abcd" & '"' & $gaddparameter & '"  defg'
        Case $Button1
            GUICtrlSetData($Input1, $gmethod)
    EndSwitch
    Sleep(10)
WEnd

 

Or something better:

#EndRegion # Application: Start Program
#NoTrayIcon
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <FileConstants.au3>
;~ Global Const $CBS_AUTOHSCROLL = 0x40
;~ Global Const $CBS_DROPDOWN = 0x2
;~ Global Const $ES_READONLY = 2048
;~ Global Const $GUI_SS_DEFAULT_INPUT = 0x00000080
;~ Global Const $GUI_EVENT_CLOSE = -3
;~ Global Const $GUI_CHECKED = 1
;~ Global Const $FD_FILEMUSTEXIST = 1

If StringInStr(@OSArch, "64") Then DllCall("kernel32.dll", "boolean", "Wow64EnableWow64FsRedirection", "boolean", 0) ;Disable Wow64FsRedirection

Global $DefaultApp = @SystemDir & "\notepad.exe"
Global $DefaulParameters = "--parameter1"
Global $AddParameters = "--parameter2|--parameter3"
Global $ShowAppWhenRUN = 1

#Region # START GUI
Global $hGUI = GUICreate("Start Program", 507, 141)
GUICtrlCreateLabel("App Path: ", 16, 16, 71, 17)
Global $AppPath = GUICtrlCreateInput($DefaultApp, 96, 16, 241, 21)
Global $Browser = GUICtrlCreateButton("...", 344, 16, 33, 25)
GUICtrlCreateLabel("Parameters: ", 8, 48, 84, 17)
Global $Parameters = GUICtrlCreateInput("", 96, 48, 281, 21)
GUICtrlSetTip($Parameters, "Leave blank to use the list below.")
GUICtrlCreateLabel("OR Parameters:", 8, 80, 84, 17)
Global $ComboListParameters = GUICtrlCreateCombo($DefaulParameters, 96, 80, 281, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
GUICtrlSetData($ComboListParameters, $AddParameters)
Global $Execute = GUICtrlCreateButton("Execute", 392, 16, 105, 57)
Global $SW_HIDE = GUICtrlCreateCheckbox("SW_HIDE", 400, 80, 89, 17)
Global $outCommandLine = GUICtrlCreateInput("", 8, 112, 489, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_READONLY))
GUISetState(@SW_SHOW)
#EndRegion # START GUI

Global $CommandLine

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Execute
            GUICtrlReadUpdateData()
            ConsoleWrite($ShowAppWhenRUN & @CRLF)
            If $ShowAppWhenRUN Then
                Run('"' & GUICtrlRead($AppPath) & '" ' & $CommandLine)
                ConsoleWrite(@error & @CRLF)
            Else
                Run('"' & GUICtrlRead($AppPath) & '" ' & $CommandLine, @WorkingDir, @SW_HIDE)
                ConsoleWrite(@error & @CRLF)
            EndIf
        Case $Browser
            Local $sAppPath = FileOpenDialog("Select Application to Execute", @WorkingDir, "Application (*.exe)", $FD_FILEMUSTEXIST)
            If $sAppPath <> "" Then GUICtrlSetData($AppPath, $sAppPath)
            GUICtrlReadUpdateData()
        Case $AppPath, $Parameters
            GUICtrlReadUpdateData()
    EndSwitch
    Sleep(10)
WEnd

Func GUICtrlReadUpdateData()
    If StringStripWS(GUICtrlRead($Parameters), 8) <> "" Then
        $CommandLine = GUICtrlRead($Parameters)
    Else
        $CommandLine = GUICtrlRead($ComboListParameters)
    EndIf
    GUICtrlSetData($outCommandLine, '"' & GUICtrlRead($AppPath) & '" ' & $CommandLine)
    If GUICtrlRead($SW_HIDE) = $GUI_CHECKED Then $ShowAppWhenRUN = 0
EndFunc   ;==>GUICtrlReadUpdateData


#Region # Author C490C3A06F2056C4836E2054726F6E67

 


 

Regards,
 

Link to comment
Share on other sites

There is another problem to thank answer

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=

Global $gaddparameter, $gmethod
$Form1 = GUICreate("Form1", 248, 324, 445, 192)
$Combo1 = GUICtrlCreateCombo("--parameter1", 40, 48, 161, 25)
GUICtrlSetData(-1, "--parameter2|--parameter3")
$Button1 = GUICtrlCreateButton("Button1", 80, 96, 75, 25)
$Input1 = GUICtrlCreateInput("Input1", 32, 144, 169, 21)
$Input2 = GUICtrlCreateInput("", 40, 16, 161, 21)
$Button2 = GUICtrlCreateButton("Button2", 80, 232, 75, 25)
$Input3 = GUICtrlCreateInput("", 32, 280, 177, 21)
GUISetState(@SW_SHOW)

Global $Inputdata = GUICtrlRead($Input2)

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

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

If stringlen ($Inputdata)> 0 Then
$Inputdataadd = $Inputdata
Else
$Inputdataadd = "Please add data"
EndIf


        Case $Button1


            $gaddparameter = GUICtrlRead($Combo1)
            $gmethod = " abcd " & '"' & $gaddparameter & ' "' & " defg"
            GUICtrlSetData($Input1, $gmethod&$Inputdataadd)

            Case $Button2
            GUICtrlSetData($Input3, $gmethod&$Inputdataadd)
    EndSwitch
WEnd

 

Link to comment
Share on other sites

please help I want to use everywhere? 

Global $Inputdata = GUICtrlRead($Input2);

If stringlen ($Inputdata)> 0 Then
$Inputdataadd = $Inputdata
Else
$Inputdataadd = "Please add data"
EndIf


        Case $Button1
            $gaddparameter = GUICtrlRead($Combo1)
            $gmethod = " abcd " & '"' & $gaddparameter & ' "' & " defg"
            GUICtrlSetData($Input1, $gmethod&$Inputdataadd)

 

I do not know much please :(

 

 

Link to comment
Share on other sites

Thank you for your interest mikell 

Is this code written right?

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 577, 476, 89, 129)
$Input1 = GUICtrlCreateInput("Input1", 40, 48, 121, 21)
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 72, 104, 97, 17)
$Input2 = GUICtrlCreateInput("Input2", 224, 48, 121, 21)
$Combo1 = GUICtrlCreateCombo("Com1", 224, 88, 145, 25)
GUICtrlSetData(-1, "com2|com3|")
$olustur1 = GUICtrlCreateButton("Button1", 200, 160, 75, 25)
$olusan1 = GUICtrlCreateInput("olusan1", 48, 232, 361, 21)
$olusan2 = GUICtrlCreateInput("olusan2", 56, 352, 361, 21)
$Input5 = GUICtrlCreateInput("Input5", 320, 312, 105, 21)
$olustur2 = GUICtrlCreateButton("Button2", 336, 392, 75, 25)
GUISetState(@SW_SHOW)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
    Exit
;-----------------------------------------------------------------------
Case $olustur1
global $globalveri1 = GUICtrlRead($Input1)
global $globalveri2 = GUICtrlRead($Input2)
global $globalveri3 = GUICtrlRead($Combo1)
global $globalveri4 = GUICtrlRead($Checkbox1)

If GUICtrlRead($Checkbox1) = 1 Then
$aEkle5veri ="ekle5"
Else
$aEkle5veri =""
EndIf
if stringlen ($globalveri1 & $globalveri2 & $globalveri3 & $globalveri4)>0 then

$inputverial1="ekle1 " & GUICtrlRead($Input1) & "ekle2 " & GUICtrlRead($Input2) & "ekle3 " &  GUICtrlRead($Combo1) & "ekle4 " & ""&$aEkle5veri
else
$inputverial1=""
endif

GUICtrlSetData($olusan1,$inputverial1)

;----------------------------------------------------------------------------------
Case $olustur2
global $globalveri12 = GUICtrlRead($Input5)

if stringlen ($globalveri1 & $globalveri2 & $globalveri3 & $globalveri4 & $globalveri12)>0 then
$inputverial2="ekle1 " & GUICtrlRead($Input1) & "ekle2 " & GUICtrlRead($Input2) & "ekle3 " &  GUICtrlRead($Combo1) & "ekle4 " & "" & $aEkle5veri & GUICtrlRead($Input5)
else
$inputverial2=""
endif

GUICtrlSetData($olusan2,$inputverial2)
    EndSwitch
WEnd

 

 

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