Jump to content

PartyPooper

Active Members
  • Posts

    680
  • Joined

  • Last visited

Profile Information

  • Location
    Australia
  • Interests
    Beer, Motorcycles and Computers

Recent Profile Visitors

802 profile views

PartyPooper's Achievements

Universalist

Universalist (7/7)

0

Reputation

  1. Thanks Sahsanu, I wouldn't have believed it could be done in 4 lines
  2. Is it possible to extract the version number from the following webpage? http://forum.rustoxide.com/resources/rustrcon-admin-tool-32-bit.434/ What I'm looking for is a way to consistently extract the version string (currently '2014.3.7.3762'). Sorry, I can't provide a function example because I have no idea on where to begin having never interacted with styled webpages before. I haven't been able to find a UDF in the Help file that finds a particular line in a webpage (at least not yet). I was thinking about putting the entire page into an array after removing all whitespace and simply searching for the array index that contains <h1>RustRCON Admin Tool (32 bit) <span class="muted">, however, I don't know if this is the right (or even correct) method to use. Pointers would be appreciated.
  3. Melba23, I have a resizable gui with an edit control inserted into a tab (it's for displaying chat which may go over several lines depending on how wide the GUI is at the time). I was wondering if your stringsize UDF could be used to help me format the chat into columns. Essentially, this is what I am looking for (picture tabs in place of spaces): Time Username Line of chat Time Longer Username Line of chat that user types continuation of line of chat even more chat. Time Username Another line of chat Currently, I have the above working in my edit but the chat is formatted for one particular width of edit box. Unfortunately, if a user resizes the gui, the chat width doesn't change and it begins to look stupid. I was hoping your stringsize UDF would give me an idea as to how many words I could fit on the rest of the line. P.S. forgot to mention, edit box has a vertical scroll bar so I need to account for that as well P.P.S. thought about using _GUICtrlRichEdit which allows coloring and formatting but it doesn't resize in a tab properly using GUICtrlSetResizing Nevermind, going to use RichEdit as I found an easy way to resize the richedit without a lot of maths (it's surrounded by a group control so I will base resize off that).
  4. Nevermind, wrong command... should be ControlHide/ControlShow rather than GUISetState.
  5. I borrowed the example above and can't seem to understand why is this not working as it should. I followed the instructions in the wiki in regards to hiding UDF controls when used on an internal Tab, but it still bleeds through. #include <GUIConstantsEx.au3> #include <GuiRichEdit.au3> #include <GuiTab.au3> #include <WindowsConstants.au3> #include <GuiStatusBar.au3> #include <GuiEdit.au3> #include <misc.au3> #include <GuiRichEdit.au3> Opt('MustDeclareVars', 1) Example() Func Example() Global $tab, $tab0, $tab0OK, $tab0input Global $tab1, $tab1combo, $tab1OK Global $tab2, $tab2OK, $msg Global $hRichEdit, $hGui $hGui = GUICreate("My GUI Tab", 250, 150); will create a dialog box that when displayed is centered GUISetBkColor(0x00E0FFFF) GUISetFont(9, 300) $tab = GUICtrlCreateTab(10, 10, 200, 100) $tab0 = GUICtrlCreateTabItem("tab0") ; GUICtrlCreateLabel("label0", 30, 80, 50, 20) ; $tab0OK = GUICtrlCreateButton("OK0", 20, 50, 50, 20) ; $tab0input = GUICtrlCreateInput("default", 80, 50, 70, 20) $hRichEdit = _GUICtrlRichEdit_Create($hGui, "ss", 80, 50, 70, 20, BitOR($ES_MULTILINE, $WS_VSCROLL)) $tab1 = GUICtrlCreateTabItem("tab----1") GUICtrlCreateLabel("label1", 30, 80, 50, 20) $tab1combo = GUICtrlCreateCombo("", 20, 50, 60, 120) GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo", "Jon"); default Jon $tab1OK = GUICtrlCreateButton("OK1", 80, 50, 50, 20) $tab2 = GUICtrlCreateTabItem("tab2") GUICtrlSetState(-1, $GUI_SHOW); will be display first GUICtrlCreateLabel("labeqqqql2", 30, 80, 50, 20) $tab2OK = GUICtrlCreateButton("OK2", 140, 50, 50) GUICtrlCreateTabItem(""); end tabitem definition GUICtrlCreateLabel("Click on tab and see the title", 20, 130, 250, 20) GUISetState() ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $tab Then ; display the clicked tab WinSetTitle("My GUI Tab", "", "My GUI Tab" & GUICtrlRead($tab)) If _GUICtrlTab_GetCurSel($tab) = 0 Then GUISetState(@SW_SHOW, $hRichEdit) Else GUISetState(@SW_HIDE, $hRichEdit) EndIf EndIf WEnd EndFunc ;==>Example _GUICtrlRichEdit_Destroy($hRichEdit)
  6. Thanks AZJIO, you da man :-) I spent hours on this yesterday and got nowhere. I see you have adjusted Opt('GUIResizeMode', 802). The help file is a little vague on this, can you please explain how you arrived at the number 802?
  7. Doesn't work unfortunately. The red bar locks to end of last tab item, but doesn't resize when I pull edges of gui.
  8. Can anyone get this red label to position itself correctly on resizing the GUI? #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <GuiTab.au3> #include <MsgBoxConstants.au3> #include <Array.au3> Opt('GUIResizeMode', 1) ; see GUICtrlSetResizing ;GUIRegisterMsg($WM_SIZE, '_WM_RESIZE') ;GUIRegisterMsg($WM_SIZING, '_WM_RESIZE') Global $hTab Global $hCoverLabel Example() Func Example() Local $aRect, $sRect, $hTab ; Create GUI GUICreate("Tab Control Get Display Rect", 400, 300, -1, -1, $WS_SIZEBOX + $WS_SYSMENU + $WS_MINIMIZEBOX + $WS_MAXIMIZEBOX + $WS_CAPTION + $WS_POPUP) $hTab = GUICtrlCreateTab(10, 10, 380, 280) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) GUISetState(@SW_SHOW) ; Add tabs GUICtrlCreateTabItem("Tab 0") GUICtrlSetResizing(-1, $GUI_DOCKAUTO) GUICtrlCreateTabItem("") GUICtrlCreateTabItem("Tab 1") GUICtrlSetResizing(-1, $GUI_DOCKAUTO) GUICtrlCreateTabItem("") GUICtrlCreateTabItem("Tab 2") GUICtrlSetResizing(-1, $GUI_DOCKAUTO) GUICtrlCreateTabItem("") ; Get empty tab display rectangle Local $aRect1 = _GUICtrlTab_GetItemRect($hTab, 2); xul, yul, xlr, ylr Local $aRect2 = _GUICtrlTab_GetDisplayRect(GUICtrlGetHandle($hTab)); xul, yul, xlr, ylr ;_ArrayDisplay($aRect1) ;_ArrayDisplay($aRect2) $hCoverLabel = GUICtrlCreateLabel('', $aRect1[2] + 10, 10, ($aRect2[0] + $aRect2[2]) - $aRect1[2], $aRect2[1]) GUICtrlSetBkColor(-1, '0x00ff0000') ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example Func _WM_RESIZE($hWnd, $iMsg, $iwParam, $ilParam) ; resizes control when interface resizing Local $aRect1 = _GUICtrlTab_GetItemRect($hTab, 2) Local $aRect2 = _GUICtrlTab_GetDisplayRect(GUICtrlGetHandle($hTab)) GUICtrlSetPos($hCoverLabel, $aRect1[2] + 10, 10, ($aRect2[0] + $aRect2[2]) - $aRect1[2], $aRect2[1]) GUICtrlSetBkColor(-1, 0x00ff0000) Return EndFunc ;==>_WM_RESIZE
  9. Thanks BrewManNH but that's not what I'm after. Perhaps, I should have been a little clearer - my bad. I'm aware I can use Switch and Case or GUICtrlSetOnEvent and trap it that way, however, what I'm after is a means to detect the checkbox handle rather than its text using GUIRegisterMsg and the WM_COMMAND. The method I have outlined above works but only if each checkbox has a different text. Currently, I'm trying to find a means of retrieving the unique handle assigned to each control so I don't run into an error situation. It's a learning thing.
  10. Thanks Melba, but I use the OnEvent method for my programming, hence, the need for the WM_COMMAND.
  11. Is there an easier (proper) way of detecting a change in the state of a checkbox other than comparing the checkbox text like I have done below? Is there a way of using and comparing the checkbox handle rather than its text? #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Gui = GUICreate("WM_COMMAND", 390, 220) $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 10, 40, 90, 17) $Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 10, 60, 90, 17) GUISetState() GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") Do Until GUIGetMsg() = -3 Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam) Local $nID = BitAND($wParam, 0x0000FFFF) ; _WinAPI_LoWord Local $nNotifyCode = BitShift($wParam, 16) ; _WinAPI_HiWord If GUICtrlRead($nID, 1) = "Checkbox1" Then MsgBox(0, '', 'Checkbox1 has been modified') ; do some non-blocking code here If GUICtrlRead($nID, 1) = "Checkbox2" Then MsgBox(0, '', 'Checkbox2 has been modified') ; do some non-blocking code here Return $GUI_RUNDEFMSG EndFunc
  12. Ahh cool, thanks Melba I missed that. It's amazing what a difference slight bolding has on meaning lol
  13. Just curious, but can someone tell me why this isn't a valid instruction in AutoIt: GUISetOnEvent($GUI_EVENT_CLOSE, Exit) GUICtrlSetOnEvent($hMYBUTTON, Exit) I know they don't work but Exit is a natural AutoIt keyword (internal function), so why shouldn't it work?
  14. Actually in this case, LaCastiglione's first post was the one I ended up going with as it made more sense and was easier/quicker to code up. Cheers for that.
  15. Thanks guys, both answers solve the problem in slightly different ways which is great. Now I just have to make up my mind which would be easier for me in the long run
×
×
  • Create New...