Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Split String?


  • Please log in to reply
7 replies to this topic

#1 Kogmedia

Kogmedia

    Adventurer

  • Active Members
  • PipPip
  • 128 posts

Posted 27 May 2007 - 09:47 AM

Hello,

I am trying to split this string it is being read from a file and I can't edit it...

File Text
Plain Text         
; APPS_S ; First item in this section IS always the default app if no others found [Applications] Default= Media Center= WinTV Remote= Democracy Player= ;Win/TV+= ;Win/TV= WinTV32= WinTV32(1)= WinTV32(2)= WinTV32(3)= WinTV32(4)= WinTV32(5)= WinTV32(8)= WinTV32(9)= WinTV32(10)= WinTV32(11)= WinTV32(12)= FullScreen= PVRFullScreen= *task*= ;*suspend*= EPGdemo= VTplus= Create and Receive= Debug.txt= hcwGDisplayWindow= hcwGo= Windows Media Player= ActiveMovie Window= Dell Media= PowerCinema= ShowShifter - The Home Entertainment Manager= ; APPS_E


I have tried StringSplit using @CR / @LF / @CRLF any ideas?

Thanks
Keith







#2 Jos

Jos

    Je maintiendrai

  • Developers
  • 23,362 posts

Posted 27 May 2007 - 09:49 AM

Hello,

I am trying to split this string it is being read from a file and I can't edit it...
-snip
I have tried StringSplit using @CR / @LF / @CRLF any ideas?

Thanks
Keith


Don't understand what you want to do so maybe post what you have and examplain how you want to "edit" it ?
:)

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)


#3 Kogmedia

Kogmedia

    Adventurer

  • Active Members
  • PipPip
  • 128 posts

Posted 27 May 2007 - 09:50 AM

Hello,

I am trying to load them into a GUI List

#4 Jos

Jos

    Je maintiendrai

  • Developers
  • 23,362 posts

Posted 27 May 2007 - 09:52 AM

Hello,

I am trying to load them into a GUI List


Believe you forgot something :)

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)


#5 Kogmedia

Kogmedia

    Adventurer

  • Active Members
  • PipPip
  • 128 posts

Posted 27 May 2007 - 09:58 AM

What have I forgot as I don't know how to do it but read line by line but it will change size....

Thanks,
Keith

AutoIt         
; Happauge Hotkeys #include <GUIConstants.au3> #include <File.au3> Dim $IR $appStartLine = StringInStr($IR,"APPS_S") $appEndLine = StringInStr($IR,"APPS_E") $app_i = StringMid ( $IR, $appStartLine+6 , ($appEndLine - $appStartLine-8) ) #Region ### START Koda GUI section ### Form=C:\Documents and Settings\Kog Media\Desktop\Hauppauge.kxf $Hauppauge = GUICreate("Hauppauge IR Setup", 495, 454, 193, 115) GUISetFont(10, 400, 0, "Verdana") $AppList = GUICtrlCreateList("", 24, 24, 321, 390) GUICtrlSetFont(-1, 10, 400, 0, "Verdana") $Button1 = GUICtrlCreateButton("Add", 352, 24, 139, 41, 0) GUICtrlSetFont(-1, 10, 400, 0, "Verdana") $Button2 = GUICtrlCreateButton("Delete", 352, 72, 137, 41, 0) GUICtrlSetFont(-1, 10, 400, 0, "Verdana") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ;$app_i = StringSplit($IR,@CRLF) ; STUCK HERE <<<------------------- For $x = 0 To UBound($app_i) MsgBox(0,"",$app_i[$x]);_GUICtrlListAddItem ($AppList,$app_i[$x]) Next


#6 Jos

Jos

    Je maintiendrai

  • Developers
  • 23,362 posts

Posted 27 May 2007 - 10:16 AM

saved you text to TEST.INI and made these changes... see if that helps:

AutoIt         
; Happauge Hotkeys #include <GUIConstants.au3> #include <GUIlist.au3> #include <File.au3> Dim $IR $IR = FileRead("test.ini") $appStartLine = StringInStr($IR, "APPS_S") $appEndLine = StringInStr($IR, "APPS_E") $app_i = StringMid($IR, $appStartLine + 6, ($appEndLine - $appStartLine - 8)) #Region ### START Koda GUI section ### Form=C:\Documents and Settings\Kog Media\Desktop\Hauppauge.kxf $Hauppauge = GUICreate("Hauppauge IR Setup", 495, 454, 193, 115) GUISetFont(10, 400, 0, "Verdana") $AppList = GUICtrlCreateList("", 24, 24, 321, 390) GUICtrlSetFont(-1, 10, 400, 0, "Verdana") $Button1 = GUICtrlCreateButton("Add", 352, 24, 139, 41, 0) GUICtrlSetFont(-1, 10, 400, 0, "Verdana") $Button2 = GUICtrlCreateButton("Delete", 352, 72, 137, 41, 0) GUICtrlSetFont(-1, 10, 400, 0, "Verdana") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $app_i = StringSplit($IR, @CRLF, 1) ; STUCK HERE <<<------------------- For $x = 1 To $app_i[0]     _GUICtrlListAddItem($AppList, $app_i[$x]) Next While 1     $msg = GUIGetMsg()     If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)


#7 Kogmedia

Kogmedia

    Adventurer

  • Active Members
  • PipPip
  • 128 posts

Posted 27 May 2007 - 10:30 AM

Thanks it working now :) is there a not sort data in the list box or a better ctrl that will leave them in the same order?.

Keith

#8 Jos

Jos

    Je maintiendrai

  • Developers
  • 23,362 posts

Posted 27 May 2007 - 10:50 AM

Thanks it working now :) is there a not sort data in the list box or a better ctrl that will leave them in the same order?.

Keith

Change the GUICtrlCreateList line to this:
$AppList = GUICtrlCreateList("", 24, 24, 321, 390,BitOR($WS_BORDER, $WS_VSCROLL))


:)

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users