Jump to content

Search the Community

Showing results for tags 'Button'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

  1. Hey Guys, I want to add a new checkbox with its own variable every time the add button is clicked. The added checkboxes should remain when I close the window or exit the script and when I reopen I should be able to add new checkboxes aswell. here is what I have so far.. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <EditConstants.au3> #include <MsgBoxConstants.au3> #include <GuiButton.au3> $test = GUICreate("adding test", 475, 345, 500, 175) $Check1 = GUICtrlCreateCheckbox("Checkbox 1", 15, 25, 300, 25) $Button = GUICtrlCreateButton("Add", 365, 25, 90, 20) $Check2 = GUICtrlCreateCheckbox("Checkbox 2", 15, 50, 300, 25) $Check3 = GUICtrlCreateCheckbox("Checkbox 3", 15, 75, 300, 25) GUICtrlSetState($Check2, $GUI_HIDE) GUICtrlSetState($Check3, $GUI_HIDE) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ; Exit Case $Button GUICtrlSetPos($Check2, 15, 50, 300, 25) GUICtrlSetState($Check2, $GUI_SHOW) Case $Button GUICtrlSetPos($Check3, 15, 75, 300, 25) GUICtrlSetState($Check3, $GUI_SHOW) EndSwitch WEnd
  2. Hello Everyone, Hoping someone can help me, I am totally stuck on this problem, I cannot reach the textarea and the button in a maps page that I get by clicking on a button in a previus page, the only way I can interact with this is using tab and mouseclick but this is a danger method as you know. I get the handle by using: $Posizione = _IEAttach("Ricerca Indirizzo su mappa") then I tried a lot of things but nothing works, can someone give me a hint? -------------------- WinWait("Ricerca Indirizzo su mappa") sleep(1000) $Posizione = _IEAttach("Ricerca Indirizzo su mappa") WinSetState ("Ricerca Indirizzo su mappa", "", @SW_MAXIMIZE ) WinActivate("Ricerca Indirizzo su mappa") sleep(500) ;~ $oForm = _IEFormGetObjByName($Posizione, "form1");Punta il Form $oText = _IEFormElementGetObjByName($Posizione,"indirizzo") $oText = _IEFormElementGetObjByName($Posizione,"writeAddress") ;~ $LenteTestoMess = _IEFormElementGetValue($oText);Inserisce il PrimoRepertorio nella variabile ;~ _IELinkClickByText($Posizione, $oForm);Clicca su Aggiorna ed invia il form _IEFormElementSetValue ($oText,"via Ravenna 12" );Completamento campo testo ---------------------------------------------------- Mappa.odt Ricerca Indirizzo su mappa.htm
  3. Is there any better solution to check right Click on a button rather than that one? Since could be there 100`s keys to process. Topic is about to find out what is missing in AutoIT to handle contol ID`s of right Clicked Buttons amongst bunch of buttonkeys. #include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) $hGUI = GUICreate("Test", 300, 300) GUISetOnEvent($GUI_EVENT_CLOSE, "bye") GUISetOnEvent($GUI_EVENT_SECONDARYUP, "_SecondaryUp") global $cButton[9] for $x=1 to 3 $cButton[$x] = GUICtrlCreateButton("Check"&$x, 10, 10*($X*5), 80, 30) GUICtrlSetOnEvent(-1, "_Button") next $x+=1 $cButton[$x] = GUICtrlCreateButton("NoCheck", 10, 10*($X*5), 80, 30) GUISetState() While Sleep(10) WEnd Func _Button() $nTempId=GUICtrlRead(@GUI_CtrlId) ; can get ID from Left Clicked Button// $aCInfo = GUIGetCursorInfo($hGUI) MsgBox(0, "Pressed", "LEFT "&$nTempId&":"&GUICtrlRead($aCInfo[4]),.5) EndFunc Func _SecondaryUp() $aCInfo = GUIGetCursorInfo($hGUI) for $x=1 to 3 ; my solutionprocess slower.... If $aCInfo[4] = $cButton[$x] Then $nTempId=GUICtrlRead(@GUI_CtrlId) ;cannot get real ID, but last one. $nTempId2=GUICtrlRead($cButton[$x]) ;can get ID MsgBox(0, "Pressed", "RIGHT "&$nTempId&":<=? True= "&$nTempId2,1) EndIf next EndFunc Func bye() Exit EndFunc
  4. LAST VERSION - 0.2 03-Jan-15 Skin UDF allows you to create buttons from the predefined images (files, resources, etc.). I rewrote this library by using GDI+ (first version used GDI). This allowed add the many additional features and get rid of the problems related to the transparency. Nevertheless, the library has a beta status, so there is no detailed description of the functions. But I am sure that the example below gives complete information about the features of this library. I hope that many users will find it useful. If you will have any questions, please ask them in this thread. Available functions Skin Library v1.0 Skin.zip Example #Include <GUIConstantsEx.au3> #Include <Skin.au3> Global $Button[3] $hForm = GUICreate('MyGUI', 278, 106) GUICtrlCreatePic('background.bmp', 0, 0, 278, 106) GUICtrlSetState(-1, $GUI_DISABLE) ; Create buttons from PNG images (images should be located in the same folder as the script) $Button[0] = _Skin_AddButton(20 , 20, 66, 66, 'red_normal.png', 'red_hover.png', 'red_click.png', 'disable.png', 'alpha.png', 1) $Button[1] = _Skin_AddButton(106, 20, 66, 66, 'yellow_normal.png', 'yellow_hover.png', 'yellow_click.png', 'disable.png', 'alpha.png', 1) $Button[2] = _Skin_AddButton(192, 20, 66, 66, 'green_normal.png', 'green_hover.png', 'green_click.png', 'disable.png', 'alpha.png', 1) #cs ; Create buttons from GDI+ HBITMAP handles $Button[0] = _Skin_AddButtonEx(20 , 20, 64, 64, _GDIPlus_BitmapCreateFromFile('red_normal.png'), ..., 1, 1) $Button[1] = _Skin_AddButtonEx(104, 20, 64, 64, _GDIPlus_BitmapCreateFromFile('yellow_normal.png'), ..., 1, 1) $Button[2] = _Skin_AddButtonEx(188, 20, 64, 64, _GDIPlus_BitmapCreateFromFile('green_normal.png'), ..., 1, 1) #ce ; Disable "Yellow" button (Optional) _Skin_DisableButton($Button[1], 1) ; Enable keyboard input (Optional) _Skin_EnableKBInput(1) ; Set margins for dotted focus rectangle (Optional) For $i = 0 To 2 _Skin_SetFocusRect($Button[$i], 5, 5, 56, 56) Next ; Enable dotted focus rectangle (Optional) _Skin_EnableFocus(1) GUISetState() ; _Skin_Helper() must be called continuously in the main loop While 1 _Skin_Helper($hForm) $ID = GUIGetMsg() Switch $ID Case 0 ContinueLoop Case $GUI_EVENT_CLOSE ExitLoop Case $Button[0] ConsoleWrite('Red' & @CR) Case $Button[1] ConsoleWrite('Yellow' & @CR) Case $Button[2] ConsoleWrite('Green' & @CR) Case Else EndSwitch WEnd ; You must delete all created buttons before destroying the appropriate window ;~For $i = 0 To 2 ;~ _Skin_DeleteButton($Button[$i]) ;~Next
  5. Good morning, I am trying to align a two-line text in a button so that it would be centered in the button but can't succeed to do it for the vertical part. Can someone tell me what I do wrong ? Here is my code: $btn3 = GUICtrlCreateButton("Execute " & @LF & " file 1", 100, 65, 60, 50, _ BitOr($BS_CENTER,$BS_BOTTOM,$BS_MULTILINE)) and here is the resulting layout I get in my window. I tried to follow the help, made a lot of different parameter combinations (here it's `$BS_BOTTOM`, but I tried `$BS_VCENTER` and `$BS_TOP`), still get the same result : vertical alignement is a no go for me. Can someone help ? TIA Gilles
  6. Hey Everyone, I haven't been here in a while and recently picked up my old project. Still an FNG! To the point: I want to be able to push the button and either play an mp3, open a file, or open an exe program (all with the same button). The problem is that I don't know how to code for that at "case 1" Case 1 Local $sRead = IniRead("config.ini", "Config", "One", "Default") SoundPlay($sRead, @HotKeyPressed) <------------------------------- Run($sRead, @HotKeyPressed) <------------------------------- This 'Run' doesn't work even by itself! See code below for layout. If you need more information I will attach more code or answer any questions. Any help is greatly appreciated. Much Respect, Pike Func _HandleButton() $iClickCount += 1 $iTimer = TimerInit() AdlibRegister("CheckButtonPress", $CheckTime) EndFunc Func CheckButtonPress() If TimerDiff($iTimer) < $CheckTime Or $iTimer = 0 Then Return Switch $iClickCount Case 1 Local $sRead = IniRead("config.ini", "Config", "One", "Default") SoundPlay($sRead, @HotKeyPressed) Run($sRead, @HotKeyPressed) Case 2 MsgBox(0, "INFORMATION:", "Choose the file you want designated to this button") Local $sFileOpenDialog = FileOpenDialog(0, @ScriptDir & "\", "All (*.*)", $FD_FILEMUSTEXIST + $FD_MULTISELECT) If @error Then MsgBox($MB_SYSTEMMODAL, "", "No file(s) were selected.") EndIf Local $sFileName = InputBox("INFORMATION:", "Please Name Your File?" & @CRLF _ & @CRLF _ & "6 Characters or Less", "") IniWrite(@ScriptDir & "\config.ini", "Config", "One", $sFileOpenDialog) IniWrite(@ScriptDir & "\config.ini", "Config", "NameOne", $sFileName) EndSwitch $iClickCount = 0 AdlibUnRegister() EndFunc
  7. Hi! I am writing some GUI and i need to use images as buttons, but with text on them (text is from INI file). Part with button looks like this: $ankieta1 = GUICtrlCreateButton($txtAnk1, 100,350,765,164) GUICtrlSetFont(-1, 22, 800, -1, "Arial") ;GUICtrlSetColor(-1,0xffffff) $hImageBtn_1 = _GUIImageList_Create(765, 164) _GUIImageList_AddBitmap($hImageBtn_1, "c:\path\to\ankieta_clean.bmp") _GUICtrlButton_SetImageList($ankieta1, $hImageBtn_1, 4) GUICtrlSetOnEvent(-1, "On_Ankieta1") The problem - if i uncomment GUICtrlSetColor, color of text changes, but button is just plain gray (no image). How i can change text color not touching image on a button here?
  8. 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!
  9. Hello again I need to click this Submit button, but it's in a lightbox and has no ID (i think) and I can't figure out a way to target it. _IEFormSubmit doesn't work. Thank you
  10. 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.
  11. How to click this button ? I Try func test () $oCorrectObj = "" $tags = $oIE.document.GetElementsByTagName("button") For $tag in $tags $class_value = $tag.GetAttribute("type") If string($class_value) = "buttont" Then $oCorrectObj = $tag MsgBox(0, "Level: ", "Level found :)") Else MsgBox(16, "Failed", "Not found.") ExitLoop EndIf Next If IsObj ( $oCorrectObj ) Then _IEAction ($oCorrectObj, "click") EndIF and func klik () Local $oFound = "" Local $oBtns = _IETagNameGetCollection($oIE, "span") For $oBtn In $oBtns If String($oBtn.classname) = "yt-uix-button-content" Then $oFound = $oBtn EndIf Next _IEAction ($oFound, "click") EndFunc Please Help Can you click it by name?
  12. i guys , like title anyone have idea if is possible , and if yes if have example to post ? i find in forum and in google but i dont know how can start to create button with icon over toolbar near clock or is goog before language layout . sorry i not post any script but i dont know where to start thankz at all
  13. Hmmm i am sorry i had simular problem but i cant find back post. How to hide a gui button ? I Want to dodge the variable non déclaréd when i make button in if statment thx before
  14. 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
  15. Hi all, I have a button created with _GUICtrlButton_Create function. I know that this function returns a handle of button instead of an ID. So i have obtain control ID by calling _WinAPI_GetDlgCtrlID function. After that i have tried the GUICtrlSetBkColor function. But it didnt worked. Any suggestions will be appreciated. Thanks in advance. Note : - The window which carries this button is not created with native gui create function. Instead, it is created with CreateWindowEx api function.
  16. I'm trying to click a button on a web page. I have added a couple of MsgBox lines to allow me to watch what happens on the page. As you can see the first half of my script enters data into text boxes on the page. I have no problem there. I just cannot click on the region buttons. The "set focus" line causes an outline to appear around the EU button and the "click button" line causes the "Pick a Region" text to disappear. Here is the code I have so far. #include <IE.au3> Local $oIE = _IECreate("http://questchecker.com/") Local $iQuestID = "123456" Local $sCharacterName = "CharacterName" Local $colForms = _IEFormGetCollection($oIE) $iCount = 0 For $oForm In $colForms $oFormElements = _IEFormElementGetCollection($oForm) For $oFormElement In $oFormElements $iCount = $iCount + 1 Local $sTagName = StringLower($oFormElement.tagName) Local $sElementType = $oFormElement.type Local $sElementName = $oFormElement.name Switch $iCount Case 6 _IEFormElementSetValue($oFormElement, "MyRealm", 0) ; realm Case 7 _IEFormElementSetValue($oFormElement, $sCharacterName, 0) Case 8 _IEFormElementSetValue($oFormElement, $iQuestID, 0) EndSwitch Next Next Local $oButtons = _IEGetObjByName($oIE, "questForm") For $oButton In $oButtons If _IEFormElementGetValue($oButton) = "US" Then MsgBox(0, "", "Click Okay to set focus") _IEAction($oButton, "focus") MsgBox(0, "", "Click Okay to click button") _IEAction($oButton, "click") ExitLoop EndIf Next MsgBox(0, "", "Click Okay to quit") _IEQuit($oIE) Exit
  17. Hello Forum, As said in the title, I'm searching a way to disable all tabstops in a GUI. My GUI includes 15 buttons and 3 edit controls. My questions: - is there a way to disable all tabstops at a time - is there a way to list all controls of a GUI and then disable tabstops one by one - or should I use the following line after each button creation: _WinAPI_SetWindowLong(GUICtrlGetHandle(-1), $GWL_STYLE, BitAND(_WinAPI_GetWindowLong(GUICtrlGetHandle(-1), $GWL_STYLE), BitNOT($WS_TABSTOP))) Thanks in advance for your valuable help! Thoms Edit: or maybe disable TAB key? I don't remember how to do!
  18. Hello, I need this for a project and I don't find a method for the next problem. I want when I click a button to create a variable ("$variable1") so if I press one more time to create one more ("$variable2") and create more and more how many times you press the button. Do you have an idea ? Thank you for your attention !
  19. Hello. We work with the BMC Remedy site to manage incidents and would like to automate the processes of clicking through this button code: <a href="javascript:" class="btn btn3d menu" style="top:21; left:184; width:21; height:21;"> <img class="btnimg" src="../../../../resources/images/mt_sprites.gif" alt="menu category issue" title=""> </a> I use firefox with mozrepl and autoit with include FF.au3 I need your help I read the topic https://www.autoitscript.com/forum/topic/95595-ffau3-v0601b-10/ but I could not run the code from the listed commands ... It is necessary to press the button and from the list of the menu of cahorsations to select the item = "zone of trust abonent" Screen # 1 http://joxi.ru/52aJK7bh4a7ypA or below. 1) Press button <a href="javascript:" class="btn btn3d menu" style="top:21; left:184; width:21; height:21;"> <img class="btnimg" src="../../../../resources/images/mt_sprites.gif" alt="menu category issue" title=""> </a> 2) After pressing the button, I need to choose in this menu of 4 items to select an item called "zone of trust abonent", Screen # 2 - http://joxi.ru/p27gwQKHo71VQ2 html code table items <table class="MenuTable" cellpadding="0" cellspacing="0" style="width: 179px;"> <tbody class="MenuTableBody"> <tr class="MenuTableRow"> <td class="MenuEntryName" nowrap="">zone of trust abonent</td> <td class="MenuEntryNoSub" arvalue="zone of trust abonent"></td> </tr> <tr class="MenuTableRow"><td class="MenuEntryName" nowrap="">zone of trust operator</td> <td class="MenuEntryNoSub" arvalue="zone of trust operator"></td> </tr> <tr class="MenuTableRow"><td class="MenuEntryName" nowrap="">zone of trust third operator</td> <td class="MenuEntryNoSub" arvalue="zone of trust third operator"></td></tr> <tr class="MenuTableRow"><td class="MenuEntryNameHover" nowrap="">No settings</td> <td class="MenuEntryNoSubHover" arvalue="No settings"></td> </tr> </tbody> </table> More in detail, I choose from the menu item "zone of trust abonent" Screen # 3 - http://joxi.ru/GrqVq4ZIQEPW4m 3) The choice is made, Screen # 4 http://joxi.ru/v297w6aC3PovLr <textarea class="text sr " wrap="off" id="arid_WIN_0_1000002488" cols="20" maxlen="60" style="top:21; left:0; width:179; height:21;" armenu="CFG:PRC:CategoryHPD-Res-T1-Q" mstyle="2" arautoc="1" arautocmb="1" arautocak="0" arautoctt="400" rows="1"> </textarea> It's all. I would be very grateful to you =) !!!!!!!!!! Here are more detailed codes in the attachment. button1.txt menu - table.txt all.txt
  20. I create message box but i dont know how to add button action when i click it. Help for : Add script for Button : Left, Right, Right Finger example when i press Left finger button do Case $idNotepad $iPID = WinActivate ( " :PS :: Version - 2.8.0.0 - [eFS Bill]") ControlSend(" :DS - eF :: Version - 2.8.0.0 - [eF Bill]", "", "[NAME:btnReset]", "{esc}") ControlClick ( " :DS - eF :: Version - 2.8.0.0 - [eF Bill]", "", "[NAME:txtrdNo]") ControlSend(" :DS - eF:: Version - 2.8.0.0 - [eF Bill]", "", "[NAME:txtrdNo]", "^v") ControlSend(" :DS - eF :: Version - 2.8.0.0 - [eF Bill]", "", "[NAME:txtrdNo]", "{enter}") How to add like above ? sorry for my bad english
  21. Hello everyone I would like to have some help regarding my issue. I am trying to extract some information from excel sheet, I use _Excel_RangeFind then I get the array for the value then I check the array. In case the array is true the next will be to get some information based on the extracted array if no array because the value is not found it gives a messages box that the value is not found. My problem that the button works for one time only if i tried any value which exist in the sheet it gives me that value not found. I suspect that there is a problem regarding While loop. here is my code #include <GUIConstantsEx.au3> #include <WinAPI.au3> #Include <GuiListBox.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <Excel.au3> #include <MsgBoxConstants.au3> #include <ExcelConstants.au3> if FileExists ("result.txt") Then Sleep (100) Else readxl() EndIf Global $oExcel = _Excel_Open(False,False) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeFind Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Global $oWorkbook = _Excel_BookOpen($oExcel, "D:\info.xlsx",False,False) If @error Then MsgBox($MB_SYSTEMMODAL, "Excel Error", "Error opening workbook '" & $oWorkbook & @CRLF & "@error = " & @error & ", @extended = " & @extended) _Excel_Close($oExcel) Exit EndIf Local $lab1 = _Excel_RangeRead($oWorkbook, Default,"B1") Local $lab2 = _Excel_RangeRead($oWorkbook, Default,"C1") Local $lab3 = _Excel_RangeRead($oWorkbook, Default,"D1") Local $lab4 = _Excel_RangeRead($oWorkbook, Default,"E1") Global $sResult1,$sResult2,$sResult3,$sResult4,$sResult5,$sResult6 Global $asKeyWords = stringsplit (FileRead (@ScriptDir & "\result.txt"),@CRLF) Global Const $xlUp = -4162 ;~ _Main() Local $hGUI, $hList, $hInput, $aSelected, $sChosen, $hUP, $hDOWN, $hENTER, $hESC Local $sCurrInput = "", $aCurrSelected[2] = [-1, -1], $iCurrIndex = -1, $hListGUI = -1 $hGUI = GUICreate("Rimo System", 253, 270, 192, 124) Global $hInput = GUICtrlCreateInput("", 24, 48, 169, 21) Global $Label1 = GUICtrlCreateLabel("Rimo System", 80, 16, 150, 25) GUICtrlSetFont(-1, 14, 800, 0, "MS Serif") Global $Input2 = GUICtrlCreateInput("", 72, 144, 161, 21) Global $Input3 = GUICtrlCreateInput("", 72, 176, 161, 21) Global $Input4 = GUICtrlCreateInput("", 72, 208, 161, 21) Global $Input5 = GUICtrlCreateInput("", 72, 240, 161, 21) $Input6 = GUICtrlCreateInput("", 72, 272, 161, 21) $Input7 = GUICtrlCreateInput("", 72, 304, 161, 21) $Button1 = GUICtrlCreateButton("Get Info", 72, 88, 89, 33) $Label2 = GUICtrlCreateLabel("Label2", 16, 144, 36, 17) GUICtrlSetData( -1,$lab1) $Label3 = GUICtrlCreateLabel("Label3", 16, 176, 36, 17) GUICtrlSetData( -1,$lab2) $Label4 = GUICtrlCreateLabel("Label4", 16, 208, 36, 17) GUICtrlSetData( -1,$lab3) $Label5 = GUICtrlCreateLabel("Label5", 16, 240, 36, 17) GUICtrlSetData( -1,$lab4) $Label6 = GUICtrlCreateLabel("", 16, 272, 36, 17) $Label7 = GUICtrlCreateLabel("", 16, 304, 36, 17) $Button2 = GUICtrlCreateButton("Cancel", 112, 416, 121, 25) GUISetState(@SW_SHOW, $hGUI) Global $sSearch = guictrlread ($hInput) $hUP = GUICtrlCreateDummy() $hDOWN = GUICtrlCreateDummy() $hENTER = GUICtrlCreateDummy() $hESC = GUICtrlCreateDummy() Dim $AccelKeys[4][2] = [["{UP}", $hUP], ["{DOWN}", $hDOWN], ["{ENTER}", $hENTER], ["{ESC}", $hESC]] GUISetAccelerators($AccelKeys) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $Button2 Exit Case $Button1 Global $aResult = _Excel_RangeFind($oWorkbook, guictrlread($hInput) ,"A2:A2000") Global $aExtract = _ArrayExtract($aResult, 0, 0, 2, 2) if _elementExists($aExtract,0) Then getdata() Else MsgBox(0,"","Value Does Not Exist") EndIf Case $hESC If $hListGUI <> -1 Then ; List is visible. GUIDelete($hListGUI) $hListGUI = -1 Else ExitLoop EndIf Case $hUP If $hListGUI <> -1 Then ; List is visible. $iCurrIndex -= 1 If $iCurrIndex < 0 Then $iCurrIndex = 0 EndIf _GUICtrlListBox_SetCurSel($hList, $iCurrIndex) EndIf Case $hDOWN If $hListGUI <> -1 Then ; List is visible. $iCurrIndex += 1 If $iCurrIndex > _GUICtrlListBox_GetCount($hList) - 1 Then $iCurrIndex = _GUICtrlListBox_GetCount($hList) - 1 EndIf _GUICtrlListBox_SetCurSel($hList, $iCurrIndex) EndIf Case $hENTER If $hListGUI <> -1 And $iCurrIndex <> -1 Then ; List is visible and a item is selected. $sChosen = _GUICtrlListBox_GetText($hList, $iCurrIndex) EndIf Case $hList $sChosen = GUICtrlRead($hList) EndSwitch Sleep(10) $aSelected = _GetSelectionPointers($hInput) If GUICtrlRead($hInput) <> $sCurrInput Or $aSelected[1] <> $aCurrSelected[1] Then ; Input content or pointer are changed. $sCurrInput = GUICtrlRead($hInput) $aCurrSelected = $aSelected ; Get pointers of the string to replace. $iCurrIndex = -1 If $hListGUI <> -1 Then ; List is visible. GUIDelete($hListGUI) $hListGUI = -1 EndIf $hList = _PopupSelector($hGUI, $hListGUI, _CheckInputText($sCurrInput, $aCurrSelected)) ; ByRef $hListGUI, $aCurrSelected. EndIf If $sChosen <> "" Then GUICtrlSendMsg($hInput, 0x00B1, $aCurrSelected[0], $aCurrSelected[1]) ; $EM_SETSEL. _InsertText($hInput, $sChosen) $sCurrInput = GUICtrlRead($hInput) GUIDelete($hListGUI) $hListGUI = -1 $sChosen = "" EndIf WEnd GUIDelete($hGUI) Func _CheckInputText($sCurrInput, ByRef $aSelected) Local $sPartialData = "" If (IsArray($aSelected)) And ($aSelected[0] <= $aSelected[1]) Then Local $aSplit = StringSplit(StringLeft($sCurrInput, $aSelected[0]), " ") $aSelected[0] -= StringLen($aSplit[$aSplit[0]]) If $aSplit[$aSplit[0]] <> "" Then For $A = 1 To $asKeyWords[0] If StringLeft($asKeyWords[$A], StringLen($aSplit[$aSplit[0]])) = $aSplit[$aSplit[0]] And $asKeyWords[$A] <> $aSplit[$aSplit[0]] Then $sPartialData &= $asKeyWords[$A] & "|" EndIf Next EndIf EndIf Return $sPartialData EndFunc ;==>_CheckInputText Func _PopupSelector($hMainGUI, ByRef $hListGUI, $sCurr_List) Local $hList = -1 If $sCurr_List = "" Then Return $hList EndIf $hListGUI = GUICreate("", 280, 160, 23, 62, $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST, $WS_EX_MDICHILD), $hMainGUI) $hList = GUICtrlCreateList("", 0, 0, 170, 150, BitOR(0x00100000, 0x00200000)) GUICtrlSetData($hList, $sCurr_List) GUISetControlsVisible($hListGUI) ; To Make Control Visible And Window Invisible. GUISetState(@SW_SHOWNOACTIVATE, $hListGUI) Return $hList EndFunc ;==>_PopupSelector Func _InsertText(ByRef $hEdit, $sString) #cs Description: Insert A Text In A Control. Returns: Nothing #ce Local $aSelected = _GetSelectionPointers($hEdit) GUICtrlSetData($hEdit, StringLeft(GUICtrlRead($hEdit), $aSelected[0]) & $sString & StringTrimLeft(GUICtrlRead($hEdit), $aSelected[1])) Local $iCursorPlace = StringLen(StringLeft(GUICtrlRead($hEdit), $aSelected[0]) & $sString) GUICtrlSendMsg($hEdit, 0x00B1, $iCursorPlace, $iCursorPlace) ; $EM_SETSEL. EndFunc ;==>_InsertText Func _GetSelectionPointers($hEdit) Local $aReturn[2] = [0, 0] Local $aSelected = GUICtrlRecvMsg($hEdit, 0x00B0) ; $EM_GETSEL. If IsArray($aSelected) Then $aReturn[0] = $aSelected[0] $aReturn[1] = $aSelected[1] EndIf Return $aReturn EndFunc ;==>_GetSelectionPointers Func GUISetControlsVisible($hWnd) ; By Melba23. Local $aControlGetPos = 0, $hCreateRect = 0, $hRectRgn = _WinAPI_CreateRectRgn(0, 0, 0, 0) Local $iLastControlID = _WinAPI_GetDlgCtrlID(GUICtrlGetHandle(-1)) For $i = 3 To $iLastControlID $aControlGetPos = ControlGetPos($hWnd, '', $i) If IsArray($aControlGetPos) = 0 Then ContinueLoop $hCreateRect = _WinAPI_CreateRectRgn($aControlGetPos[0], $aControlGetPos[1], $aControlGetPos[0] + $aControlGetPos[2], $aControlGetPos[1] + $aControlGetPos[3]) _WinAPI_CombineRgn($hRectRgn, $hCreateRect, $hRectRgn, 2) _WinAPI_DeleteObject($hCreateRect) Next _WinAPI_SetWindowRgn($hWnd, $hRectRgn, True) _WinAPI_DeleteObject($hRectRgn) EndFunc Func _elementExists($array, $element) If $element > UBound($array)-1 Then Return False ; element is out of the array bounds Return True ; element is in array bounds EndFunc Func getdata() ;~ Local $sResult1 = _Excel_RangeRead($oWorkbook, Default,StringReplace(StringReplace ($aExtract[0],"$",""),"A","B")) ;~ Local $sResult2 = _Excel_RangeRead($oWorkbook, Default,StringReplace(StringReplace ($aExtract[0],"$",""),"A","C")) ;~ Local $sResult3 = _Excel_RangeRead($oWorkbook, Default,StringReplace(StringReplace ($aExtract[0],"$",""),"A","D")) ;~ Local $sResult4 = _Excel_RangeRead($oWorkbook, Default,StringReplace(StringReplace ($aExtract[0],"$",""),"A","E")) ;~ Local $sResult5 = _Excel_RangeRead($oWorkbook, Default,StringReplace(StringReplace ($aExtract[0],"$",""),"A","F")) ;~ Local $sResult6 = _Excel_RangeRead($oWorkbook, Default,StringReplace(StringReplace ($aExtract[0],"$",""),"A","G")) guictrlsetdata($Input2,$sResult1) guictrlsetdata($Input3,$sResult2) guictrlsetdata($Input4,$sResult3) guictrlsetdata($Input5,$sResult4) guictrlsetdata($Input6,$sResult5) guictrlsetdata($Input7,$sResult6) _Excel_Close($oExcel,Default,True) EndFunc Func readxl() Global $oExcel = _Excel_Open(False,False) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeFind Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Global $oWorkbook = _Excel_BookOpen($oExcel, "D:\info.xlsx",False,False) LOcal Const $xlUp = -4162 With $oWorkbook.ActiveSheet ; process active sheet $oRangeLast = .UsedRange.SpecialCells($xlCellTypeLastCell) ; get a Range that contains the last used cells $iRowCount = .Range(.Cells(1, 1), .Cells($oRangeLast.Row, $oRangeLast.Column)).Rows.Count ; get the the row count for the range starting in row/column 1 and ending at the last used row/column $iLastCell = .Cells($iRowCount + 1, "B").End($xlUp).Row ProgressOn("Copying Cells", "Copying Cells progress", "0%") For $i = 2 to $iLastCell Local $total = Int(($i/$iLastCell)*100) Local $sResult3 = _Excel_RangeRead($oWorkbook, Default, "A" & $i) FileWriteLine("result.txt",$sResult3) ProgressSet(($i/$iLastCell)*100, $total & "%") Next ;~ FileWrite("result.txt",$sResult3) ProgressSet(100, "Done", "Complete") Sleep (1500) ProgressOff() _Excel_Close($oExcel,Default,True) EndWith EndFunc
  22. Okey guys , here's the thing, My script is running fine, but when it's already running i cant turn it off or pause by clicking the on/off button unless i manually close it on my taskbar. What i wanted to happen is "if i click the ($switch = turn On and Off Button) to Off the script will STOP Running but not closing the entire GUI because i tried to use Exit and ExitLoop but it closes the entire GUI. and i don't want that to happen. BTW. I'm new in AutoIT and practice scripting hope somebody could help me Godbless. feel free to view my script Practice.au3
  23. <input name="VsMasterPage$MainContent$LoginUserControl$LoginForm$FormsAuthLoginContainer$LoginButton$InternalButton" class="Button" id="VsMasterPage_MainContent_LoginUserControl_LoginForm_FormsAuthLoginContainer_LoginButton_InternalButton" onclick='javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("VsMasterPage$MainContent$LoginUserControl$LoginForm$FormsAuthLoginContainer$LoginButton$InternalButton", "", true, "Login", "", false, false))' type="submit" value="Sign In"> I am trying to click the sign in button on this page. I have tried by class, text, etc Here was my last attempt $oButtons = _IETagNameAllGetCollection($o_IE, "button") For $oButton in $oButtons If String($oButton.value) = "Sign In" Then Sleep (1000) _IEAction($oButton, "click") ExitLoop EndIf Next This did not work either.
  24. Basically I'm trying to figure out what would be the most efficient means of making multiple use buttons. What I'd like is to be able to click a button and pop up a msgbox to gather some info, or two message boxes, but upon entering that info and the msgbox dialogue being over, it'll then switch to a different function. I was thinking of using 1/0 to designate which is true or not, but not sure if that'd be the most efficient way. Still very new to coding, and autoit, any help would be great!
  25. I want creat GUI, have button 1 to 10, but only use loop for ... to ... step ... next. Thanks.
×
×
  • Create New...