Jump to content
Sign in to follow this  
d4rk

"" and ''

Recommended Posts

d4rk

hello every1,

$Position=StringInStr($Source,'<td align=right width="105"><font color="#FF0000"><b>',2);<td align=right width="105"><font color="#FF0000"><b>2572

this string appears in my html code but $Postion always is 0, is my way using '' and "" right ?

thanks


[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Share this post


Link to post
Share on other sites
amokoura

It seems right.

Try first searching for '<td align=right'

and then '<td align=right width="105">'

and then '<td align=right width="105"><font color'

and so on. You should find the spot where it cannot find the substring anymore.

Edited by amokoura

Share this post


Link to post
Share on other sites
ResNullius

hello every1,

$Position=StringInStr($Source,'<td align=right width="105"><font color="#FF0000"><b>',2);<td align=right width="105"><font color="#FF0000"><b>2572

this string appears in my html code but $Postion always is 0, is my way using '' and "" right ?

thanks

Yes, your use of single and double quotes is correct.

I would suspect something in the assignment of your html code to the $source variable.

Have you done a check of it before you begin the StringInStr() ? i.e.: MsgBox(0,"Source",$source) or better yet

$sourceCheck = FileOpen("SourceCheck.txt",2)
FileWrite($sourceCheck,$source)
FileClose($sourceCheck)

That way you can open "SourceCheck.txt" in notepad (or whatever) and see what's in there for sure.

Edited by ResNullius

Share this post


Link to post
Share on other sites
torels

try using StringRegExp() (with flag 2) instead of StringInStr()...

you have a wider range of pissibilities

:)


Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Share this post


Link to post
Share on other sites
d4rk

Thx all, worked


[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Share this post


Link to post
Share on other sites
ResNullius

Thx all, worked

What was wrong/the solution???

Share this post


Link to post
Share on other sites
d4rk

Actually i change the target, it should not too long and common like that ... and here's my code

$Source=_IEDocReadHTML($IE);source
$Position=StringInStr($Source,'(MB)',2);41 511
$raw=StringMid($Source,$Position,75);take 75 chars from the '(MB)' [...<B>2222</B>]
MsgBox(64,"",$raw);ok
$MB_1=StringRight($raw,4);Take 4 chars from right to trip off </B> then for the greatest case : 2222
MsgBox(64,"just show",$MB_1)

;--------------
Dim $MB_2
Dim $MB_3

if Number($MB_1) > 1 Then;is number , > 1 [2222]
MsgBox(64,"4 nums",$MB_1)
$MB=$MB_1
Else;222d
$MB_2=StringRight($raw,3)
;--------------------------
if Number($MB_2) > 1 Then;is number , > 1 [222]
MsgBox(64,"3 nums",$MB_2)
$MB=$MB_2
Else;22d
$MB_3=StringRight($raw,2)
;--------------------------
if Number($MB_3) > 1 Then;is number , > 1 [22]
MsgBox(64,"2 nums",$MB_3)
$MB=$MB_3
Else;2d
$MB_4=StringRight($raw,1)
;--------------------------
if Number($MB_4) > 0 Then;is number , > 0 [2] ;at least 1 > 0 :)
MsgBox(64,"1 nums",$MB_4)
$MB=$MB_4
Else;nothing found
MsgBox(64,"Error ...","Can't find the MB ... Exit now")
Exit
EndIf
EndIf
EndIf
EndIf
Edited by d4rk

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Share this post


Link to post
Share on other sites
ResNullius

You could also clean this up and avoid the confusion of nested If/Then statements by using a Select/Case construct.

This should do the same thing:

Dim $Source, $Position, $raw
Dim $MB, $MB_1, $MB_2, $MB_3, $MB_4

$Source = _IEDocReadHTML($IE);source
$Position = StringInStr($Source, '(MB)', 2);41 511
$raw = StringMid($Source, $Position, 75);take 75 chars from the '(MB)' [...<B>2222</B>]
MsgBox(64, "", $raw);ok
$MB_1 = StringRight($raw, 4);Take 4 chars from right to trip off </B> then for the greatest case : 2222
MsgBox(64, "just show", $MB_1)

;Dim $MB_2 ;if you want to declare these, do so at beginning of script
;Dim $MB_3 ; along with other variables

$MB_2 = StringRight($raw, 3)
$MB_3 = StringRight($raw, 2)
$MB_4 = StringRight($raw, 1)

;--------------

Select
    Case Number($MB_1) > 1 ;is number , > 1 [2222]
        MsgBox(64, "4 nums", $MB_1)
        $MB = $MB_1
        ;--------------------------
    Case Number($MB_2) > 1 ;is number , > 1 [222]
        MsgBox(64, "3 nums", $MB_2)
        $MB = $MB_2
        ;--------------------------
    Case Number($MB_3) > 1 ;is number , > 1 [22]
        MsgBox(64, "2 nums", $MB_3)
        $MB = $MB_3
        ;--------------------------
    Case Number($MB_4) > 0 ;is number , > 0 [2] ;at least 1 > 0 :)
        MsgBox(64, "1 nums", $MB_4)
        $MB = $MB_4
        ;--------------------------
    Case Else;nothing found
        MsgBox(64, "Error ...", "Can't find the MB ... Exit now")
        Exit
EndSelect

Share this post


Link to post
Share on other sites
d4rk

yes, i have thought about it before .... thanks


[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

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.