youtuber Posted April 16, 2016 Posted April 16, 2016 Hi all I have a problem This must be how? "--parameter" if stringlen ($I_m_variable)>0 then $aPerside="a1" & GUICtrlRead($Input1) & "a2" & GUICtrlRead($Input2) & "a3" & ""--parameter"" & "a4" else $aPerside="" endif
InunoTaishou Posted April 17, 2016 Posted April 17, 2016 '"--parameter"' (single quote)(double quote)--parameter(double quote)(single quote)
youtuber Posted April 19, 2016 Author Posted April 19, 2016 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
Trong Posted April 19, 2016 Posted April 19, 2016 (edited) 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 April 19, 2016 by VIP Regards,
AutoBert Posted April 19, 2016 Posted April 19, 2016 @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 youtuber 1
Trong Posted April 19, 2016 Posted April 19, 2016 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: expandcollapse popup#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,
AutoBert Posted April 19, 2016 Posted April 19, 2016 @Vip: first example is just the same nonsence as before: 1 hour ago, AutoBert said: it's nonsence trying declaring and assignig a a variable after exit, it will be never assigned.
youtuber Posted April 19, 2016 Author Posted April 19, 2016 There is another problem to thank answer expandcollapse popup#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
mikell Posted April 19, 2016 Posted April 19, 2016 (edited) AutoBert will get mad soon Edited April 19, 2016 by mikell
AutoBert Posted April 19, 2016 Posted April 19, 2016 (edited) 1 hour ago, mikell said: AutoBert will get mad soon yes yet i am. But now i am ignore the cry >=2 times talking about nonsence is enough! But may be a VIP can top him? Edited April 19, 2016 by AutoBert
youtuber Posted April 19, 2016 Author Posted April 19, 2016 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
mikell Posted April 20, 2016 Posted April 20, 2016 youtuber, Your code is unreadable. Could you please explain with words what you want to do and what should be the expected result ? youtuber 1
youtuber Posted April 20, 2016 Author Posted April 20, 2016 Thank you for your interest mikell Is this code written right? expandcollapse popup#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
mikell Posted April 20, 2016 Posted April 20, 2016 It looks much better. As I don't know the aim I can't say if the result is good or not - but the code works
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now