I am kinda new to AHK, and I only have some basic scripting knowlege, so do forgive if this is a noob question. I have been trying to look this up myself, but not finding the useful answer i needed.
So to the point, I am trying to make a simple script with AHK to easaly download some PDF's that I need. I got a script working, however, using mousePos isent so useful when the link I need to click tends to move every now and then.
So I was thinking of a better way to use this script, and I was thinking, maybe if it can search for a specific text line, and click on it, everything should work as butter. However, I can't realy find a good and simple way to implement this to my code. Do belive me, I have been trying to find some tutorials and looking at the referance on AHK, but finding little help.
So this is the code I made and the part that is missing in it.. If anyone can help of point me in the right direction.
Yes I know this isent the best way to do the task I want to do, but it is a learning curve for me And do keep in mind that I'm new to this.
Thanks!
Code: Select all
Escape::
ExitApp
Return
X::
Send, ^c ; Copy text from excel window
Sleep, 100
Send, !{Tab} ; Tab to chrome
Sleep, 100
MouseClick, left, 950, 328 ; Clicking the search window for webpage
Sleep, 100
Send, ^a ; Select all
Sleep, 100
Send ^v ; Pasting search text from Excel
Sleep, 100
Send, {Enter} ; Search
Sleep, 4000 ; Waiting for page to load
# Something to search for the text "Technical drawings" and clicking it, sens this is a drop-down for the pdf download page, ideal if it changes the mousePos to this text aswell
Sleep, 100
MouseClick, left, pos, pos ; Clicking download link under drop-down, this line may be subject to change
Sleep, 4000 ; Waiting for page to load
Send, ^s ; Save as PDF
Sleep, 100
Send, ^v ; Paste search text as PDF name
Sleep, 100
Send, {Enter} ; Save the pdf
Sleep, 100
Send, !w ; Close tab with pdf
Sleep, 100
Send, !{Left} ; Go back to search page
Sleep, 100
Send, !{Tab} ; Tab back to Excel
Sleep, 100
Send, {Down} ; Move down a row in Excel
return