Jump to content

Unable to read gif image


Recommended Posts

  • Moderators

sammy1983,

Sorry for the delay - dinner got in the way. :)

This works for me based on your posted result:

#include <StringConstants.au3>
#include <MsgBoxConstants.au3>

$sText = "" & @CRLF & _
    "" & @CRLF & _
    "Verizon Wireless" & @CRLF & _
    "" & @CRLF & _
    "Post Office Box 660108" & @CRLF & _
    "" & @CRLF & _
    "Dallas, TX 75266-0108"

; Force all EOL to @CRLF
$sText = StringRegExpReplace($sText, "((?<!\x0d)\x0a|\x0d(?!\x0a))", @CRLF)
; Convert double @CRLF to single
$sText = StringReplace($sText, @CRLF & @CRLF, @CRLF)
; Split the last line
$sText = StringRegExpReplace($sText, "(.*),\s(..)\s(\d.*)", "$1" & @CRLF & "$2" & @CRLF & "$3")
; Remove the leading @CRLF
$sText = StringStripWS($sText, $STR_STRIPLEADING)

MsgBox($MB_SYSTEMMODAL, "Result", "-" & @CRLF & $sText & @CRLF & "-")
How does it do on teh real thing? :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

sammy1983,

Sorry for the delay - dinner got in the way. :)

This works for me based on your posted result:

#include <StringConstants.au3>
#include <MsgBoxConstants.au3>

$sText = "" & @CRLF & _
    "" & @CRLF & _
    "Verizon Wireless" & @CRLF & _
    "" & @CRLF & _
    "Post Office Box 660108" & @CRLF & _
    "" & @CRLF & _
    "Dallas, TX 75266-0108"

; Force all EOL to @CRLF
$sText = StringRegExpReplace($sText, "((?<!\x0d)\x0a|\x0d(?!\x0a))", @CRLF)
; Convert double @CRLF to single
$sText = StringReplace($sText, @CRLF & @CRLF, @CRLF)
; Split the last line
$sText = StringRegExpReplace($sText, "(.*),\s(..)\s(\d.*)", "$1" & @CRLF & "$2" & @CRLF & "$3")
; Remove the leading @CRLF
$sText = StringStripWS($sText, $STR_STRIPLEADING)

MsgBox($MB_SYSTEMMODAL, "Result", "-" & @CRLF & $sText & @CRLF & "-")
How does it do on teh real thing? :huh:

M23

 

 

But here you are assigning the address to a variable already. So will this work out? Sorry if I am asking anything wrong. Just a doubt.

Link to comment
Share on other sites

  • Moderators

sammy1983,

Just replace the initial assignment with this:

$sText = _IEPropertyGet($oQuery3, "innertext") ; Taken from JohnOne's example
Then it will contain the text you get from your site. If it is indeed in the format you described than the code should produce what you want. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

sammy1983,

Sorry about that - just replace this line:

; Split the last line
$sText = StringRegExpReplace($sText, "(.*),\s(..)\s(\d*)-(\d*)", "$1" & @CRLF & "$2" & @CRLF & "$3" & @CRLF & "$4")
and you should get that final split as well/ ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

sammy1983,

Sorry about that - just replace this line:

; Split the last line
$sText = StringRegExpReplace($sText, "(.*),\s(..)\s(\d*)-(\d*)", "$1" & @CRLF & "$2" & @CRLF & "$3" & @CRLF & "$4")
and you should get that final split as well/ ;)

M23

 

 

Thanks Melba. I tried and it worked. But I found another interesting thing. I didn't want to remove any of your codes but in the process of understanding how each code works, I found that using below code itself brings what I needed and the output is same. Any comments?

Local $oQuery3 = _IEGetObjByName($oIE, "mailaddrbyzipcode")
$sText = _IEPropertyGet($oQuery3, "innertext")
$Address = StringRegExpReplace($sText, "(.*),s(..)s(d*)-(d*)", "$1" & @CRLF & "$2" & @CRLF & "$3" & @CRLF & "$4")
MsgBox(0,"Result", $Address)
Link to comment
Share on other sites

  • Moderators

sammy1983,

 

Any comments?

Yes. The format of the return from the site is not as you suggested and is actually a little simpler. The code I gave you forced all EOLs into @CRLF and then reduced any double @CRLF into singles - it seems that you actually have only single @CRLF EOLs so that part was unnecessary, along with the removal of the leading blank line implied by your earlier posts. So you get the result without all the clever bits to ensure that the EOLs were standardised. :)

No harm done - the final RegEx that you are using was the key item. I am just glad it worked after the build-up you gave me! ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

sammy1983,

 

Yes. The format of the return from the site is not as you suggested and is actually a little simpler. The code I gave you forced all EOLs into @CRLF and then reduced any double @CRLF into singles - it seems that you actually have only single @CRLF EOLs so that part was unnecessary, along with the removal of the leading blank line implied by your earlier posts. So you get the result without all the clever bits to ensure that the EOLs were standardised. :)

No harm done - the final RegEx that you are using was the key item. I am just glad it worked after the build-up you gave me! ;)

M23

 

Honestly, no build-up.  :D  You are Genius and no denial. Thanks for everything and now I have to sit and figure out how to put each line in excel cell. Thanks a ton, again.

Link to comment
Share on other sites

  • Moderators

sammy1983,

Just split the string on @CRLF:

$aAddress = StringSplit(StringRegExpReplace($sText, "(.*),\s(..)\s(\d*)-(\d*)", "$1" & @CRLF & "$2" & @CRLF & "$3" & @CRLF & "$4"), @CRLF, 3) ; $STR_ENTIRESPLIT (1) + $STR_NOCOUNT (2)
Now you can loop through the array to get each separate part. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

MsgBox(0,"Result", $aAddress)

MsgBox(0,"Result", $aAddress[$i])

or

ConsoleWrite( $aAddress[$i] & @CRLF)

EDITL

also

For $i = 1 to $aAddress[0]

For $i = 0 to Ubound($aAddress) -1

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

I tried below code and got it in Msgbox

Local $aAddress = StringSplit(StringRegExpReplace($sText, "(.*),s(..)s(d*)-(d*)", "$1" & @CRLF & "$2" & @CRLF & "$3" & @CRLF & "$4"), @CRLF)
 
For $i = 1 to $aAddress[0]
MsgBox(0,"Result", $aAddress[$i])
Next
 
Not sure how to assign each in variable?
Link to comment
Share on other sites

MsgBox(0,"Result", $aAddress)

MsgBox(0,"Result", $aAddress[$i])

or

ConsoleWrite( $aAddress[$i] & @CRLF)

EDITL

also

For $i = 1 to $aAddress[0]

For $i = 0 to Ubound($aAddress) -1

 

Made the changes as suggested, JohnOne. Now thinking how to assign to the values to variable?

Link to comment
Share on other sites

  • Moderators

sammy1983,

Glad we could help. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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