Jump to content

Recommended Posts

Hi guys,

i have problem with this : 

2e0utk3.png

whheux.png

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


GUI()
Func GUI()
Global $MyForm = GUICreate("My GUI edit",500,300,100,100)
GUISetState(@SW_SHOW)
GUISetFont(12, 400, 0, "Tahoma")

$Label1 = GUICtrlCreateLabel("Label 01 ",0, 0, 50 , 25 )
$Label1 = GUICtrlCreateLabel("Label 01 ",0, 50, 50 , 25 )

Global $BTN1 = GUICtrlCreateButton("BTN 1 ", 150, 0, 50, 25)
Global $BTN2 = GUICtrlCreateButton("BTN 2", 150, 50, 50, 25)
EndFunc

;Function
Func Test1()
   If $BTN1 = True Then
   Local $Edit1 = GUICtrlCreateEdit("Edit 1", 0, 80, 200, 200)
   EndIf
EndFunc

Func Test2()
   If $BTN2 = True Then
   Local $Edit2 = GUICtrlCreateEdit("Edit 2", 200, 80, 200, 200)
   EndIf
EndFunc


While 1
Switch GUIGetMsg()

Case $BTN1
If $BTN1 = True Then
Test1 ()
EndIf

Case $BTN2
If $BTN2 = True Then
Test2 ()
EndIf

Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

* i want to : after click on "$BTN 1" , "$Edit2" was hidden or 

after click on "$BTN 2" , "$Edit1" was hidden.

Edited by zxtnt09
Image

Share this post


Link to post
Share on other sites

zxtnt09,

Simple - just hide/show the edits as required:

#include <GUIConstantsEx.au3>

Global $MyForm, $BTN1, $BTN2, $Edit1, $Edit2

GUI()

While 1
    Switch GUIGetMsg()
        Case $BTN1
            GUICtrlSetState($Edit2, $GUI_HIDE)
            GUICtrlSetState($Edit1, $GUI_SHOW)
        Case $BTN2
            GUICtrlSetState($Edit1, $GUI_HIDE)
            GUICtrlSetState($Edit2, $GUI_SHOW)
        Case $GUI_EVENT_CLOSE
            ExitLoop

    EndSwitch

WEnd



Func GUI()
    $MyForm = GUICreate("My GUI edit", 500, 300, 100, 100)

    GUISetFont(12, 400, 0, "Tahoma")

    $Label1 = GUICtrlCreateLabel("Label 01 ", 0, 0, 50, 25)
    $Label1 = GUICtrlCreateLabel("Label 01 ", 0, 50, 50, 25)

    $BTN1 = GUICtrlCreateButton("BTN 1 ", 150, 0, 50, 25)
    $BTN2 = GUICtrlCreateButton("BTN 2", 150, 50, 50, 25)

    $Edit1 = GUICtrlCreateEdit("Edit 1", 0, 80, 200, 200)
    $Edit2 = GUICtrlCreateEdit("Edit 2", 200, 80, 200, 200)
    GUICtrlSetState($Edit2, $GUI_HIDE)

    GUISetState(@SW_SHOW)
EndFunc   ;==>GUI

And it is not good coding practice to declare Global variables inside functions - so I changed that too.

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

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

  • Similar Content

    • By XinYoung
      Greetings!
      I am in need of your guidance once again. I searched the forums for clicking in span, clicking by class, clicking without an ID or Name, etc., but I am unable to find a solution for my problem.
      I am trying to expand this tree in IE. There is an arrow ( > ) that i need to click, but I can't find a way to do it . Alternatively, I can double-click the text "Servers", but that seems to be even more troublesome. I will have to do this 2-3 more times as the tree expands.
      There appears to be an ID for the tree, simply called "tree", but that isn't working when I send a click to it.

      ;Open an IE session and navigate to pgAdmin. Global $oIE = _IECreate($pgAdmin) ;Maximize the IE window. WinSetState(_IEPropertyGet($oIE, "hwnd"), "", @SW_MAXIMIZE) Sleep(2000) ;Expand the tree $oTree = _IEGetObjById($oIE, "tree") _IEAction($oTree, "click") Any ideas?  
    • By XinYoung
      Quick question: How can I click this "Select All" button in IE? There's no ID, and the href is "#"  
      Am I looking at the wrong html code?
      Am I looking
      Thank you all in advance!
    • By lenclstr746
      <span class="fr66n"><button class="dCJp8 afkep coreSpriteHeartOpen _0mzm-"><span class="glyphsSpriteHeart__outline__24__grey_9 u-__7" aria-label="Beğen"></span></button></span>
      I want to click this button ?
    • By nooneclose
      Hello again, I am in phase two of my help bot. I cannot figure out how to properly code Autoit to click on a webpage button using the I.E UDF. I want to click on the button that I have attached as an image. This button does not have a name but it has an ID. Here is the HTML code for this button that I found using chromes developer inspector.
      HTML Code: 
      <img role="button" tabindex="-1" id="toolactions_INSERT-tbb_image" src="nav_icon_insertkey.gif" alt="New Work Order CTRL+ALT+I" draggable="false"> Here is the code that I have so far:
      ;******************************************************************************* ; Opens IE and fill out a New Workorder ;******************************************************************************* ; Start IE at the ** Tracking Application in ****** $oIE = _IECreate("https:I_am_Bound_by_my_company_to_not_reveal_this_webpage") ; Wait for a browser page load to complete _IELoadWait($oIE) Sleep(6000) ; Store the field names where the important data will be sent Local $nWorkOrderB = _IEGetObjById($oIE, "toolactions_INSERT-tbb_image") _IEAction($nWorkOrderB, "click")  I want my program to click on the button that looks like a piece of paper with a blue # 
      (For those wondering, I am allowed to send images just not the URL.) 
      As always any help would be appreciated. 

    • By Pike
      Hello Everyone,
      New Guy here. This is a two-part question, hopefully easy enough though. I know it's ugly coding, this is because I have only a couple hours worth of coding experience and could really use some help.
      1) When I single click the button I want one action (like playing a sound clip) and when I double click the button I want a different action (such as opening dialogue box to ask for soundclip directory address). At the bottom of the script I made a comment which one I would like single click versus double click.
      2) I can not get the FileOpenDialogue to save the file address to the config.ini file at the 'One' position on the .ini.
      #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <FileConstants.au3> #include <AutoItConstants.au3> #include <Sound.au3> Opt('MustDeclareVars', 1) Opt("GUIOnEventMode", 1) Global $OneID _Main() Func _Main() GUICreate("Form1", 156, 86, 281, 276) $OneID = GUICtrlCreateButton("Button", 15, 17, 122, 37) GUICtrlSetOnEvent($OneID, "OnOne") GUISetOnEvent($GUI_EVENT_CLOSE, "OnExit") GUISetState() While 1 While 1 Sleep(1000) WEnd WEnd EndFunc ;---------------Functions------------- While 1 Sleep(100) WEnd Func OnOne() ; ******************Single Click for this action**************** $OneID = IniRead("config.ini", "Config", "One", $OneID) If $OneID = True Then SoundPlay($OneID, @HotKeyPressed) Else ; *******Double Click for this action*****And Help Saving File Address to config.ini 'One'*********** $OneID = FileOpenDialog("Select file", @WorkingDir, "All (*.*)") IniWrite("config.ini", "Config", "One", $OneID) $OneID = InputBox("Enter Information", "Short Name for File?", "") IniWrite("config.ini", "Config", "NameOne", $OneID) EndIf EndFunc Any help would be greatly appreciated, and if you need anymore clarity as to what exactly I'm trying to do, please do not hesitate to ask. Thanks so much!
      Pike
×
×
  • Create New...