AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Using VNC to run AHK on a machine w/o monitor
Goto page 1, 2  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Dragyn



Joined: 14 Aug 2005
Posts: 14

PostPosted: Thu Sep 21, 2006 2:48 am    Post subject: Using VNC to run AHK on a machine w/o monitor Reply with quote

I have a simple AHK script that searches the screen for images and when it finds them it clicks on them.

The machine that runs the AHK script is a machine on my network without a monitor attatched. I use VNC from a different machine with a monitor to run the AHK script locally on the monitor-less machine.

As long as VNC is connected, the script runs fine on the monitor-less machine.

As soon as I close VNC, then the script no longer clicks on images anymore.

I'm thinking that somehow because there isn't a monitor connected to the machine running the AHK script, that there's no video signal for AHK to do an image search of. When VNC is connected, it seems to generate a video signal for the remote login, but as soon as that closes the AHK script stops finding images on the "screen" cause there isn't a screen connected?

Anyone know any way I can work around this other than to leave VNC up and connected all the time so the machine keeps generating a video signal for the AHK to search?

Am I totally misunderstanding whats actually going wrong here?

Any help or suggestions greatly apreciated!
Back to top
View user's profile Send private message
TDMedia



Joined: 26 Nov 2005
Posts: 196

PostPosted: Thu Sep 21, 2006 3:13 am    Post subject: Reply with quote

I'm not sure particularly how AHK's ImageSearch command does it's job (though I think it's through "stock" API funcions,) but my real question is what flavor of VNC are you using? A couple of different VNC-based distributions use, or have the option to use a specialized driver. One such example is UltraVNC, which I prefer myself. So, are you using such a distro, or are your video drivers stock from your card/chipset manufacturer? If you are using those specailized drivers, turning them off may cause the problem to stop.

Like I said, though - I'm not all that sure how AHK performs it's ImageSearches. You may simply have to get what's called a terminator, or dummy load, for your VGA/DVI port that makes your machine believe that there's hardware connected to it. A simple terminator should do the job (if such a thing exists for VGA,) but if you have a VGA/DVI adapter, that may also work. If AHK's problem is what you think, then that would probably be the best way.
Back to top
View user's profile Send private message
Dragyn



Joined: 14 Aug 2005
Posts: 14

PostPosted: Thu Sep 21, 2006 4:07 am    Post subject: Reply with quote

Just using plain old vanilla VNC. Free Viewer 4.1.2 and Server 4.1.1. Guess I need to update the server on that machine but I don't think that'll make a difference.

The terminator idea is apreciated. Any other software solutions anyone can think of? Or any confirmation that that is what the problem is? Or a better way to confirm it?
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10474

PostPosted: Thu Sep 21, 2006 11:29 am    Post subject: Reply with quote

This is just a wild guess, but this might not be related to the lack of a monitor. Even if the machine had a monitor, the problem might still occur if closing VNC causes the remote machine to switch to a different desktop (such as the login screen on Windows XP).
Back to top
View user's profile Send private message Send e-mail
silveredge78



Joined: 25 Jul 2006
Posts: 387
Location: Midwest, USA

PostPosted: Thu Sep 21, 2006 7:36 pm    Post subject: Reply with quote

*nods to Chris* I dont see how this would relate to it not having a monitor. There is still a video signal even if there is not a monitor hooked up. Also, I doubt that AHK cares bout the actual video signal going to the monitor as much as the data composing that signal.

I would check your VNC server settings. If you are using 4.1.1, check specifically the Desktop tab, under "When last client disconnects", make sure the radio button is set to "Do nothing". Either of the other two options would cause your script to stop performing.

Good luck!
_________________
SilverEdge78
Back to top
View user's profile Send private message
Dragyn



Joined: 14 Aug 2005
Posts: 14

PostPosted: Thu Sep 21, 2006 9:53 pm    Post subject: Reply with quote

VNC is set to do "Do Nothing" when it disconnects already.

Interestingly it seems like there's a specific image that it keeps getting 'stuck' on when VNC is not running.

IE if I leave VNC open the AHK script runs without fail (and I can see that via VNC).

If I close VNC, and check back 30 minutes later, the AHK script seems to have 'stalled' on the same image not finding it. And I can see that it wasn't clicking for over 90% of that 30 minute time period.

I've tried running the AHK script on another computer with a monitor via VNC, and it seems to run fine even after closing VNC.

So that leads me back to the lack of monitor being somehow related.

Any other ideas of how to isolate the problem?

Thanks for all the help so far!
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10474

PostPosted: Fri Sep 22, 2006 1:31 am    Post subject: Reply with quote

When VNC disconnects, it's possible that the colors seen by the script are different. You might try using the shades-of-variation option of PixelSearch and ImageSearch to make the color detection more forgiving. If that doesn't help -- and you're using ImageSearch now -- you might try substituting PixelSearch instead (if feasible).
Back to top
View user's profile Send private message Send e-mail
Dragyn



Joined: 14 Aug 2005
Posts: 14

PostPosted: Fri Sep 22, 2006 9:31 am    Post subject: Reply with quote

Shades of variation was set to 5 originally, I tried bumping it up to 15 and am getting the same behaviour. PixelSearch wouldn't be to practical as there's various image sets some with 50+ images.

Its not really the direct fault of AHK so I really apreciate you taking time with all these suggestions. I'll keep messing with it.
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10474

PostPosted: Fri Sep 22, 2006 1:37 pm    Post subject: Reply with quote

It's a longshot, but you can try going even higher on shades-of-variation. Even as high as 150 is sometimes not so high as to cause false positives (depending on the nature of the image).
Back to top
View user's profile Send private message Send e-mail
SanskritFritz



Joined: 17 Feb 2005
Posts: 283
Location: Hungary, Budapest

PostPosted: Fri Sep 22, 2006 2:10 pm    Post subject: Reply with quote

I am doing this exactly as you described at my work (for automatic testing). The machine the AHK script is running on, doesnt even have a monitor, i connect to it with VNCViewer (AT&T, version 3.3.3.3, server version 3.3.3.9). It runds flawlessly with or without VNC. The only thing i had to set, was to disable the screen saver.
_________________
Is there another word for synonym?
Back to top
View user's profile Send private message
silveredge78



Joined: 25 Jul 2006
Posts: 387
Location: Midwest, USA

PostPosted: Fri Sep 22, 2006 6:19 pm    Post subject: Reply with quote

I would test it on my network here. I use VNC 4.1.1 for viewer/server both. I dont know how to code this kind of thing though. Is this a code you could post that I could test for ya? Smile Or do you need that?

Also, SanskritFritz has a good point that I hadnt thought of...
_________________
SilverEdge78
Back to top
View user's profile Send private message
corrupt



Joined: 29 Dec 2004
Posts: 2421

PostPosted: Sat Sep 23, 2006 2:46 am    Post subject: Reply with quote

Out of curiosity, does the machine that has the issue without VNC being active have a mouse physically connected to it?
Back to top
View user's profile Send private message Visit poster's website
Dragyn



Joined: 14 Aug 2005
Posts: 14

PostPosted: Sat Sep 23, 2006 8:55 am    Post subject: Reply with quote

Chris: I tried 100 and got too many false positives, but I tried 50 without false positives, but without it continuing to run once VNC was shutdown also.

Sanskrit: Screensaver and power saving are both turned off on that machine. I'm experimenting with other version of VNC as I have time to see if I can find a different version that will work better.

silveredge: the code is pretty straightforward it just searches for images and clicks them when it sees them. But you'd need a suitable set of images to search for which is probably more tricky.

corrupt: No actually the machine does not have a mouse connected, I wonder if that could be related to the problem. It does however have a keyboard. I'll experiment with that.

Thanks everyone for all the suggestions!
Back to top
View user's profile Send private message
JSLover



Joined: 20 Dec 2004
Posts: 542
Location: LooseChange911.com... the WTC attacks were done by the US Gov't... the official story is a lie...

PostPosted: Tue Oct 03, 2006 4:19 am    Post subject: Reply with quote

Dragyn wrote:
...but without it continuing to run once VNC was shutdown also.

...can I suggest a really dumb solution? Have the monitor-less box be its own VNC client...start server & client with computer boot, then you connect as a 2nd client...you disconnect, the server is still its own client (with a hidden/minimized window)...maybe it'd trick it into working???
_________________

Home • Click image! • Blog
Back to top
View user's profile Send private message Visit poster's website
Robert Carnegie



Joined: 01 Jun 2005
Posts: 53
Location: Scotland

PostPosted: Mon Oct 30, 2006 1:06 pm    Post subject: Reply with quote

We presume the script is still running when VNC is disconnected, it just doesn't find your target image. (You can test that. From limited experience with TightVNC, I would expect it, whereas Windows Remote Desktop Connection for instance to an XP Professional machine goes to a locked screensaver when you disconnect.)

But can you take a screen-dump within the script and save it, after disconnection, to get a handle on what AutoHotkey thinks the screen looks like?

For instance is it like XP's "So you want to log off" dialog box where the desktop fades to grey scale in the background.

Or is it a screensaver.

With my screensaver, a script that regularly performs "Winset, Top" - I use an onscreen keyboard which is stationed on the taskbar, which is liable to hide it - "Winset, Top" makes the window appear over the screensaver (until the monitor switches off). This isn't intended but accidental. But maybe closing the VNC connection puts the PC into a state where "WinSet, Top" will be effective in making the target program's graphics detectable.

Incidentally, I also got Windows horribly confused by trying to run the TightVNC client on the desktop which was also the TightVNC server, so that approach may not help you either.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group