Jump to content

Split String?


Recommended Posts

Hello,

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

File 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

[font="Verdana"]Keith (Kogmedia)[/font]My ScriptQuick Search - Internet / Hard Drive Search
Link to comment
Share on other sites

  • Developers

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 ?

:)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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

; 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
[font="Verdana"]Keith (Kogmedia)[/font]My ScriptQuick Search - Internet / Hard Drive Search
Link to comment
Share on other sites

  • Developers

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

; 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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

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))

:)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...