Sign in to follow this  
Followers 0
myspacee

Text running on columns

22 posts in this topic

Hello,

need a tool for job to count how many text i write and simulate effect on paper.

Is possible to jump on another column when reach bottom of previus one ?

Posted Image

And, On post image (modified), on avarage every columns contain 30 characters of text,

is possibile to set a limit for rows?

Thank you for any help,

m.

Share this post


Link to post
Share on other sites



Yes, it is possible!

Seriously, we need more information before we can tell you if it is possible and how to do.

Can you post the code you have so far?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Thank you for reply,

don't post code because is only a simple Koda example:

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 626, 449, 192, 114)
$Edit1 = GUICtrlCreateEdit("", 8, 16, 200, 409)
GUICtrlSetData(-1, "Edit1")
$Edit2 = GUICtrlCreateEdit("", 213, 16, 200, 409)
GUICtrlSetData(-1, "Edit1")
$Edit3 = GUICtrlCreateEdit("", 417, 16, 200, 409)
GUICtrlSetData(-1, "Edit1")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd

I take an image and modify it to better explain my idea. Have no sufficent skill to create my own...

This tool can semplify a lot way to work,

m.

Share this post


Link to post
Share on other sites

What you try to do is not easy to code. I'm not sure the Edit control is the best solution. But as I have never done something similar myself I hope some other users jump in and add their knowledge.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Just throwing out an idea, probably a good to use a unicode text, so once a character limit is hit (you will have to find it, and consider word wraps/CR/LF/Tab that take up additional characters), then use a regexp to move the last word over to the other column, and shift focus as well

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

myspacee,

Are you trying to flow the columns automatically as the user types (like a news letter)?

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

@jdelaney - why regexp to move the last word typed?

@myspacee - Rich text edit controls can be queried for the number of lines in the control. Following what jdelaney said, you can monitor the control and switch focus at some pre-set limit. I have no experience with this but would look at doing it this way. There is also an event handler that may be an option, you'll need to do some research / experimentation.

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

regexp to move last word, so one word isn't split into two (if monitoring for character count)

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

@jdelaney - of course, too much time spent on 6 word stories!


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

myspacee,

Sorry, it looks like there is an outstanding problem with creating multiple rich edit controls within one window.

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

There is an easy fix for the RichEdit control issue.

Try this, open the GUIRichEdit.au3 file, navigate to the _GUICtrlRichEdit_Create function in it, and comment out the second line in the function.

; comment out or delete this line from the UDF
If Not _WinAPI_IsClassName($hWnd, $_GRE_sRTFClassName) Then Return SetError(1, 0, 0) ; Invalid Window handle for _GUICtrlRichEdit_Create 1st parameter
; replace it with this line instead
If Not IsHWnd($hWnd) Then Return SetError(1, 0, 0) ; Invalid Window handle for _GUICtrlRichEdit_Create 1st parameter

I just posted this in another thread where someone was having an issue with creating multiple RichEdit controls, this fixes it.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

@BremanNH - thanks, never used one of these so this thread interests me

edit: works perfectly

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

Might be worth seeing whether microsofts richedit control actually implements the microsoft rtf specification. If it does then there is actually a snaking columns property for sections.

Search this page for "colsN" to see what I mean: http://msdn.microsoft.com/en-us/library/office/aa140283(v=office.10).aspx#rtfspec_19

Share this post


Link to post
Share on other sites

myspacee,

This will get you started. You figure out how to cross columns without splitting words, what to do when you run out of room and how to "simulate effect on paper" (whatever that means?).

The code is rough but you need something to do too!

#Include <GUIConstants.au3>
#Include <EditConstants.au3>
#Include <WindowsConstants.au3>
local $gui010 = GUICreate(@scriptfullpath,910,700)
local $col010  =  GUICtrlCreateedit('', 10, 30, 290, 600, $es_wantreturn)
local $col020  =  GUICtrlCreateedit('',310, 30, 290, 600, $es_wantreturn)
local $col030  =  GUICtrlCreateedit('',610, 30, 290, 600, $es_wantreturn)
local $lbl010  =  GUICtrlCreatelabel('',10, 650, 290, 30, $es_wantreturn)
     GUIRegisterMsg($WM_COMMAND, 'WM_COMMAND')
     GUISetState()
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
    local $ctrl = BitAND($wParam, 0xFFFF)
 local $nmsg = BitShift($wParam, 16)
 Switch $nmsg
  Case $EN_change
   ;
   ; This notification happens after every char.  Might be used to make sure that words are not split across columns.
   ;
        Case $EN_maxtext
   switch $ctrl
    ;
    ; the controls are hardcoded.  For greater flexability put them in an array and use +/- navigation
    ;
    case $col010
     guictrlsetstate($col020,$gui_focus)
    case $col020
     guictrlsetstate($col030,$gui_focus)
    case $col030
     guictrlsetdata($lbl010,'No More Room To Type')
   endswitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

I'm not sure what just happenned, the forum went "gomer-ific" on me when I tried to post. The following is the code

#Include <GUIConstants.au3>
#Include <EditConstants.au3>
#Include <WindowsConstants.au3>
local $gui010 = GUICreate(@scriptfullpath,910,700)
local $col010  =  GUICtrlCreateedit('', 10, 30, 290, 600, $es_wantreturn)
local $col020  =  GUICtrlCreateedit('',310, 30, 290, 600, $es_wantreturn)
local $col030  =  GUICtrlCreateedit('',610, 30, 290, 600, $es_wantreturn)
local $lbl010  =  GUICtrlCreatelabel('',10, 650, 290, 30, $es_wantreturn)
     GUIRegisterMsg($WM_COMMAND, 'WM_COMMAND')
     GUISetState()
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
    local $ctrl = BitAND($wParam, 0xFFFF)
 local $nmsg = BitShift($wParam, 16)
 Switch $nmsg
  Case $EN_change
   ;
   ; This notification happens after every char.  Might be used to make sure that words are not split across columns.
   ;
        Case $EN_maxtext
   switch $ctrl
    ;
    ; the controls are hardcoded.  For greater flexability put them in an array and use +/- navigation
    ;
    case $col010
     guictrlsetstate($col020,$gui_focus)
    case $col020
     guictrlsetstate($col030,$gui_focus)
    case $col030
     guictrlsetdata($lbl010,'No More Room To Type')
   endswitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

Looks like someone has been fiddling with the code boxes and forgotten to close an element somewhere :whistle:

Share this post


Link to post
Share on other sites

@mat - I'm sure that I put in a closing code box, if that's what you mean.

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

@mat - I'm sure that I put in a closing code box, if that's what you mean.

kylomas

It's not a problem you should be able to close... But I can't seem to reproduce it now. I tried to copy the code and it worked fine: http://www.autoitscript.com/forum/topic/98043-test-thread/page__st__300#entry1034913

I meant that the html is missing an end tag for the code box, so eats the next few elements :)

Edit: I think perhaps you were posting while the greaters powers were adding an expand button, and they have now rolled back the changes? Your AutoIt box has one, which wasn't there in older posts, and isn't there now.

Edited by Mat

Share this post


Link to post
Share on other sites

@mat - I still cannot see the code that I posted...where did you get it?


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

@mat - I still cannot see the code that I posted...where did you get it?

Replying to your post :P It looks messed up over here as well.

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
Sign in to follow this  
Followers 0

  • Similar Content

    • Jibberish
      By Jibberish
      I am working on a Video Player Test Script. I am reading a text file into a 3d array to be displayed in a GUI.
      Array Content:
      [x][0]FileName.mp4
      [x][1]UsageCount -> Up to a 4 digit number
      [x][2]EnableUsageCount (True/False)
      In the GUI the user can check the filename box, edit the number of usages and check EnableUsageCount to turn on the UsageCount control using the UsageCount number for the maximum number of plays.
      To make this easier to deal with I have removed the EnableUsageCount section, and am just concentrating on getting a method to put the edited (or unchanged) UsageCount in the array. Currently nothing is read into the array, due to my using the wrong method in the Case statement.
      Here are code snippets of what I am trying to do:
      ; Snippets from script ; I read the text file at the bottom and put the .mp4 filenames in $aManifest[x][0] and UsageCount in $aManifest[x][1] ; Then I create a GUI to display the .mp4 filenames with checkboxes and the UsageCount to the right. UsageCount is editable by the user. ; If the filename is checked, I want to read the filename into $aCheckedVideos[x][0] and the updated UsageCount in $aCheckedVideos[x][1] ; The GUICtrlRead($aVideoName[$i]) with Case $GUI_CHECKED & UNCHECKED works for the checkboxes ; This section puts the filenames in the GUI with a checkbox For $i = 0 to $iMMCount Step 1 $sMP4Text = $aManifest[$i][0] $iMP4Length = StringLen($sMP4Text) $aVideoName[$i] = GUICtrlCreateCheckbox($sMP4Text,$iLeft, $iTop) $iTop += 30 Next ; This section reads numbers from the Manifest array, and I want to be able to change the number and have them saved. ; So the Case $GUI_CHECKED & UNCHECKED won't work here, and I can't figure out what I should be doing here. For $i = 0 to $iMMCount Step 1 $sUsageText = $aManifest[$i][1] $aUsageCount[$i] = GUICtrlCreateInput($sUsageText,$iLeft, $iTop, 50,18, $GUI_DOCKAUTO) GUICtrlSetPos($aUsageCount[$i],200) $iTop += 30 Next While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $idCloseGUI For $i = 0 To $iMMNewCount Step 1 Switch GUICtrlRead($aVideoName[$i]) Case $GUI_CHECKED $aCheckedVideos[$i][0] = $aManifest[$i][0] ; If checked, I put the results into a two D array Case $GUI_UNCHECKED ; where Video Name is $aCheckedVideos[x][0] EndSwitch Switch GUICtrlRead($aUsageCounter[$i]) Case $GUI_CHECKED $aCheckedVideos[$i][1] = $aUsageCount[$i] ;I want to put the text (numbers) in $aCheckedVideos[x][1] Case $GUI_UNCHECKED ;but what is returned is blank, probably due to EndSwitch ; $GUI_CHECKED being the wrong thing. Next ExitLoop EndSwitch WEnd ;The txt file I'm reading has the following: ;~ /** Title #1: Big Buck Bunny 1080p **/ ;~ "Name": "Big Buck Bunny", ;~ "URI": "..\\MediaFiles\\bbb_1080_60s.mp4", ;~ "UsageCount": 9999, ;~ "URI": "..\\MediaFiles\\bbb_1080_60s_enc1.mp4", ;~ "UsageCount": 45, ;~ "URI": "..\\MediaFiles\\bbb_1080_60s_enc1.mp4", ;~ "UsageCount": 2, ;~ /** Title #2: Tears of Steel 4K **/ ;~ "Name": "Tears of Steel 4K", ;~ "URI": "..\\MediaFiles\\tos_4K_60s_HEVC.mp4", ;~ "UsageCount": 9876, ;~ "URI": "..\\MediaFiles\\tos_4K_60s_HEVC_enc2.mp4", ;~ "UsageCount": 0, ;~ "URI": "..\\MediaFiles\\tos_4K_60s_HEVC_enc2.mp4", ;~ "UsageCount": 5, I am certain that the section
                          Switch GUICtrlRead($aUsageCounter[$i])
                              Case $GUI_CHECKED
                                  $aCheckedVideos[$i][1] = $aUsageCount[$i]    ;I want to put the text (numbers) in $aCheckedVideos[x][1]
                              Case $GUI_UNCHECKED                                ;but what is returned is blank, probably due to
                          EndSwitch                                            ; $GUI_CHECKED being the wrong thing.

      is wrong, and this is what I am looking for help with. Instead of $GUI_CHECKED what should I be looking for?
      The worst part of this is I had this working late last night, and then lost my changes and cannot for the life of me remember how I had this working.
      Help is truly appreciated!
      Jibberish
       
    • rootx
      By rootx
      I hope someone explain me how to do that... well, if you run the command netstat -a inside cmd prompt he look nice( indented ) but if you try to show the output inside the GUICtrlCreateEdit he look without indentation... how can I  fix it? Thx
      $Pid = Run(@ComSpec & " /c " & "netstat -a",@ScriptDir,@SW_HIDE,$STDERR_CHILD + $STDOUT_CHILD) Dim $_StderrRead='', $_StdoutRead='', $_StdReadAll='' While ProcessExists ( $Pid ) $_StderrRead = StderrRead ( $Pid ) If Not @error And $_StderrRead <> '' Then GUICtrlSetData($Edit1, "Error: " & $_StderrRead & @Crlf ,1) EndIf $_StdoutRead = StdoutRead ( $Pid ) If Not @error And $_StdoutRead <> '' Then GUICtrlSetData($Edit1, "Log: " & $_StdoutRead & @Crlf ,1) EndIf Wend  
    • rootx
      By rootx
      How can I write a good output inside Edit control?
       4 example on notepad (windows) he looks terrible... but he looks perfect on notepad++ and cmd. THX
      GUICtrlSetData($Edit1, "Log: " & $_StdoutRead & @Crlf ,1) the log..
      <snip>
    • kashamalasha
      By kashamalasha
      Hello.
      Could you help me find the answer for my issue. I'm trying to set fomatted data wich is selected from SQL to GUICtrlCreateEdit field.
      And the GUICtrlSetData function is inserting it in one line. But when I'm trying to do the same using MsgBox the data looks fine.
      I'm trying to not use _GUICtrlRichEdit UDF.
      Thanks in advance. Here is my test code.
      #include <GUIConstants.au3> #include <GUIListBox.au3> #include <SQLite.au3> #include <SQLite.dll.au3> Opt("GUIOnEventMode", 1) $hMainGUI = GUICreate("Test", 520, 240) $hListBox = _GUICtrlListBox_Create($hMainGUI, "", 10, 10, 180, 80) $hEdit = GUICtrlCreateEdit("", 10, 80, 500, 150) GUISetState(@SW_SHOW, $hMainGUI) GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") Local $hQuery, $aRow _SQLite_Startup() $hDB = _SQLite_Open('MyDB.sqlite') _SQLite_Query(-1, "SELECT ID ||"". "" || Name FROM Templates ORDER BY ID;", $hQuery) While _SQLite_FetchData($hQuery, $aRow) = $SQLITE_OK _GUICtrlListBox_AddString($hListBox, $aRow[0]) WEnd GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSE_Button") While 1 Sleep(100) WEnd Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $hWndFrom, $iIDFrom, $iCode, $hWndListBox If Not IsHWnd($hListBox) Then $hWndListBox = GUICtrlGetHandle($hListBox) $hWndFrom = $lParam $iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word $iCode = BitShift($wParam, 16) ; Hi Word Switch $hWndFrom Case $hListBox, $hWndListBox Switch $iCode Case $LBN_DBLCLK Select_Template(_GUICtrlListBox_GetCurSel($hListBox) + 1) Return 0 EndSwitch EndSwitch EndFunc ;==>_WM_COMMAND Func CLOSE_Button() _SQLite_Close() _SQLite_Shutdown() Exit EndFunc ;==>CLOSE_Button Func Select_Template($sListItem) _SQLite_QuerySingleRow($hDB, _ "SELECT Content " & _ "FROM Templates " & _ "WHERE ID = " & $sListItem & ";", $aRow) ;~ MsgBox(64, "Test: " & $sListItem, $aRow[0]) GUICtrlSetData($hEdit, $aRow[0]) WinSetTitle($hMainGUI, "", "Test: " & $sListItem) EndFunc ;==>Select_Template  


    • Simpel
      By Simpel
      Hi,
      I'm trying to create a console reader. All is working but I have a problem with the look. I want the line numbers with another backgroundcolor in silver. I made this with a small silver label. The edit control over the label has a transparent background.
      But if I start the prog then i can see how the line numbers wipe the silver background off. And if I click into the Edit then the silver label disappears completely.
      #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <ColorConstants.au3> #include <StaticConstants.au3> #include <GuiEdit.au3> Opt("GUIOnEventMode", 1) Global $g_iZaehler = 0 Global $g_hGUI = GUICreate("Console: StdoutRead" , 800, 800, -1, -1, $WS_OVERLAPPEDWINDOW + $WS_CLIPCHILDREN, $WS_EX_ACCEPTFILES) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") Global $text = GUICtrlCreateEdit("",10,30,780,760, $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_READONLY + $ES_NOHIDESEL) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUICtrlSetFont(-1, 9, -1, -1, "Lucida Console") GUICtrlSetResizing(-1, $GUI_DOCKBORDERS) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) Global $g_LaZeilen = GUICtrlCreateLabel("Zeilen: " & StringFormat("% 5d", $g_iZaehler), 680, 10, 100, 9, $SS_LEFTNOWORDWRAP) GUICtrlSetFont(-1, 9, -1, -1, "Lucida Console") GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKSIZE) Global $g_hCbFreeze = GUICtrlCreateCheckbox("&Freeze", 13, 5, 90) GUICtrlSetFont(-1, 9, -1, -1, "Lucida Console") GUICtrlSetResizing(-1, $GUI_DOCKALL) GUICtrlCreateLabel("", 11, 31, 42, 758) ; soll die Ziffern andersfarbig hinterlegen GUICtrlSetBkColor(-1, $COLOR_SILVER) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH) GUISetState(@SW_SHOW) Global $sText = StringFormat("% 5d", $g_iZaehler) & @CRLF _GUICtrlEdit_AppendText($text, $sText) While 1 Sleep(200) $g_iZaehler += 1 $sText = StringFormat("% 5d", $g_iZaehler) & @CRLF _GUICtrlEdit_AppendText($text, $sText) WEnd Func _Exit() Exit EndFunc Do you have any suggestions.
      Regards, Conrad