Sign in to follow this  
Followers 0
SoW

String too long?

7 posts in this topic

I have a script that writes to a file, and also gets each line from a file.

The lines are pretty long sometimes, and sometimes contain spaces, % signs, -, ~, etc; many special characters.

I'm using the GUICtrlCreateListViewitem() to list each line, and it was working good, but I notice that some of the longer lines showed until the divider, but when I drag the divider to see the full line, it just DISAPPEARS.

Any idea why?

$line = FileReadLine($file)

is what I am using. I think I need to make it seem like a character or something, but how would I do that?

Share this post


Link to post
Share on other sites



Well, I PM'd Volly but I suppose I have to post my code here. I know it's bad, but it's my first day using AutoIt. :whistle:

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.2.0
 Author:         Michael "Sor" Fratello

 Script Function:
    Don't even ask.

#ce ----------------------------------------------------------------------------
#include <GUIConstants.au3>
#include <string.au3>
#include <File.au3>

Opt("GUIOnEventMode", 1)
$main = GUICreate("Diablo II Mule Tracker - Sor", 500, 450)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
$MainMenu = GUICtrlCreateMenu("Main")
GUICtrlCreateMenuitem("View Items", $MainMenu)
GUICtrlSetOnEvent(-1, "showItems")
GUICtrlCreateMenuitem("Remove Items", $MainMenu)
GUICtrlSetOnEvent(-1, "removeItem")
GUICtrlCreateMenuitem("Exit", $MainMenu)
GUICtrlSetOnEvent(-1, "CLOSEClicked")
$Help = GUICtrlCreateMenu("Help")
GUICtrlCreateMenuitem("About", $Help)
GUICtrlSetOnEvent(-2, "about")
GUICtrlCreateMenuitem("Help", $Help)
GUICtrlSetOnEvent(-2, "help")
GUICtrlCreateMenuitem("Version - 1.5", $Help)
GUICtrlCreatePic("C:\Documents and Settings\Mike\Desktop\myautoits\scripts\logo.jpg", 30, 10, 423, 219)
GUICtrlCreateLabel("Mule Item: ", 30, 245)

Dim $input, $subInput, $Help, $MainMenu, $main
$input = GUICtrlCreateInput("", 85, 240, 100, 25)
$subInput = GUICtrlCreateButton("Mule!", 235, 240, 60, 30)
GUICtrlSetOnEvent($subInput, "mule")

GUISetState(@SW_SHOW)

While 1
    sleep(1000)
WEnd

Func showItems()

    $x = GUICtrlCreateListView("Items Muled", 0, 280, 500, 200)

    $file = FileOpen("items.txt", 0)
    If $file = -1 Then
        MsgBox(0, "Error", "Unable to open file.")
        Exit
    EndIf
    
    Dim $i
    $i = 0
   ;MsgBox(0, "Debug", _FileCountLines("C:\Documents and Settings\Mike\Desktop\myautoits\scripts\items.txt"))
    While ($i <= _FileCountLines("C:\Documents and Settings\Mike\Desktop\myautoits\scripts\items.txt"))
        $line = FileReadLine($file)
        If @error = 1 Then ExitLoop
        GUICtrlCreateListViewitem($line, $x)
        $i = $i + 1
    WEnd
    
    FileClose($file)
    
EndFunc

Func help()
    GUICtrlCreateLabel("[= HELP =]", 30, 320, 500)
    GUICtrlCreateLabel("For help, you can e-mail your questions to", 30, 500)
    GUICtrlCreateLabel("mike.helljumper@gmail.com", 30, 340, 500)
EndFunc

Func about()
    GUICtrlCreateLabel("Created By (c) 2007 Michael Fratello", 30, 320, 200)
    GUICtrlSetBkColor(-1, "0x00ff00")
EndFunc

Func mule()
    $data = GUICtrlRead($input)
    $writeFile = FileOpen("items.txt", 1)
    If $writeFile = -1 Then
        MsgBox(0, "Error", "Unable to open file!")
        Exit
    EndIf
    
    FileWriteLine($writeFile, $data)
    FileClose($writeFile)
    MsgBox(0, "Item Added", "Item added to muled list successfully!")
EndFunc

Func removeItem()
    MsgBox(0, "Hard Hat Zone", "That is currently * UNDER CONSTRUCTION *")
EndFunc
        
    
Func CLOSEClicked()
    Exit
EndFunc

Share this post


Link to post
Share on other sites

Received. You said something about Ini (I would assume that would use IniRead() and IniWrite()).

Can somebody explain using Inis to store data please? :whistle:

Share this post


Link to post
Share on other sites

I read, but it looks like the same that I have done, just with a .ini file.

I don't understand why if I type something like:

"Hoz - 200% ed - Rabbit-Uniques"

minus the double-quotes, it shows up as Hoz - 200... then when I move the bar so I can see the full word, it just disappears.

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