Jump to content

Recommended Posts

Posted

Hello AutoIT community. 

I am attempting to make a script that will login to my bank account and retrieve one of my account balances and display it in a MsgBox, however it am having some difficulty getting the correct value.... The MsgBox keep displaying a value of "0" instead of the actual string in between the source code I'm looking for.... Any help would be greatly appreciated!

$readtext = InetRead("https://www.xxxbanksitexxx.com/das/cgi-bin/session.cgi?screenid=SIGNON_PORTAL_PAUSE&LOB=CONS",1)
$source = BinaryToString($readtext)
$text =  _StringBetween($source,'CHECKING XXXXXXXXXX ', ' "> ')


MsgBox(0,"balance",$text)     ;This keeps returning a value of "0"


        Case $GUI_EVENT_CLOSE
           GUIDelete($Form1)
            ExitLoop
         Case $Button2
            GUIDelete($Form1)
            ExitLoop
    EndSwitch
WEnd

 

 

Posted (edited)

HI.   _StringBetween return an array.

try this way to see whole array.

$readtext = InetRead("https://www.xxxbanksitexxx.com/das/cgi-bin/session.cgi?screenid=SIGNON_PORTAL_PAUSE&LOB=CONS",1)
$source = BinaryToString($readtext)
$text =  _StringBetween($source,'CHECKING XXXXXXXXXX ', ' "> ')



_ArrayDisplay($text)


        Case $GUI_EVENT_CLOSE
           GUIDelete($Form1)
            ExitLoop
         Case $Button2
            GUIDelete($Form1)
            ExitLoop
    EndSwitch
WEnd

You should include #include <Array.au3>  for use _arraydisplay

Saludos

Edited by Danyfirex
Posted (edited)

Hi DanyFirex,

Thank you for your suggestion, however when i use _ArrayDisplay($text) I do not see anything on my screen.... Is there another command i need to do to see this text pop up? Here is what I have now

 

$readtext = InetRead("https:/xxxbanksitexxx.com/das/cgi-bin/session.cgi?screenid=SIGNON_PORTAL_PAUSE&amp;LOB=CONS",1)
$source = BinaryToString($readtext)
$text =  _StringBetween($source,'CHECKING XXXXXXXXXX&nbsp;','">')

_ArrayDisplay($text)

Edited by xiantez
Posted (edited)

If the _ArrayDisplay() function doesn't show anyting is because $text is not an array, and if is not an array is because the _StringBetween() function has found nothing.
Perhaps the start and end parameters that you use in the _StringBetween() function will not catch any string, try to use only "'CHECKING" as The beginning of the string to find and see if it will catch something.
Try this snippet to do a little debug:

#include <Array.au3>
#include <String.au3>

$readtext = InetRead("https:/xxxbanksitexxx.com/das/cgi-bin/session.cgi?screenid=SIGNON_PORTAL_PAUSE&amp;LOB=CONS", 1)
$source = BinaryToString($readtext)
$text = _StringBetween($source, 'CHECKING', '">')

If Not IsArray($text) Then
    MsgBox(0, "Debug", "No string found by _StringBetween()")
Else
    _ArrayDisplay($text)
EndIf

 

Edited by Chimp

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Posted

Have you checked the result of InetRead?

 
$readtext = InetRead("https://www.xxxbanksitexxx.com/das/cgi-bin/session.cgi?screenid=SIGNON_PORTAL_PAUSE&amp;LOB=CONS",1)
 $source = BinaryToString($readtext)
MsgBox(0,"Whole Text",$source)     ;This keeps returning a value of "0" 
 
 $text =  _StringBetween($source,'CHECKING XXXXXXXXXX&nbsp;', ' "> ') 


 MsgBox(0,"balance",$text[0])     ;This keeps returning a value of "0"

 

Posted

try to create a file with downloaded data and check if the field you need exist.

 

Saludos

Posted
9 hours ago, Chimp said:

If the _ArrayDisplay() function doesn't show anyting is because $text is not an array, and if is not an array is because the _StringBetween() function has found nothing.
Perhaps the start and end parameters that you use in the _StringBetween() function will not catch any string, try to use only "'CHECKING" as The beginning of the string to find and see if it will catch something.
Try this snippet to do a little debug:

#include <Array.au3>
#include <String.au3>

$readtext = InetRead("https:/xxxbanksitexxx.com/das/cgi-bin/session.cgi?screenid=SIGNON_PORTAL_PAUSE&amp;LOB=CONS", 1)
$source = BinaryToString($readtext)
$text = _StringBetween($source, 'CHECKING', '">')

If Not IsArray($text) Then
    MsgBox(0, "Debug", "No string found by _StringBetween()")
Else
    _ArrayDisplay($text)
EndIf

 

I think you are on to something Chimp.... My MsgBox was triggered due to not finding a string in the $source.... interesting....

I have questioned whether or not my InetRead is working properly.... I am not sure what source code I should be using now, i figured I could just log into my account, right click the main page and "get source code" would suffice..... I guess not.... =\ 

Posted
7 hours ago, AutoBert said:

Have you checked the result of InetRead?

 
$readtext = InetRead("https://www.xxxbanksitexxx.com/das/cgi-bin/session.cgi?screenid=SIGNON_PORTAL_PAUSE&amp;LOB=CONS",1)
 $source = BinaryToString($readtext)
MsgBox(0,"Whole Text",$source)     ;This keeps returning a value of "0" 
 
 $text =  _StringBetween($source,'CHECKING XXXXXXXXXX&nbsp;', ' "> ') 


 MsgBox(0,"balance",$text[0])     ;This keeps returning a value of "0"

 

AutoBert,

I am going to do this next... Thanks!!!

Posted (edited)

Well.... This is strange.....

I checked the results of my InetRead and used WriteFile.... The source code is not at all what I expected.... It is not even the same source code that I see when I "view source code" from my browser.... Grrrr, thats annoying lollll

I could only imagine they might be embedding this stuff into an applet or something... I did notice that when i view my checking account, the session ID in the URL changes constantly.... This is pretty standard in embedded applications via web front ends... I have no clue how to get around that though....

Here are the results of my INetRead when i write it into an html file...

 

2016-01-24_11-55-25.png

Edited by xiantez
Posted
Posted
5 minutes ago, Danyfirex said:

Of course. you need credentials. try to use  IE.

Saludos

Yes, my script  already knows how to log in and pass credentials.... that part works fine.... it not until it attempts to retrieve the source code is when i get those INetResults... I need to find a way to attach it to an existing session ID.... Because when my script makes the INetRead or _IEGetSource call, the website doesn't recognize the call from an existing session ID, thus timing me out....

I did find a work around using the following code

$rText = _IEBodyReadText($oIE)

FileWrite("source.txt",$rText)

Then I can just read the text from the file and output it to a msgbox.... Not my ideal way of doing it, but it works for now...

Posted

You dont need to write to a file. you can use  $rText  with _StringBetween

 

Saludos

Posted
3 minutes ago, Danyfirex said:

You dont need to write to a file. you can use  $rText  with _StringBetween

 

Saludos

Haha funny you said that... I just realized that... make those changes now! =)

Posted

I finally got the _ArrayDisplay to work... However it is putting the entire string in 1 row 1 column....

How do I manipulate the rows and colums so I can have a row for each account (checking, saving, ect)

 

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
×
×
  • Create New...