Jump to content
Sign in to follow this  
abiteric

StringLower and StringSplit and wrong...

Recommended Posts

abiteric

i downdown 1 page from yahoo auction, and save to souce.txt

sometimes the souce file code like <TD> , sometimes <td>

so i use StringLower like this

$str = StringLower(FileRead ("souce.txt",999999))
$t01 = StringSplit($str,"-- if qandaLog --",1)
FileWrite("str.txt",$t01[1])
$t02 = StringSplit($t01[2],"-- else qandaLog --",1)

Why i can`t use StringLower ??

i try to attach the 2 files but "Upload failed. Please ask the administrator to check the settings and permissions"

so i put them on my site.

PS : the txt langurage is Tranditional Chinese (BIG5)

souce.txt : http://www.order2me.com/souce.txt

str.txt : http://www.order2me.com/str.txt

Edited by abiteric

My website about Y-mate 網拍輔助程式 : http://www.L2play.comMy Blog ( Tranditional Chinese ) 開發小組的部落格 : http://tw.myblog.yahoo.com/play19990909

Share this post


Link to post
Share on other sites
oMBRa

try this:

$str = StringLower(FileRead ("souce.txt"))
$t01 = StringSplit($str,"-- if qandaLog --",1)
FileWrite("str.txt",$t01[1])
$t02 = StringSplit($t01[2],"-- else qandaLog --",1)

Share this post


Link to post
Share on other sites
abiteric

try this:

$str = StringLower(FileRead ("souce.txt"))
$t01 = StringSplit($str,"-- if qandaLog --",1)
FileWrite("str.txt",$t01[1])
$t02 = StringSplit($t01[2],"-- else qandaLog --",1)

StringLower(FileRead ("souce.txt"))

Array variable has incorrect number of subscripts or subscript dimension range exceeded.

wrong...


My website about Y-mate 網拍輔助程式 : http://www.L2play.comMy Blog ( Tranditional Chinese ) 開發小組的部落格 : http://tw.myblog.yahoo.com/play19990909

Share this post


Link to post
Share on other sites
oMBRa

you are supposing that $t01 is an array but maybe its not, try this

$str = StringLower(FileRead ("souce.txt"))
$t01 = StringSplit($str,"-- if qandaLog --",1)
If IsArray($t01) Then
FileWrite("str.txt",$t01[1])
$t02 = StringSplit($t01[2],"-- else qandaLog --",1)
Else
    MsgBox(0, '', '$t01 is not an array)
EndIf

Share this post


Link to post
Share on other sites
abiteric

you are supposing that $t01 is an array but maybe its not, try this

$str = StringLower(FileRead ("souce.txt"))
$t01 = StringSplit($str,"-- if qandaLog --",1)
If IsArray($t01) Then
FileWrite("str.txt",$t01[1])
$t02 = StringSplit($t01[2],"-- else qandaLog --",1)
Else
    MsgBox(0, '', '$t01 is not an array)
EndIf
check my file please... it is really an Array in souce.txt

i can open the 2 files in notepad.exe and use CTRL+F5 to find the string

and i try to add this :

if StringInStr ($str,"-- if qandaLog --") = 0 then msgbox(0,"no array","0")

$t01 = StringSplit($str,"-- if qandaLog --",1)

but nothing msgbox popup

if it is not an Array, why it is no an array when i add the StringLower....


My website about Y-mate 網拍輔助程式 : http://www.L2play.comMy Blog ( Tranditional Chinese ) 開發小組的部落格 : http://tw.myblog.yahoo.com/play19990909

Share this post


Link to post
Share on other sites
Valuater

What do you really want... I think there is a better way!!!

Look at this...

#Include <string.au3>

$Text_File = "C:\done.txt"
$str = StringLower(FileRead ($Text_File))
$Info = _stringbetween($str, "-- if qandaLog --", "-- else qandaLog --")

MsgBox(4096, "Test", $Info[0])

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites
abiteric

What do you really want... I think there is a better way!!!

Look at this...

#Include <string.au3>

$Text_File = "C:\done.txt"
$str = StringLower(FileRead ($Text_File))
$Info = _stringbetween($str, "-- if qandaLog --", "-- else qandaLog --")

MsgBox(4096, "Test", $Info[0])oÝ÷ ÛÏêº^jëh×6$str = StringLower(FileRead ("souce.txt"))
$t01 = _stringbetween($str, "-- if qandaLog --", "-- else qandaLog --")
if StringInStr ($str,"-- if qandaLog --")  >0  then 
$ff =   StringInStr ($str,"-- if qandaLog --")  
msgbox(0,"found",$ff)
EndIf

if StringInStr ($str,"-- else qandaLog --")  >0  then 
$ff2 =   StringInStr ($str,"-- else qandaLog --")  
msgbox(0,"found",$ff2)
EndIf


if IsArray($t01) Then _ArrayDisplay($t01)
MsgBox(0,"123",$t01)

$ff =41475

$ff2 =50497

$t01 =nothng....

post-27241-1245437688_thumb.jpg

Edited by abiteric

My website about Y-mate 網拍輔助程式 : http://www.L2play.comMy Blog ( Tranditional Chinese ) 開發小組的部落格 : http://tw.myblog.yahoo.com/play19990909

Share this post


Link to post
Share on other sites
Valuater

What do you really want... I think there is a better way!!!

8)

Do you want to make a "Trouble Ticket" ?

... or do you want to make a program that will do what you "really want"?

8)

EDIT

**** TESTED OK *****

#Include <string.au3>

$Text_File = "C:\done.txt"

$str = StringLower(FileRead ($Text_File))
$t01 = _stringbetween($str, "-- if qandaLog --", "-- else qandaLog --")

if StringInStr ($str,"-- if qandaLog --")  >0  then
$ff =   StringInStr ($str,"-- if qandaLog --") 
msgbox(0,"found",$ff)
EndIf

if StringInStr ($str,"-- else qandaLog --")  >0  then
$ff2 =   StringInStr ($str,"-- else qandaLog --") 
msgbox(0,"found",$ff2)
EndIf


if IsArray($t01) Then; _ArrayDisplay($t01)
MsgBox(0,"123",$t01[0])
EndIf

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites
abiteric

Do you want to make a "Trouble Ticket" ?

... or do you want to make a program that will do what you "really want"?

8)

EDIT

**** TESTED OK *****

#Include <string.au3>

$Text_File = "C:\done.txt"

$str = StringLower(FileRead ($Text_File))
$t01 = _stringbetween($str, "-- if qandaLog --", "-- else qandaLog --")

if StringInStr ($str,"-- if qandaLog --")  >0  then
$ff =   StringInStr ($str,"-- if qandaLog --") 
msgbox(0,"found",$ff)
EndIf

if StringInStr ($str,"-- else qandaLog --")  >0  then
$ff2 =   StringInStr ($str,"-- else qandaLog --") 
msgbox(0,"found",$ff2)
EndIf


if IsArray($t01) Then; _ArrayDisplay($t01)
MsgBox(0,"123",$t01[0])
EndIf

8)

so strange....

i test 3 smaple of souce file...

1 : $ff= 27687 $ff2=28287 and $t01[0] = somthing i need

2 : $ff= 24260 $ff2=25796 and $t01[0] = somthing i need

2 : $ff= 43457 $ff2=52479 and $t01[0] = nothing, Null

my program :

1. InetGet("http://tw.page.bid.yahoo.com/tw/show/qanda_s?aID="&$sp01[$i], $sp01[$i]&".txt", 1, 1)

use InetGet because _IE function too slow.

$sp01[$i]&".txt" = souce.txt that`s demo what i post.

2. to split the html format

sometimes code like this <TD>, sometimes lowercase like <td> so i need to use StringLower

split and creat array them

3. get some infomation what i need


My website about Y-mate 網拍輔助程式 : http://www.L2play.comMy Blog ( Tranditional Chinese ) 開發小組的部落格 : http://tw.myblog.yahoo.com/play19990909

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.