AutoHotkey Community

It is currently May 27th, 2012, 10:12 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 34 posts ]  Go to page 1, 2, 3  Next
Author Message
PostPosted: October 27th, 2004, 1:34 am 
Offline

Joined: October 27th, 2004, 1:22 am
Posts: 64
Location: GA
I am trying to move the mouse automatically to the audiofile link in a webster.com. For example: http://www.webster.com/cgi-bin/dictiona ... &va=window , in this webpage I want the mouse to automatically locate the audio link (indicated by red speaker symbol)beside the word "window", instead of assigning the x, y, coordinates in the script.
So is it possible?

Please help me if it is possible<<
Thanks in advance :)

Below is the part of my text
Basically i am copying the words from my vocabulary list and trying to get the audio file for them from the webster.com.

WinWait, Maintain cards,
IfWinNotActive, Maintain cards, , WinActivate, Maintain cards,
WinWaitActive, Maintain cards,
MouseClick, left, 71, 660
Sleep, 100
Send, {DOWN}
MouseClick, left, 74, 57
MouseClick, left, 74, 57
Sleep, 100
Send, {CTRLDOWN}c{CTRLUP}
WinWait, Merriam-Webster Online - Microsoft Internet Explorer,
IfWinNotActive, Merriam-Webster Online - Microsoft Internet Explorer, , WinActivate, Merriam-Webster Online - Microsoft Internet Explorer,
WinWaitActive, Merriam-Webster Online - Microsoft Internet Explorer,
MouseClick, left, 615, 438
Sleep, 100
Send, {CTRLDOWN}v{CTRLUP}{ENTER}

__________________ I need some thing here that will automatically click on the audio link
WinWait, http://www.webster.com - Merriam-Webster Pronunciation - Microsoft Internet Explorer,
IfWinNotActive, http://www.webster.com - Merriam-Webster Pronunciation - Microsoft Internet Explorer, , WinActivate, http://www.webster.com - Merriam-Webster Pronunciation - Microsoft Internet Explorer,
WinWaitActive, http://www.webster.com - Merriam-Webster Pronunciation - Microsoft Internet Explorer,
MouseClick, right, 182, 268
Sleep, 100

Orange part is to search the word and blue part of the script is to open the audio link, And I need help with the green line. :(


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 27th, 2004, 4:26 am 
Offline

Joined: October 12th, 2004, 11:34 pm
Posts: 74
Location: São Paulo ,Brazil
You can try "PixelSearch".If there are other web page element with same colors you can try PixelSearch
combined with "StatusBarGetText"


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 27th, 2004, 6:44 am 
Offline

Joined: April 1st, 2004, 12:00 am
Posts: 87
Location: Philippines
Well, if it is a link, you could try tabbing. Press f6 on the page (sets focus on the address bar, so you always start at the same place) , then count the tabs. Also, if the number of links change.. well, the only way would be, yes, StatusBarGetText.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 27th, 2004, 9:13 am 
Offline

Joined: October 12th, 2004, 11:34 pm
Posts: 74
Location: São Paulo ,Brazil
Quote:
Well, if it is a link, you could try tabbing

Yes.Much better.Completely forgot tabbing! :?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 27th, 2004, 12:47 pm 
Thank you guys,
Now let me follow your advise. It will take atleast few hours to do this, and I will see how it turns out since i am still new to this whole sript writing business i might encounter some problems.. .

I will let u know...


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 27th, 2004, 12:58 pm 
The below script detects the position of an known link on a webpage (and clicks it)

1) it needs AHK's release 1.0.22
2) :!: add a hotkey to break the loop, you won't be able to use the mouse for that :!:
3) for testing I've used AHK's forum (and the link assigend to its Forum Image)
4) Uncommented :roll:
5) Tested 8)
6) MouseMove is unfortunately quite slow


Code:
SetTitleMatchMode, 2
WinActivate, AutoHotkey
Y = 152   

Loop
   {
   X ++
   If X = 255
   ; %A_ScreenWidth%
      {
      X = 1
      Y ++
      }
      If Y = 132
      ; %A_ScreenHeight%
         ExitApp
   MouseMove,%X%,%Y%, 0
   StatusBarGetText, OutputVar, 1, AutoHotkey
   If OutputVar = http://www.autohotkey.com/
      {
      MouseClick, L,,, 2
      Break
      }
   }


8)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 27th, 2004, 1:04 pm 
The below script detects the position of an known link on a webpage (and clicks it)

1) it needs AHK's release 1.0.22
2) add a hotkey to break the loop, you won't be able to use the mouse for that
3) for testing I've used AHK's forum (and the link assigend to its Forum Image)
4) Uncommented
5) Tested
6) MouseMove is unfortunately quite slow


Quote:
SetTitleMatchMode, 2
WinActivate, AutoHotkey
Y = 1

Loop
{
X ++
If X = %A_ScreenWidth%
{
X = 1
Y ++
}
If Y = %A_ScreenHeight%
ExitApp
MouseMove,%X%,%Y%, 0
StatusBarGetText, OutputVar, 1, AutoHotkey
If OutputVar = http://www.autohotkey.com/
{
MouseClick, L,,, 2
Break
}
}


Edited the script


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 27th, 2004, 1:22 pm 
Thank for the script,

but i notice that mouse searching in really close lines, is it possible for the arrow to skip a line, for example, as if it is searchin only every other line?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 27th, 2004, 1:32 pm 
Looks like you can make it this way:

use AHK's URLDownloadToFile to get the page ( (its source code)
parse it for "the link"
Quote:
javascript:popWin('/cgi-bin/audio.pl?window01.wav=window')


Replace this:
Quote:
javascript:popWin('/cgi-bin/audio.pl?window01.wav=window')


with that:
Quote:
http://www.webster.com/cgi-bin/audio.pl?window01.wav=window


Execute such link from within your script

Code:
Run, iexplore http://www.webster.com/cgi-bin/audio.pl?window01.wav=window,, Hide


8)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 27th, 2004, 1:55 pm 
Offline

Joined: April 1st, 2004, 12:00 am
Posts: 87
Location: Philippines
Um.. you might want to try this as well, it doesn't need to download the page (though there is a condition that it may fail; I'll explain later:
Code:
SetTitleMatchmode, 2
SetKeydelay, 0
winactivate, Merriam-Webster
winwait, Merriam-Webster
javscript = javascript:popWin('/cgi-bin/audio.pl?
Send, {f6}
Send, javascript:document.links[50].focus()
sleep, 10
send, {enter}
sleep, 100
StatusBarGetText, statbar, 1, a
ifinstring, statbar, %javscript%
{
   Send, {enter}
}
else
{
   Send, {f6}
   Send, javascript:document.links[51].focus(){enter}
        sleep, 10
        send, {enter}
        sleep, 100
   ifinstring, statbar, %javscript%
   {
      Send, {enter}
   }
}
return

Thing is, this checks twice. There have been only 2 page orders that I have seen, and there may be more, depending on the links on the page. But I think this will work on most cases. Tell me if there's a problem.

Oh yeah.. this needs that the page has been loaded. So.. you may want to put a little 'sleep' before this is run. :P


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 27th, 2004, 2:38 pm 
Mine is working without seeing the browser. Why not tweak it and use a hotkey to copy a selected word to the clipboard and use it to search for in the background ?

I've tested this one with bumblebee :D and it worked fine 8)

Code:
SetBatchLines -1
MyWord = bumblebee

URLDownloadToFile, http://www.webster.com/cgi-bin/dictionary?book=Dictionary&va=%MyWord%, Webster.txt
IfErrorlevel = 0
   Loop, Read, Webster.txt
      {
      IfInString, A_LoopReadLine, .wav=%MyWord%
         {
         StringGetPos, OutputVar, A_LoopReadLine, .wav
         Outputvar -= 7
         StringMid, SoundFile, A_LoopReadLine, %OutputVar%, 8
         Run, "C:\Program Files\Internet Explorer\IEXPLORE.EXE" "http://www.webster.com/cgi-bin/audio.pl?%SoundFile%.wav=%MyWord%",, Hide
         Break
         }
      }
      Exit


8)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 27th, 2004, 2:46 pm 
@ tpatel5
Sorry that I've ignored your code. Reason: if possible I try to not to cruise through a frontend as in most cases its tough task to get something reliable out of it :wink: .


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 27th, 2004, 3:04 pm 
Offline

Joined: April 1st, 2004, 12:00 am
Posts: 87
Location: Philippines
ooh... nice. Well, ya learn something new everyday.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 27th, 2004, 3:16 pm 
It's even possible to download such a soundfile i.e. to create your own bumblebee collection !

bssssssss ...


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 27th, 2004, 3:34 pm 
Offline

Joined: October 27th, 2004, 1:22 am
Posts: 64
Location: GA
Sorry bobo to bother you,
Your Sricpt is working fine but i can't understad what it does. So can you explain what does your script does? Does it downloading the file somewhere, or getting the url or something?


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], BrandonHotkey, Maestr0 and 63 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