Sign in to follow this  
Followers 0
badapple89

Write Multiple lines from GUICtrlCreateEdit

7 posts in this topic

#1 ·  Posted (edited)

So I have read a few posts and tried different things but I cant get this working.

I have a GUI with a GUICtrlCreateEdit box so I can type in multiple lines.

I then want to write all these lines to a html file (as separate lines but all together in one block.

The whole script is pretty big, but but these are the bits of code im using.

$GUIExtraInfo = GUICtrlCreateEdit("", 10, 65, 250, 80)

$vExtraInfo = GUICtrlRead($GUIExtraInfo)

If $vExtraInfo > "" Then FileWriteLine($Signature, "<span class=" & ">" & $vExtraInfo & "</span><br />")

It all works - and when I use a msg box to read $vExtraInfo I get the text entered as two lines.

But when writing to the file it all comes out on the one line.

I have tried stringsplit and a few other things but dosent seem to work.

Help appreciated :)

 

Brain wave. Do I a FileWriteLine(........) for each line entered into the GUICtrlCreateEdit????

Not sure how I would implement this.

Edited by badapple89

Share this post


Link to post
Share on other sites



I then want to write all these lines to a html file (as separate lines but all together in one block.

What do you mean by all together in one block ?  :huh:

Directly write the whole edit content into a file would exactly do the same thing.

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

Firefox I mean when my gui runs and I type

This is line one

This is line two

into the GUICtrlCreateEdit box

That it writes into the html file exactly the same, eg

This is line one

This is line two

That is to say I don't actually need to break up the lines and use them in different parts later on.

 

PlayHD, I had a quick look at that function not sure I understand how it works but I will play around with it monday.

 

Am I even using  GUICtrlCreateEdit in the correct way?

All I need is a multiple line input box for GUI and to write thoes lines back to a file.

Share this post


Link to post
Share on other sites

If you don't need to have the line breaks, then make a StringReplace.

$s1 = "This is line one" & @CrLf & "This is line two"
 
$s2 = StringReplace($s1, @CrLf, "") ;this var will be written to the file
 
ConsoleWrite($s2 & @CrLf)

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

Thanks for the help but used Play's suggestion.

$linecountExtraInfo = _GUICtrlEdit_GetLineCount ($GUIExtraInfo)
;If extrainfo has lines
If $linecountExtraInfo <= 0 Then
 
;For each line
For $i = 0 to $linecountExtraInfo -1
;Write the line to signature
FileWriteLine($Signature, "<span class=" & ">" & _GUICtrlEdit_GetLine($GUIExtraInfo, $i) & "</span><br />")
Next
 

Endif 

Cheers for the help though guys!

Share this post


Link to post
Share on other sites

It seems like you described very well what you wanted to do :) *ironic*


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

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

    • TheDcoder
      By TheDcoder
      Hello
      I am relatively new to the world of Microsoft Office and the Excel UDF.
      I am trying to loop through every row in a spreadsheet and get the text/values from each column in the given row... so far I have looked into the Help file for the Excel UDF and the wiki page for Excel UDF but I have no idea about how this is done ... This is all I have in my script:
      Global $oExcel = _Excel_Open(False, False, False, False, True) Global Const $sSpreadsheet = @ScriptDir & '\data.xlsx' Global $oSpreadsheet = _Excel_BookOpen($oExcel, $sSpreadsheet, True, False) ; ... I am placing my bet on the _Excel_Range functions... especially _Excel_RangeRead. I don't know how $vRange works so I would be glad if someone can point me in the right direction . What I would ideally like is to get all of the contents of the spreadsheet (it's just a normal text one) in a 2D array.
      Thanks in Advance!
    • TheDcoder
      By TheDcoder
      Hello!
      I am trying to call my first DLL function but it won't work , I am trying to call GetFinalPathNameByHandle
      $sFile = @DesktopDir & '\Test.txt' $hFile = FileOpen($sFile) $sFilePath = "" DllCall("Kernel32.dll", "STR", "GetFinalPathNameByHandle", "HANDLE", $hFile, "sz*", $sFilePath) MsgBox(0, 0, @error) Thanks in Advance, TD
    • SkellySoul
      By SkellySoul
      Morning 
      It's 5:30 AM and been sitting here staring at the help file but it looks like an alien language to me.
      I have the following example strings

      [8]Bird [9]Cat [10]Dog  
      What I want is

      Bird Cat Dog  
      Now a easy solution would be to just trim it to the left by 3, however there are cases when it could be 4 (example Dog being [10]), so I figured StringRegExpReplace() is what I am going to have to use unless there is a easier/better method.
      I don't know how or where to start though 
      StringRegExpReplace($String, "[*]", "")
       
      Thanks
    • nick448
      By nick448
      Need help logging into the web interface of my WhatsUP gold server for an overhead display in our IT dept.
      Essentially I want the script to open IE, navigate to our servers web address, login to whats up, then kill IE and start the process over. ( only because the web interface times out after about 10 mins and logs you out )
      Currently I have this:
      $user='admin'
      $pass='squirrel69'
      #include <IE.au3>
      Dim $oIE = _IECreate('about:blank', 0, 0)
      With $oIE
          .Left = 0
          .Top = 0
          .Menubar = False
          .Resizable = False
          .StatusBar = False
          .TheaterMode = True
          .Toolbar = False
          .Visible = True
      EndWith
      _IENavigate($oIE, 'http://srv13app8/NmConsole/CoreNm/User/DlgUserLogin/DlgUserLogin.asp')
       
      I AM STUCK please help !!
       
    • BrookieDragon
      By BrookieDragon
      Pretty sure this is a one line problem on a easiness factor of "1" on a scale from 1-100 with 0 being the easiest...

      I want to make a re-usable hotkey that spams 1 and 2 when I press it, an cancels when I press it again.

      Problem is, after I close it once (pressing the hotkey a second time) the script finishes. I want it to recall the hotkey so that I can use it to time and time again.

      Where do I call the HotkeySet again?



      HotKeySet("{F1}", "spam") While 1 Sleep(100) WEnd Func spam() $i=0 HotKeySet("{F1}") HotKeySet("{F1}", "quit") Do Send("2") Sleep(50) Send("1") Sleep(50) Send("2") Sleep(650) Until $i=1 EndFunc Func quit() Exit EndFunc