d4rk Posted May 28, 2008 Posted May 28, 2008 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
amokoura Posted May 28, 2008 Posted May 28, 2008 (edited) 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 May 28, 2008 by amokoura
ResNullius Posted May 28, 2008 Posted May 28, 2008 (edited) 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 ? thanksYes, 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 May 28, 2008 by ResNullius
torels Posted May 28, 2008 Posted May 28, 2008 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
d4rk Posted May 29, 2008 Author Posted May 29, 2008 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
d4rk Posted May 29, 2008 Author Posted May 29, 2008 (edited) Actually i change the target, it should not too long and common like that ... and here's my code expandcollapse popup$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 May 29, 2008 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
ResNullius Posted May 29, 2008 Posted May 29, 2008 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: expandcollapse popupDim $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
d4rk Posted May 29, 2008 Author Posted May 29, 2008 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now