Jump to content
AndyS19

Implement search popup with multiple controls

Recommended Posts

AndyS19

I'm trying to implement a Ctl-F popup box that looks something like the one that Notepad uses, but I'm not havine much luck.  I intend to get it working, then beef up the popup's contents to add several checkboxes, buttons and radio boxes.
What my example code does is to use InputBox(), but that's not what I want.
Here is my test code:

#include <Array.au3>
#include <GUIConstantsEx.au3>

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
Opt("GUICloseOnESC", 1)
Opt("GUIOnEventMode", 1)
Opt('MustDeclareVars', 1)
OnAutoItExitRegister("ExitStageLeft")
Opt("WinTitleMatchMode", -2)

Global $hGUI

_Main()

Func _Main()

    $hGUI = GUICreate("Test ^F", 300, 200)

    setupSpecialKeysHandlers()

    GUISetOnEvent($GUI_EVENT_CLOSE, "Event_GUIClose")

    GUISetState()

    While (1)
        Sleep(157)
    WEnd
EndFunc   ;==>_Main

Func handle_CTRL_F_key()
    Local $str

    $str = InputBox("Search", "Enter the string to search for:")
    ConsoleWrite("+++: $str ==>" & $str & "<==" & @CRLF)

EndFunc   ;==>handle_CTRL_F_key

Func ExitStageLeft()
    Exit (99)
EndFunc   ;==>ExitStageLeft

Func Event_GUIClose()
    Exit (1)
EndFunc   ;==>Event_GUIClose

Func setupSpecialKeysHandlers()
    Local $ar, $parts, $key, $handler, $id
    Local $aAccelKeys[1][2]

    ; Create a table of Special keys and their handlers
    $ar = StringSplit("", "")
    _ArrayAdd($ar, "^f - handle_CTRL_F_key ")
    ReDim $aAccelKeys[UBound($ar) - 1][2]

    ; Now, create $aAccelKeys array with the table data.
    ; For each entry, create a Dummy GUI and associate its
    ; ID with the special key.
    For $ndx = 1 To UBound($ar) - 1
        $parts = StringSplit($ar[$ndx], "-", 2)
        $key = StringStripWS($parts[0], 8)
        $handler = StringStripWS($parts[1], 8)
        $id = GUICtrlCreateDummy()

        $aAccelKeys[$ndx - 1][0] = $key
        $aAccelKeys[$ndx - 1][1] = $id
        GUICtrlSetOnEvent($id, $handler)
    Next

    GUISetAccelerators($aAccelKeys) ; Setup the Special keys hooks
EndFunc   ;==>setupSpecialKeysHandlers

 

Share this post


Link to post
Share on other sites
JLogan3o13

So what is your question? You have identified the problem; an inputbox is an inputbox, you need to create a child gui


√-1 2^3 ∑ π, and it was delicious!

How to get your question answered on this forum!

Share this post


Link to post
Share on other sites
AndyS19

Isn't there a UDF somewhere that does a ^F popup?  I'm not looking to re-invent the wheel here.  There must be an example code where someone already did this.

 

Share this post


Link to post
Share on other sites
careca

Maybe someone did it, but if you do it, you'll learn a lot. Try something and post back issues you may have.


Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites
AndyS01

I got it working using InputBox, but I have to set the search restrictions (lettercase, wrap, history, .etc) on my main GUI.  I really want them on the InputBox control (see ^F popup in Notepad and in the AutoIT editor).

Share this post


Link to post
Share on other sites
careca

Maybe what you really need is to create a gui just for the search and then put an editbox

GUICtrlCreateEdit, then in the main loop keep reading the contents and change accordingly..


Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

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

    • nooneclose
      By nooneclose
      I need to send a string of text to this popup and click on the ok button to save it.
      Here is the code I have so far:
      ;Start IE Sleep(7000) $oIE = _IECreate("http://www.google.com") Sleep(500) _IELoadWait($oIE) $hIE = _IEPropertyGet($oIE, "hwnd") ; Get Handle of the IE window Sleep(500) WinSetState($hIE, "", @SW_MAXIMIZE) ;Wait for a browser page load to complete Sleep(3000) _IENavigate($oIE, "https://properURL.com") Sleep(8000) _IELoadWait($oIE) ;Attach to a browser control embedded in another window $oIE = _IEAttach("https://"properURL.com", url") ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $oIE = ' & $oIE & @CRLF & '>Error code: ' & @error & ' Extended code: 0x' & Hex(@extended) & @CRLF) ;### Debug Console Sleep(2000) ;Get the title of the webpage ;Local $wTitle = _IEPropertyGet($oIE, "title") ;MsgBox($MB_SYSTEMMODAL, "Webpage title:", $wTitle) ;Clicks the new button Sleep(3000) _IEAction($nWorkOrderB, "focus") _IEAction($nWorkOrderB, "click") Sleep(5000) ;Store the Element names where the important data will be sent ;Store the long description button Local $wLongDButton = _IEGetObjById($oIE, "m65d795a4-img") ;Store the long Description field id Local $wComments = _IEGetObjById($oIE, "ma6499a9c-rte_iframe") ;Store the ok button id that is in the long description Local $wCommOk = _IEGetObjById($oIE, "m74031266-pb") ;******************************************************************************* ; Send the stored data to the proper field ;******************************************************************************* ;Click the long description button Sleep(300) _IEAction($wLongDButton, "focus") _IEAction($wLongDButton, "click") Sleep(300) ;Sends the Comments Sleep(500) _IEAction($wComments, "focus") _IEAction($wComments, "click") Sleep(500) _IEFormElementSetValue($wComments, "hello darkness my old friend") ;Click the ok button Sleep(500) _IEAction($wCommOk, "focus") _IEAction($wCommOk, "click") Sleep(500)  
      Here is the popup:

    • nooneclose
      By nooneclose
      My program has to first search for names in Column D that do not match up with column C. I got that search to work using arrays. It was slow and I could not figure out how to delete them so I just manually put coded the names that do not belong. I found their cell location but I do not know how to store that location and delete it.
      This is what I have so far.
      Local $NameToDelete1[6]  = _Excel_RangeFind($OpenWorkbook, "Smith, Bill") _ArrayDisplay($NameToDelete1, "Excel UDF: _Excel_RangeFind Example 1", "", 0, "|", "Sheet|Name|Cell|Value|Formula|Comment") _Excel_RangeDelete($OpenWorkbook.ActiveSheet, $NameToDelete1[2], $xlShiftUp)  
      Please help, I wanted to have this program done yesterday but I did not see this problem until yesterday. 
    • Atoxis
      By Atoxis
      Howdy, I've gone through a lot of au3 forums, and I once had a working Imagesearch script that I got from here.  However, and i'm just totally not sure how but my imagesearch scripts aren't working anymore.
      I'm not new to au3 but i'm not the most experienced with it's syntax/commands.

      Anyways, I've looked over the big threads involving imagesearch.

      Does anyone have a working Imagesearch x64 for win10 that is currently working as of the date with the post.

      Dll's and what not is fine, just when I tell the script to run, I want to be able to find the image on the screen!
      Can't find a working copy so if anyone has one please send it my way lol.

      I've taken all the imagesearch downloads and what not and have played with them but I can't get any of them working on my end, despite others saying they're working.
      Thanks.
    • help_me_please
      By help_me_please
      Hello forum world,
      I am having an issue with a popup window displaying after selecting something using the ControlCommand( ) function.
      I am able to select the desired item from the dropdown list using the control command function but a popup window opens immediately after, not allowing the control command function to finish.
      Such as:
      ConsoleWrite("Before ControlCommand" & @CRLF)
      ControlCommand($Win_Name, "", $ID, "SelectString", $DropItemName)
      ConsoleWrite("After ControlCommand" & @CRLF)
       
      ^^^^
      So in the console I can get the "Before...", then the ControlCommand executes the selection of the dropdown menu.  Popup window opens
      But since there is a popup, I can not get the "After..." statement to write to the console. 
      This is where I am stuck, as I can not execute another command to close the popup window.
       
      Send help, oh gracious autoit forum.  
    • lenclstr746
      By lenclstr746
      HELLO GUYS
      I'm a work on a background see and click bot project 
      I can complete it if your help me
      (using imagesearch , gdi+ and  fastfind)
×