Jump to content
Sign in to follow this  
reb

String Extraction Problem

Recommended Posts

reb

I want to get the date such as April 17, 2012

I can not get Apr=il 17, 2012 as yet

What am I doing wrong?

REB

global $Info[4]
$Info[0] = '"dana, Arial, Helvetica, sans-serif" ><b>Your account balance(s) as of Apr=il 17, 2012</b></font><br /><br/></td>'
$Info[1] = 'dana, Arial, Helvetica, sans-serif" ><b>Your account balance(s) as of Jun=e 03, 2013</b></font><br /><br/></td>'
$Info[2] = 'dana, Arial, Helvetica, sans-serif" ><b>Your account balance(s) as of Aug=ust 02, 2012</b></font><br /><br/></td>'
$Info[3] = 'dana, Arial, Helvetica, sans-serif" ><b>Your account balance(s) as of Jan=uary 20, 2012</b></font><br /><br/></td>'
;~ $Info[4] = '
for $i = 0 to 3
$date = $Info[$i]



$Start = StringInStr($Date, "of ")+1
;~ MsgBox(0,$i & "$start",$Start)
$Stringlength = StringLen($date)
$Intermediate = StringRight($date,$Stringlength - $Start)
;~ MsgBox(0,$i & " $Intermediate",$Intermediate)
;~ $End = StringInStr($Intermediate,"<",0,1,1,20)
$end = StringInStr ($Intermediate,",",0,1)
$Stringlength2 = StringLen($Intermediate)
;~ MsgBox(0,$i & " Final",StringLeft($Intermediate,$Stringlength2 - $end ))
ConsoleWrite(StringLeft($Intermediate,$Stringlength2 - $end ) & "   " & $i & @CRLF)
Next

MEASURE TWICE - CUT ONCE

Share this post


Link to post
Share on other sites
reb

They come from Windows live mail   "Filename.eml"

I hard coded some I had extracted from my E-Mails for my example

Thank for the reply

REB


MEASURE TWICE - CUT ONCE

Share this post


Link to post
Share on other sites
Edano

;http://www.autoitscript.com/forum/topic/153496-string-extraction-problem/
;Post #1
;D:\DOKUME~1\ADMINI~1\LOKALE~1\Temp\SLICER\Avatar\default_large.png
;by reb

;Script grabbed by SLICER by Edano here: http://www.autoitscript.com/forum/topic/152402-slicer-autoit-forum-script-grabber/?p=1093575

global $Info[4]
$Info[0] = '"dana, Arial, Helvetica, sans-serif" ><b>Your account balance(s) as of Apr=il 17, 2012</b></font><br /><br/></td>'
$Info[1] = 'dana, Arial, Helvetica, sans-serif" ><b>Your account balance(s) as of Jun=e 03, 2013</b></font><br /><br/></td>'
$Info[2] = 'dana, Arial, Helvetica, sans-serif" ><b>Your account balance(s) as of Aug=ust 02, 2012</b></font><br /><br/></td>'
$Info[3] = 'dana, Arial, Helvetica, sans-serif" ><b>Your account balance(s) as of Jan=uary 20, 2012</b></font><br /><br/></td>'
;~ $Info[4] = '
for $i = 0 to 3
    $date = $Info[$i]

    $t=StringSplit($date,"of ",1)
    If $t[0]>1 Then
        $ret=StringSplit($t[2],"<")
        ConsoleWrite($ret[1] & "   " & $i & @CRLF)
    EndIf
Next


[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites
jaberwacky

They come from Windows live mail   "Filename.eml"

I hard coded some I had extracted from my E-Mails for my example

Thank for the reply

REB

Then I think the StringReplace(...) function will suit your needs.

Share this post


Link to post
Share on other sites
reb

Edano

Works great!

Never would have thought of that.

Thank you very much

REB


MEASURE TWICE - CUT ONCE

Share this post


Link to post
Share on other sites
0xdefea7

global $Info[4]
$Info[0] = '"dana, Arial, Helvetica, sans-serif" ><b>Your account balance(s) as of Apr=il 17, 2012</b></font><br /><br/></td>'
$Info[1] = 'dana, Arial, Helvetica, sans-serif" ><b>Your account balance(s) as of Jun=e 03, 2013</b></font><br /><br/></td>'
$Info[2] = 'dana, Arial, Helvetica, sans-serif" ><b>Your account balance(s) as of Aug=ust 02, 2012</b></font><br /><br/></td>'
$Info[3] = 'dana, Arial, Helvetica, sans-serif" ><b>Your account balance(s) as of Jan=uary 20, 2012</b></font><br /><br/></td>'

For $i = 1 To 4
    StringReplace($Info[$i], "=", "")
Next

As suggested above is cleaner..

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  

  • Similar Content

    • nooneclose
      By nooneclose
      I need help turning this string "20180913221626" into a formatted time string.
      I need to go from this: 20180913221626
      to this: 09/13/2018 10:16 PM
      I do not always know what the date will be so I can not just use a variable I need to actually convert/format. 
      I did see an older post in the forms that was basically the same question only the other guy did not post the working code and I can not figure out how to use _AD_GetObjectProperties properly to get what I want. 
      As always any help would be appreciated. 
      Here is the code I use to find the date, but it always gives me the unformatted version. 
      ;retrieve the items object $oItem = $oOutlook.Session.GetItemFromID($aItems[1][0], Default) $oItem.GetInspector $eSentOn = $oItem.SentOn ; When was the email sent? MsgBox("", "Sent On of the email", $eSentOn) ;******************************************************************************* ; Formats the date and time from the email ;******************************************************************************* ;Local $fDatenTime = _DateTimeFormat($eSentOn, 1) ;MsgBox("", "Formatted email time", $fDatenTime) $aProperties = _AD_GetObjectProperties($eSentOn) _ArrayDisplay($aProperties, "Did the conversion work?")  
    • Miliardsto
      By Miliardsto
      I got that func
      Func makeHelpImgGUI($title,$width,$height,$img) $img = GUICtrlCreatePic("",20,40,$width,$height) _ResourceSetImageToCtrl($img, "HERE") EndFunc and I call this func like that
      makeHelpImgGUI("Image",1190, 800,$SETTINGS_JPG)  
      so what is the problem in the parameter where is - "HERE" I need value of img but passed as string
      so $img = $SETTINGS_JPG and how make it "SETTINGS_JPG"
       
      I tried something like that but not work
      Func makeHelpImgGUI($title,$width,$height,$img) $name_str = String($img) $name_str = StringTrimLeft ($name_str, 1 ) $img = GUICtrlCreatePic("",20,40,$width,$height) _ResourceSetImageToCtrl($img, $name_str) EndFunc  
    • liagason
      By liagason
      Hello everyone,
      How can I display in ascending  sequence some numbers stored in a string variable?
      $str = "18,03,48,23" MsgBox(0,"test",$str) I would like it to display "03,18,23,48"
    • Rskm
      By Rskm
      Hi, I have the following line in a text file 'input.txt'. I know the line number - say '6'. I wish to replace the text 'WWW' in the below line with a random number (I can generate that with random()).
      WERIS  WWWJP   3.83  8.330  1.000                1097.RAXX 
      The WWW is a 3 digit integer (could be any number between 0 to 999), I can use stringtrimleft and get the numerical value of WWW in this file
      so, basically, I know the string to replace (ie; WWW stored in a variable), I know the line number to work on and the file location/name and the replacement variable (through random()). My requirement is to fill that 3 spaces with my random number (which Is a integer between 1 and 999)
      please put ur suggestions
       
    • nacerbaaziz
      By nacerbaaziz
      Hello Members of this best Forum
      i have a question please
      for example if i have a long string
      and i want to extract a text between two tag
      what i can do to make that?
      note :
      i know that there is a
      StringRegExp function
      it's do that work
      but it result is be as an array
      i want the result to be a string
      is there any function on autoit can do that?
      Thanks in advance.
×