AutoHotkey Community

It is currently May 27th, 2012, 4:31 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 23 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: February 26th, 2010, 4:31 pm 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5480
Location: the tunnel(?=light)
Carcophan wrote:
Real trick will be, when I figure out what the difference between your and my examples.


There's not much difference, really. My example is faster due to a difference in how regex matches but on a sample size this small that difference is somewhat negligible. My example also captures the match itself in the variable, whereas yours captures a match and a subpattern (which is the match you really want) and you have to create an extra array variable for the match.

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 27th, 2010, 7:17 pm 
Offline

Joined: December 24th, 2008, 3:25 am
Posts: 1401
Location: :noitacoL
Just an update:


Replaced the old code, with new method, and I am actually still having the same issue. All content is still submitted to 'address3' is there is no appartment.


I am still fiddeling around with this, I did notice a few other little things, don't know if it is useful information though.




In your example you have "RegExReplace(var,"`n","`n",e)" so I added the variable 'e' to my msgbox output just to see what it shows, and for fun, did it with `r, adn `r`n:
RegExReplace(var,"`n","`n",e)
RegExReplace(var,"`r","`r",ee)
RegExReplace(var,"`r`n","`r`n",eee)

e, ee, and eee all equal '5' when there is no appartment listed in the customer information. It will show '6' when there IS an appartment listed. I have tried a dozen or so variations with the a_index and loop counters, trying to maybe adjust the loop or index to account for the blanks.

I set 'pos' to the msgbox too, it returns '62', but do not know exactly what '62' si refering too in the string.


Also, incase this matters as well, I used iWebBrowser2.5 to look up the acct info. What we call 'line1, line2, line3 and line4' are all <DIV= class...
The account number fiels (line5+) all start with <Div> Name_Here: <Span class....
My DOM/HTML is weak, but could the way they are referenced also be causing some issues?




I wish I could just talk to the developer of this app.... and choke the knowledge out of him. All of my probelms with AHK come from dealing with and manipulating code that is produced by other people. It is impossible to account for other peoples 'creativity' some times :evil: \


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 27th, 2010, 10:37 pm 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5480
Location: the tunnel(?=light)
So if you switch it from e=3 to e=5 in the code does it work?

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 28th, 2010, 12:54 am 
Offline

Joined: December 24th, 2008, 3:25 am
Posts: 1401
Location: :noitacoL
sinkfaze wrote:
So if you switch it from e=3 to e=5 in the code does it work?


In short, no.

I do remember trying e5 specifically, but I do not know what the loop counter was at the time. I think it was loop6 e5, but I got an anomaly.

What would normally be like 'line10' was on 'line #5' or something. I figured I broke something so I lowered the e and index numbers etc. . That happened with a few other combinations of loop and e/a_index tweeks too, some combinations left line1/2/3/4 blank, some populated the 1/2/3/all_information_to_4 error.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 28th, 2010, 7:53 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
Most of the code in this thread looks over-complicated to me. Would the following suffice?
Code:
var1=
(
Homer Simpson
123 Fake Street
SpringField, XY 01234
Account: 123456789123456789SSN: XXX-XX-XXXXHome Phone: (123) 123-1234Other Phone: (000) 000-0000Email Address: xyz@somewhere.commSecondaryEmail: noneBilling Address
)
var2=
(
Homer Simpson
123 Fake Street
Unit# 69-F
SpringField, XY 01234
Account: 123456789123456789SSN: XXX-XX-XXXXHome Phone: (123) 123-1234Other Phone: (000) 000-0000Email Address: xyz@somewhere.commSecondaryEmail: noneBilling Address
)

Loop 2 ; Test both vars.
{
    i = 0
    Loop, Parse, var%A_Index%, `n, `r
    {
        if SubStr(A_LoopField,1,8)="Account:"
            break
        i += 1
        Info%i% := A_LoopField
    }
    while i++ < 4
        Info%i% =

    MsgBox,
    (LTrim
    CustName: %Info1%
    Address1: %Info2%
    Address2: %Info3%
    Address3: %Info4%
    .......
    )
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 28th, 2010, 4:20 pm 
Offline

Joined: December 24th, 2008, 3:25 am
Posts: 1401
Location: :noitacoL
Lexikos wrote:
Would the following suffice?
Code:
Loop 2 ; Test both vars.
{
    i = 0
    Loop, Parse, var%A_Index%, `n, `r
    {
        if SubStr(A_LoopField,1,8)="Account:"
            break
        i += 1
        Info%i% := A_LoopField
    }
    while i++ < 4
        Info%i% =

}


I will deff test and find out, thank you.

Your comment 'test both vars', in an every day situation it would only have a single variable to check (clipboard), it looks like it would still work with only 'loop', instead of 'loop 2'. I will let you know tomorrow :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 1st, 2010, 8:55 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
That was only to demonstrate that it works with either input. You should remove the outer loop entirely and replace "var%A_Index%" with the appropriate variable name. :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 1st, 2010, 3:26 pm 
Offline

Joined: December 24th, 2008, 3:25 am
Posts: 1401
Location: :noitacoL
Lexikos wrote:
That was only to demonstrate that it works with either input. You should remove the outer loop entirely and replace "var%A_Index%" with the appropriate variable name. :)


:shock: Yea... sorry about that. I was in 'weekend mode' and not exactly in the right frame of mind :twisted:

I plugged this in this morning, and it does work. Thank you for this. I tested it on both type of accounts and the 'line3' is no longer an issue/error.

Its funny(annoying) how I easily overlook the simplest solution and jump strait for the complicated, so often.

Thanks Sinkfaze for all your time with this too


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ]  Go to page Previous  1, 2

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Mickers, rbrtryn and 67 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group