Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

how to automatically run a script when an image loads on web



  • Please log in to reply
64 replies to this topic
smorgasboard
  • Members
  • 660 posts
  • Last active: Jan 14 2016 08:53 AM
  • Joined: 18 Jul 2012
how to automatically run a script when an image loadson a webpage

thnx a millions in advance

Pulover
  • Members
  • 1596 posts
  • Last active: Apr 06 2016 04:00 AM
  • Joined: 20 Apr 2012
✓  Best Answer
To search for the image you will need the ImageSearch command. You may use SetTimer to keep searching for it.

Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer) | Class_LV_Rows - Copy, Cut, Paste and Drag ListViews | Class_Toolbar - Create and modify | Class_Rebar - Adjustable GUI controls

Join the New AutoHotkey Forum!


smorgasboard
  • Members
  • 660 posts
  • Last active: Jan 14 2016 08:53 AM
  • Joined: 18 Jul 2012
<!-- m -->http://www.google.co... ... wAg&itbs=1<!-- m -->

smorgasboard
  • Members
  • 660 posts
  • Last active: Jan 14 2016 08:53 AM
  • Joined: 18 Jul 2012
<!-- m -->http://helpspa.com/w... ... E_ref1.gif<!-- m -->

sir tell how to run a script the moment this icon as shown in the image above loads

thnx.

btw ..ahk is really awesome

Pulover
  • Members
  • 1596 posts
  • Last active: Apr 06 2016 04:00 AM
  • Joined: 20 Apr 2012
I gave you the commands you need. Please try to do a search: <!-- m -->http://www.google.co... wait for image<!-- m -->

Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer) | Class_LV_Rows - Copy, Cut, Paste and Drag ListViews | Class_Toolbar - Create and modify | Class_Rebar - Adjustable GUI controls

Join the New AutoHotkey Forum!


smorgasboard
  • Members
  • 660 posts
  • Last active: Jan 14 2016 08:53 AM
  • Joined: 18 Jul 2012
thnks pulover sir..
i think i am unable to understand the searchimage command and how to use it

please give me an example ..let us say if i want to search the logo of google and execute a set of keys when it appears
....thnks in advance

Pulover
  • Members
  • 1596 posts
  • Last active: Apr 06 2016 04:00 AM
  • Joined: 20 Apr 2012
Okay, dude... but try to search the forum from now on, there are many examples, ok?
This script will search for the image of the file you put in "ImageFile". F2 will toggle the timed search on/off.
You may want to try my Macro Creator, it features this function and can help you create the script faster. It also has a 'Make Screenshot' feature.
[color=#008000]; This script was created using Pulover's Macro Creator[/color]

#NoEnv
SetWorkingDir %A_ScriptDir%
SetBatchLines, -1
CoordMode, Pixel, Screen

[color=#008000]; Make a ScreenShot with the image and place it in the same directory of the script.[/color]
ImageFile := "ScreenShot.png" ; Name of the image file from screenshot.

F2::  [color=#008000]; Toggles search timer on/off[/color]
SetTimer, SearchImage, % If (k := !k) ? 100 : "off"
TrayTip,, % If (t := !t) ? "On" : "Off"
return

SearchImage:
ImageSearch, FoundX, FoundY, 0, 0, %A_ScreenWidth%, %A_ScreenHeight%, %ImageFile%
If ErrorLevel = 0 [color=#008000] ; Put your code inside the braces below.[/color]
{
	MsgBox, 49, Continue?, Image / Pixel Found at %FoundX%x%FoundY%.`nPress OK to continue.
	IfMsgBox, Cancel
	{
		SetTimer, SearchImage, off
		TrayTip,, Off
	}
}
return

Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer) | Class_LV_Rows - Copy, Cut, Paste and Drag ListViews | Class_Toolbar - Create and modify | Class_Rebar - Adjustable GUI controls

Join the New AutoHotkey Forum!


smorgasboard
  • Members
  • 660 posts
  • Last active: Jan 14 2016 08:53 AM
  • Joined: 18 Jul 2012
trying sir...just downloaded your script
....i shall write step by step

smorgasboard
  • Members
  • 660 posts
  • Last active: Jan 14 2016 08:53 AM
  • Joined: 18 Jul 2012
sir it is a herculian task for me....i m unable to save image as desired ..i renamed the image to "screenshot.png"

but when i open it ..it is renamed as "screenshot.png.bmp"

smorgasboard
  • Members
  • 660 posts
  • Last active: Jan 14 2016 08:53 AM
  • Joined: 18 Jul 2012
sir..i think i am lost a bit..i want to ask that...suppose i want to execute a script...let us say...i want to press the tab key 10 times the moment a webpage is completely loaded...

smorgasboard
  • Members
  • 660 posts
  • Last active: Jan 14 2016 08:53 AM
  • Joined: 18 Jul 2012
<!-- m -->http://helpspa.com/w... ... E_ref1.gif<!-- m -->

this link tells when a webpage completely loads these icons appear in IE AND IN firefox...i hope u got the question..
plzz dont give up patience on me!!..thnks in advance....

Pulover
  • Members
  • 1596 posts
  • Last active: Apr 06 2016 04:00 AM
  • Joined: 20 Apr 2012
I can't access the link right now. Can you save the images? It may be in gif format, just use the correct name of the file.

Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer) | Class_LV_Rows - Copy, Cut, Paste and Drag ListViews | Class_Toolbar - Create and modify | Class_Rebar - Adjustable GUI controls

Join the New AutoHotkey Forum!


smorgasboard
  • Members
  • 660 posts
  • Last active: Jan 14 2016 08:53 AM
  • Joined: 18 Jul 2012
search just type in google search bar "mozilla firefox reload button"
it is almost the sAME in IE also...

Pulover
  • Members
  • 1596 posts
  • Last active: Apr 06 2016 04:00 AM
  • Joined: 20 Apr 2012
Try to use my app.
[*:2t0csd3g]Click the Image/Pixel Search button then click 'Make Screenshot'.
[*:2t0csd3g]Select the firefox window and point the mouse in the top-left of the button, then hold right-click and drag to the bottom-right of it.
[*:2t0csd3g]Release and it will create the screenshot and the file name and path will be at the box in the app.
[*:2t0csd3g]Copy that and use it with the script I posted before.

Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer) | Class_LV_Rows - Copy, Cut, Paste and Drag ListViews | Class_Toolbar - Create and modify | Class_Rebar - Adjustable GUI controls

Join the New AutoHotkey Forum!


smorgasboard
  • Members
  • 660 posts
  • Last active: Jan 14 2016 08:53 AM
  • Joined: 18 Jul 2012
it seems awesome...i just got the image in your softwares window....still working.....maaaaaaaaaaaaaaaaaaaan!!...1000000000000 thanks to u....i am still trying ...
a line starts with....
icon stop, continue............