Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/26/2020 in all areas

  1. Melba23

    RichEdit resize

    jcpetu, The script works if you resize the GUI by dragging the mouse - I suspect in the case above you are using the minimize/maximize buttons of the GUI. In that case we need to widen the events that trigger the resizing - like this: #include <GUIConstantsEx.au3> #include <GuiRichEdit.au3> #include <GuiListView.au3> #include <WindowsConstants.au3> ;---------------------------------------------------------------------------------------------------------------------- #Region Options Opt('GUIOnEventMode', 1) Opt('GUICloseOnESC', 0) #EndRegion Options #Region Variables Global $GuiMain, $GUIversion = 'Rich Edit Resize', $DeskW = @DesktopWidth - 13, $DeskH = @DesktopHeight - 60 Global $I1, $I2, $Edit1, $Edit2 #EndRegion Variables $GuiMain = GUICreate($GUIversion, $DeskW, $DeskH, -1, -1, $WS_SIZEBOX + $WS_SYSMENU + BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX)) GUISetOnEvent($GUI_EVENT_CLOSE, 'CloseApp') GUISetOnEvent($GUI_EVENT_RESTORE, '_Resize') GUISetOnEvent($GUI_EVENT_MAXIMIZE, '_Resize') ;GUISetBkColor(0xC4C4C4) ; Just so you can see the RichEdits $I1 = GUICtrlCreateInput('', 66, 30, 581, 31) GUICtrlSetResizing(-1, 1) $I2 = GUICtrlCreateInput('', 66, 70, 581, 31) GUICtrlSetResizing(-1, 1) $cLabel_1 = GUICtrlCreateLabel("", 10, 140, ($DeskW / 2) - 10, 320) GUICtrlSetResizing($cLabel_1, 1) GUICtrlSetState($cLabel_1, $GUI_DISABLE) ; Most important! $Edit1 = _GUICtrlRichEdit_Create($GuiMain, '', 10, 140, ($DeskW / 2) - 10, 320, BitOR($ES_MULTILINE, $WS_HSCROLL, $WS_VSCROLL)) ; Create underlying label $cLabel_2 = GUICtrlCreateLabel("", ($DeskW / 2) + 10, 140, ($DeskW / 2) - 15, 320) GUICtrlSetResizing($cLabel_2, 1) GUICtrlSetState($cLabel_2, $GUI_DISABLE) $Edit2 = _GUICtrlRichEdit_Create($GuiMain, '', ($DeskW / 2) + 10, 140, ($DeskW / 2) - 15, 320, BitOR($ES_MULTILINE, $WS_HSCROLL, $WS_VSCROLL)) $LV1 = GUICtrlCreateListView("", 8, 480, $DeskW - 18, 161, -1, BitOR($LVS_EX_CHECKBOXES, $LVS_EX_SUBITEMIMAGES, $LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT, $LVS_EX_HEADERDRAGDROP, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER)) GUICtrlSetResizing(-1, 1) _GUICtrlListView_AddColumn(-1, "#", 30, 1) _GUICtrlListView_AddColumn(-1, "Date", 110, 2) _GUICtrlListView_AddColumn(-1, "Time", 110, 2) _GUICtrlListView_AddColumn(-1, "Event", 110, 2) GUISetState(@SW_SHOW, $GuiMain) ; Register the SIZE message GUIRegisterMsg($WM_SIZE, "_WM_SIZE") While 1 Sleep(10) WEnd Func CloseApp() _GUICtrlRichEdit_Destroy($Edit1) _GUICtrlRichEdit_Destroy($Edit2) GUIDelete($GuiMain) Exit EndFunc ;==>CloseApp Func _WM_SIZE($hWnd, $iMsg, $wParam, $lParam) ; If it is our GUI If $hWnd = $GuiMain Then _Resize() EndIf EndFunc Func _Resize() ; Get the new position and size of the labels $aPos_1 = ControlGetPos($GuiMain, "", $cLabel_1) $aPos_2 = ControlGetPos($GuiMain, "", $cLabel_2) ; And set the RichEdits to the same position and size WinMove($Edit1, "", $aPos_1[0], $aPos_1[1], $aPos_1[2], $aPos_1[3]) WinMove($Edit2, "", $aPos_2[0], $aPos_2[1], $aPos_2[2], $aPos_2[3]) EndFunc How is it now? M23
    2 points
  2. Nah, pencil and paper are the best method. Just kidding. First, take advice from your accounting consulting firm. They will tell you what is best for you. Forget about the technology, focus on your business strategy and marketing. To be honest, if you require help from this forum to guide you thru your startup, well...I'd say good luck.
    2 points
  3. jchd

    System for a small business

    I disagree: always pay yourself last! That will keep you away from financial disaster.
    1 point
  4. $test = "P123456 2.pdf" $test = StringRegExpReplace($test,".*\h([^.]+)\.[^.]+$","$1") ConsoleWrite($test & @LF) Another skin for the same cat. Explanations here: https://regex101.com/r/KHP0xN/2
    1 point
  5. A tab character moves the text following the tab to the next tab stop (in your example this is always a multiple of 4). So you have to determine the position of the tab character, calculate the number of spaces needed to the next tab stop and replace the tab character with the resulting number of characters.
    1 point
  6. Ok... but that mean you need to define "tab-stops" to be able to determine the number of spaces required to replace the Tab.... So that is again a whole other case that your initial request. Understand what I mean by tab-stops? ( Fixed positions on the line where the tab would jump to)
    1 point
  7. Melba23

    RichEdit resize

    jcpetu, Then I am afraid I am out of ideas. Using the script I have not yet managed to fail to get the RichEdits resized when the GUI is resized - and I have been using this trick for many years to resize UDF-created controls without problem. Sorry. M23
    1 point
  8. Maybe thread a-set-of-question-for-file brings some light into the dark. Especially the posts from @Valik I consider as very informative.
    1 point
  9. @Professor_Bernd, it appears that tab stops in the console are 8 characters long (they are fixed every 8 characters), while in the editor they have a length of 4, so copying a string from the console and pasting it into the editor, the tabs (chr (9 )) react differently by adapting to the new tabulators, while the spaces remain the same. You need to decide what length you need to set the tab stop to and then pass that value as the second parameter of the function. @Nine, You are right, thanks for the testing, I made a small correction in the function ; $sInputString = "This is a" & Chr(9) & "nice" & Chr(9) & "little" & Chr(9) & "test" $sInputString = "This" & Chr(9) & "is" & Chr(9) & "a" & Chr(9) & "nice" & Chr(9) & "longbutnolittle" & Chr(9) & "test" ConsoleWrite($sInputString & @CRLF) ; string with tabs ConsoleWrite(_VirtualTabs($sInputString) & @CRLF) ; string with only spaces (no tabs) Func _VirtualTabs($sString, $iTabStop = 8) StringReplace($sString, Chr(9), Chr(9)) Local $iNrOfTabs = @extended ; number of tabs in the string (if any) For $i = 1 To $iNrOfTabs Local $iMod = Mod(StringInStr($sString, Chr(9)), $iTabStop) $sString = StringReplace($sString, Chr(9), StringFormat('%' & ((($iMod * -1) + $iTabStop * ($iMod <> 0)) + 1) & 's', ""), 1) Next Return $sString EndFunc ;==>_VirtualTabs
    1 point
  10. water

    OutlookEX UDF

    Would something like this solve your problem? I check @error after .Send. If we get 0x80070057 we can execute all statements to solve the problem. Func _OL_ItemSend($oOL, $vItem, $sStoreID = Default) Local $oInspector Local Const $olMinimized = 1 ; The window is minimized If Not IsObj($vItem) Then If StringStripWS($vItem, BitOR($STR_STRIPLEADING, $STR_STRIPTRAILING)) = "" Then Return SetError(1, 0, 0) $vItem = $oOL.Session.GetItemFromID($vItem, $sStoreID) If @error Then Return SetError(1, @error, 0) EndIf $vItem.Send() If @error Then ; Handle the MAPI_E_INVALID_PARAMETER (HRESULT 0x80070057) error found in Outlook 365 Version 2009. ; Described here and the following posts: https://www.autoitscript.com/forum/topic/126305-outlookex-udf/?do=findComment&comment=1466457 If @error = 0x80070057 Then $oInspector = $vItem.GetInspector $oInspector.Activate $oInspector.WindowState = $olMinimized $vItem.Send() If @error Then Return SetError(2, @error, 0) Else Return SetError(2, @error, 0) EndIf EndIf Return $vItem EndFunc ;==>_OL_ItemSend
    1 point
  11. @NguyenDuc Use the forum's search feature and you will find multiple examples.
    1 point
  12. water

    Auto SSH and run command?

    If you search the forum for PuTTY or Plink (a command-line interface to the PuTTY back ends) you will find a lot of threads. I'm sure one of them has the solution for your problem
    1 point
  13. If there was a hot blonde "cleaning" under my desk there would not only be no documentation, there'd be no features, either.
    1 point
×
×
  • Create New...