AutoHotkey Community

It is currently May 25th, 2012, 2:09 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 14 posts ] 
Author Message
PostPosted: May 5th, 2004, 3:19 pm 
Offline

Joined: May 4th, 2004, 3:18 pm
Posts: 7
Is there a way to read specific lines on a page to a variable. Ideally, something where you enter the x/y coordinates and a length???

Or is there some other way???

Thanks...Mike


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 5th, 2004, 3:40 pm 
Offline

Joined: March 28th, 2004, 3:53 pm
Posts: 1865
its better to start a new thread instead of PMs as u'll get more diverse solutions.... btw did u get any success with the methods i suggested?

here's one more (though its VERY selective with the windows it works with). here u can read any line from a window:

Code:
ControlGet, test, Line, 2, Edit1, ahk_class Notepad
msgbox, %test%


it'll always read the 2nd line in notepad window. try if it works with ur browser.

and btw... u should've started this thread in the support sub-forum, this is for posting working nifty scripts etc.... beleive me Chris will head to support sub-forum first if both the sub-forums have new posts! :)

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 5th, 2004, 4:23 pm 
Offline

Joined: May 4th, 2004, 3:18 pm
Posts: 7
looks like I posted this inth eincorrect place...I'll move it to support....Sorry


Report this post
Top
 Profile  
Reply with quote  
 Post subject: using ControlGet
PostPosted: May 5th, 2004, 6:00 pm 
Offline

Joined: May 4th, 2004, 3:18 pm
Posts: 7
I tried copying it into Notepad using ControlGet Line to read it, but that did not work...My next attempt is to use MouseClickDrag and ControlGet Selected


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 5th, 2004, 6:27 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
ControlGet, OutputVar, Line ...
The above should definitely work with Notepad, at least under XP. It does for us anyway.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: interim solution
PostPosted: May 5th, 2004, 8:16 pm 
Offline

Joined: May 4th, 2004, 3:18 pm
Posts: 7
what I wound up doing was to used MouseClickDrag to select the text, then 2 LeftClicks do a EDIT/COPY to clipboard on the browser, and MSGbox displays correct text...(see below)

Very messy...I'd like a cleaner way..any input appreciated...

MouseClickDrag, Left, 86,400, 409, 411
Sleep, 2000
LeftClick, 57, 45
Sleep, 100
LeftClick, 80, 86
Sleep, 100
ClipWait
MsgBox, Control-C copied the following contents to the clipboard:`n`n%clipboard%
sleep, 100


Report this post
Top
 Profile  
Reply with quote  
 Post subject: slightly better...
PostPosted: May 5th, 2004, 9:01 pm 
Offline

Joined: May 4th, 2004, 3:18 pm
Posts: 7
MouseClickDrag, Left, 86,400, 409, 411
sleep, 2000
Send,!e
sleep 200
send ^c
sleep, 2000
ClipWait
MsgBox, Control-C copied the following contents to the clipboard:`n`n%clipboard%


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 5th, 2004, 11:21 pm 
Offline

Joined: April 15th, 2004, 5:33 pm
Posts: 181
If you're talking about a webpage, I assume that parsing its source code would be a faster and more reliable option as to work with mouse moves, clipboard copies etc.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 6th, 2004, 1:49 am 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
That's a good point. If this is of interest, you can either have the browser save the page for you and then read the contents of the file, or use URLDownloadToFile to directly download the file to disk.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 6th, 2004, 10:58 am 
Offline

Joined: March 28th, 2004, 3:53 pm
Posts: 1865
Chris & Beastmaster,

i don't think he had much luck with those methods, as these (& a couple more) i've already suggested to him... but he didn't tell me about the results, though what he came up with was the mouse usage script.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject: can't read source
PostPosted: May 6th, 2004, 3:14 pm 
Offline

Joined: May 4th, 2004, 3:18 pm
Posts: 7
yea...I can't read the source because it's a home grown java applet page. (Sorry for saying it was a html page, my mistake). So I'm stuck using the mouse commands.

Like I stated prior, a command that reads starting at x/y coordinates would work best in this instance. But the mouse commands worked and is succeptible to error when you touch the mouse. Can I give the script full control of the mouse?

Mike


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 6th, 2004, 3:48 pm 
Offline

Joined: March 2nd, 2004, 10:10 pm
Posts: 443
Location: SLC, Utah
Code:
BlockInput, On
MouseClickDrag, Left, 86,400, 409, 411
BlockInput, Off
sleep, 2000
BlockInput, On
Send,!e
BlockInput, Off
sleep 200
BlockInput, On
send ^c
BlockInput, Off
sleep, 2000
ClipWait
MsgBox, Control-C copied the following contents to the clipboard:`n`n%clipboard%


Report this post
Top
 Profile  
Reply with quote  
 Post subject: twist to the problem
PostPosted: May 18th, 2004, 4:37 pm 
Offline

Joined: May 18th, 2004, 7:25 am
Posts: 7
I think I can use part of the code above. Here's my dilema. Suppose there's a table of
values. Let's say 10 columns across & 150 rows down, such as the example below. How can
I either 1) double click on one of the location values, let's say 2/a, and have autohotkeys
copy the all the values in that row into seperate variables, or 2) have an input box pop
up with a key combo (hotkey I think it's called) when I'm looking at this webpage, I can
type in the location value & copy values for that whole row into variables. Sorry the bbs keeps removing the tab spaces in the table below.


location total down busy working ..............
1/a 100 25 75

1/b 200 25 175

1/c 100 25 25 0

1/d 100 25 25 "blank"

2/a 100 25 75

.
.
.

_________________
Must nothing. There's always another way.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 18th, 2004, 11:54 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
If the web page is something you can save as a text or html file, it might be easiest to do so (perhaps using File->Save or the URLDownloadToFile command) and then use a Loop (read file contents) to read each line.

Here is a general example from the help file:
Code:
; To parse a comma separated value (CSV) file:
Loop, read, C:\Database Export.csv, CSV
{
   LineNumber = %A_Index%
   Loop, parse, A_LoopReadLine, CSV
   {
      MsgBox, 4, , Field %LineNumber%-%A_Index% is:`n%A_LoopField%`n`nContinue?
      IfMsgBox, NO, return
   }
}


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Exabot [Bot], Google [Bot], Ohnitiel, sks, Yahoo [Bot] and 14 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