Jump to content
Sign in to follow this  
sliwek

GUICtrlRead dosent work in Function

Recommended Posts

sliwek

Hi

i trying to make makro to run program (instalation) from other PC and have problem with GUICtrlRead in Install function. It wont read my choose from Gui, dont know why.

----------------------------

edit:

Ok found problem.

Edited by sliwek

Share this post


Link to post
Share on other sites
Melba23

sliwek,

You had the combos the wrong way round and so you were not reading the correct one. This works for me: :oops:

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#region ### START Koda GUI section ### Form=
;_listy()
$Form1 = GUICreate("Wertest", 396, 206, 275, 122)
$exeWertest = GUICtrlCreateCombo("", 40, 40, 201, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Finanse|Fundusz", "")
$Button1 = GUICtrlCreateButton("Instaluj", 256, 40, 105, 25)
$Label1 = GUICtrlCreateLabel("Wertest", 40, 16, 41, 17)
$Label2 = GUICtrlCreateLabel("Wertest demo", 40, 80, 70, 17)
$exeWertestDemo = GUICtrlCreateCombo("", 40, 96, 201, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Finanse|Fundusz", "")
$Button2 = GUICtrlCreateButton("Instaluj", 256, 96, 105, 25)
$Button3 = GUICtrlCreateButton("Zamknij", 256, 144, 105, 41)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE, $Button3
            Exit
        Case $Button1
            install()
        Case $Button2
            installdemo()
    EndSwitch
    ;Global $profil = GUICtrlRead($profilinput)
WEnd

Func _listy()
    $var = IniReadSectionNames("settings.ini")
    If @error Then
        wypelnijliste()
    EndIf
EndFunc   ;==>_listy

Func wypelnijliste()
    IniWrite("settings.ini", "wertest", "Finanse", "serwerinstalkiFinanseFinanse.exe")
    IniWrite("settings.ini", "wertest", "Fundusz", "serwerinstalkiFunduszFundusz.exe")
EndFunc   ;==>wypelnijliste

Func install()
    $program = GUICtrlRead($exeWertest)
    MsgBox(0, "Install", $program)
    ;IniWrite("settings.ini", "test", "Finanse DDJ", GUICtrlRead($exeWertest))
    ;$file = IniRead("settings.ini", "wertest", $program, "Not found")
    ;MsgBox(0, "instal", "Instaluje " & $program & " z lokalizacji: " & @LF & $file)
    ;Run($file)
EndFunc   ;==>install

Func installdemo()
    $program = GUICtrlRead($exeWertestDemo)
    MsgBox(0, "Demo", $program)
    ;$file = IniRead("settings.ini", "wertestDemo", $program, "Not found")
    ;Run($file)
EndFunc   ;==>installdemo

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______Open Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
sliwek

thx

yea also saw that, but have another one problem. when i chose "fundusz" and press install it still show me "finanse". dont know how refresh it.

Edited by sliwek

Share this post


Link to post
Share on other sites
Melba23

sliwek,

The code I posted above does not have that problem. What code are you using? :oops:

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______Open Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
sliwek

Yea i see it's work in ur code, cant find diferents in GUICreate code

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

listy()

$Form1 = GUICreate("Wertest", 396, 206, 275, 122)
$exeWertest = GUICtrlCreateCombo("", 40, 96, 201, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Finanse|Fundusz", "Finanse")
$Button1 = GUICtrlCreateButton("Instaluj", 256, 40, 105, 25)
$Label1 = GUICtrlCreateLabel("Wertest", 40, 16, 41, 17)
$Label2 = GUICtrlCreateLabel("Wertest demo", 40, 80, 70, 17)
$exeWertestDemo = GUICtrlCreateCombo("", 40, 40, 201, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Finanse|Fundusz", "Finanse")
$Button2 = GUICtrlCreateButton("Instaluj", 256, 96, 105, 25)
$Button3 = GUICtrlCreateButton("Zamknij", 256, 144, 105, 41)
$Button4 = GUICtrlCreateButton("Linki do plików", 48, 152, 105, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE,$Button3
   Exit
  Case $Button1
   install()
  Case $Button2
   installdemo()
  Case $Button4
  
  EndSwitch
WEnd

Func Listy()
$var = IniReadSectionNames("settings.ini")
    If @error Then
  wypelnijliste()
EndIf
EndFunc

Func wypelnijliste()
IniWrite("settings.ini","wertest","Finanse","serwerinstalkiFinanse9.0000Finanse.exe")
IniWrite("settings.ini","wertest","Fundusz","serwerinstalkiFundusz5.0006Fundusz.exe")
EndFunc

Func install()
$program = GUICtrlRead($exeWertest)
$file = IniRead("settings.ini","wertest",$program,"Not found")
MsgBox(0,"instal", "Instaluje " & $program & " z lokalizacji: "& @LF & $file)
;Run($file)
EndFunc

Func installdemo()
$program = GUICtrlRead($exeWertestDemo)
$file = IniRead("settings.ini","wertestDemo",$program,"Not found")
;Run($file)
EndFunc
Edited by sliwek

Share this post


Link to post
Share on other sites
Melba23

sliwek,

You still have the combos the wrong way round in that code so that you are reading the other combo when you press a button - that is why it does not change. :bye:

Look at the Y coordinates I used in my code and those you have used. When you get the correct combo in the correct place it works. :oops:

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______Open Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
sliwek

ha ha ha :oops:

THX

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  

×