Jump to content

Spider Solitaire


AlanR
 Share

Recommended Posts

Just a simple one for those who like to play (Windows) Spider Solitaire. I've always been annoyed with having to keyboard in Ctrl+z to undo the last move. All other moves can be done with just the mouse. This script enables the right-click of the mouse to undo the last move, allowing the whole game to be played using just the mouse.

CODE
#include <Misc.au3>

Dim $Program, $PID

$dll = DllOpen("user32.dll")

$Program = "C:\WINDOWS\system32\spider.exe"

$PID = Run($Program, "", @SW_SHOW)

WinWaitActive("Spider")

While 1

Sleep ( 150 )

If Not WinExists("Spider") Then ExitLoop

If WinActive("Spider") AND _IsPressed("02", $dll) Then

WinActivate("Spider")

Send("^z")

EndIf WEnd

DllClose($dll)

Exit

Alan Edited by AlanR
Link to comment
Share on other sites

Nice... One suggestion might be to have it close when the game closes..

I'm quite the beginner with many aspects of AutoIt. I thought that the While loop would have taken care of closing the script, when the "Spider" window no longer existed i.e. closed by user. Is there a better/ more correct way to do this?

Alan

Edit - I've edited the original script so that (I think) it will exit once Spider is closed.

Edited by AlanR
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...