Sample code?
From Sikuli ? or . . . ahk ?
Ok, look at how I automated this :
1 - without Automation. Start and stop manually : 1mn 03 seconds
http://www.youtube.c...kKrM?hl=fr&fs=12 - Automated.
Start : the first 2 screens are skipped at lightening speed, then the menu is automated lightening fast to reach the loading screen. Then immediate closing (not pixel, just code) : 23 seconds
http://www.youtube.c...T2Ts?hl=fr&fs=1I searched to embed the videos directly but don't know if it's possible, so just links . . .
Here is the code, it works for my screen (1280x1024) under XP 32 bits and its AHK classic not AHK_L.
If you try it, plz, tell me if it work for your pc. :
/*
*********************************************************
* RA2 Yuri's Revenge *
* Launch and Stop in Skirmish mode *
*********************************************************
*/
Ahk_File_Name = Yuri Skirmish.ahk
FrontEndWindow = ahk_class Yuri's Revenge
Path = put your path here
ExeName = Yuri.exe
Icon_Path = put your Icon path here
Icon_Name = put your Icon name here
;Menu, Tray, Icon, %Icon_Path%%Icon_Name%,
Menu, Tray, Icon, %Path%%ExeName%,
CoordMode,ToolTip,Screen
applicationname = RA2 Yuri's Revenge Launch and Stop in Skirmish mode
TRAYMENU:
Menu,Tray,Tip, %applicationname%
/*
*********************************************************
Read the registry for 1rst run or else
*********************************************************
*/
RegRead, v_reg_yuri, HKEY_CURRENT_USER, Software\Microsoft\Windows\ShellNoRoam\MUICache, C:\EA Games\Command & Conquer Red Alert(tm) II\RA2\gamemd.exe
/*
*********************************************************
* On / Off Hotkey or HotString Switch *
*********************************************************
*/
switch = 0 ; Set Variable Switch to 0 Before starting
;^y:: ;; Ctrl y Hotkey; Launching with Ctrl+y desactivated because launched from same Ctrl+y shortcut from Liberkey Menu
IfWinNotExist, %FrontEndWindow%
{
Run, %Path%%ExeName% ; Launching Yuri's revenge
WinWait, %FrontEndWindow%,
IfWinNotActive, %FrontEndWindow%, , WinActivate, %FrontEndWindow%,
WinWaitActive, %FrontEndWindow%
switch = 1 ; 1 = On : Yuri's revenge is open
;Sleep, %Sleep_1%
; Loop when OutputVar is not-equal to pixel color 0xC67D29
While vBlue != 0xC67D29 ; means : until the variable "vBlue" doesn't contain this color (0xC67D29) continue to loop
;not-equal (<> or !=). The operators != and <> are identical in function.
PixelGetColor, vBlue, 393, 262
;MsgBox, 256 OutputVar is %OutputVar% = 0xC67D29
IfEqual, vBlue, 0xC67D29 ; If vBlue variable is equal to 0xC67D29
;MsgBox, 258 OutputVar is %OutputVar% = 0xC67D29
Send, {ESC} ;Skip Animation
WinWait, %FrontEndWindow%,
IfWinNotActive, %FrontEndWindow%, , WinActivate, %FrontEndWindow%,
;Sleep, %Sleep_2%
WinWaitActive, %FrontEndWindow%
; Loop when OutputVar is not-equal to pixel color 0x3138FF
While vRed != 0x3138FF
;not-equal (<> or !=). The operators != and <> are identical in function.
PixelGetColor, vRed, 108, 253
;MsgBox, 277 OutputVar is %OutputVar% = 0x3138FF
IfEqual, vRed, 0x3138FF
;MsgBox, 279 OutputVar is %OutputVar% = 0x3138FF
Control, Check,, Button2, %FrontEndWindow% ;click Single Player ClassNN: Button2 Text: GUI:SinglePlayer
WinWait, %FrontEndWindow%,
IfWinNotActive, %FrontEndWindow%, , WinActivate, %FrontEndWindow%,
WinWaitActive, %FrontEndWindow%
; Loop when OutputVar is not-equal to pixel color 0x00FFFF x 702 y 305
;Loop until OutputVar is equal to pixel color 0x00FFFF
While vYellowSkir != 0x00FFFF
PixelGetColor, vYellowSkir, 702, 305
;MsgBox, 314 OutputVar is %OutputVar% = 0x00FFFF
IfEqual, vYellowSkir, 0x00FFFF
;MsgBox, 316 OutputVar is %OutputVar% = 0x00FFFF
Control, Check,, Button3, %FrontEndWindow% ;Click Skirmish ClassNN: Button2 Text: GUI:LoadSavedGame ClassNN: Button3 Text: GUI:Skirmish
WinWait, %FrontEndWindow%,
IfWinNotActive, %FrontEndWindow%, , WinActivate, %FrontEndWindow%,
WinWaitActive, %FrontEndWindow%
; Loop when OutputVar is not-equal to pixel color 0x00FFFF x 692 y 261
;Loop until OutputVar is equal to pixel color 0x00FFFF
While vYellowStar != 0x00FFFF
PixelGetColor, vYellowStar, 692, 261
;MsgBox, 352 OutputVar is %OutputVar% = 0x00FFFF
IfEqual, vYellowStar, 0x00FFFF
;MsgBox, 354 OutputVar is %OutputVar% = 0x00FFFF
Control, Check,, Button2, %FrontEndWindow% ;Click StartGame
}
Else
{
^y:: ;; Ctrl y Hotkey
IfWinExist, %FrontEndWindow%,
WinClose, %FrontEndWindow%
Process,close, gamemd.exe
IfWinNotExist, %FrontEndWindow%
switch = 0 ; 0 = Off : %FrontEndWindow% is closed
;IfWinExist [, WinTitle, WinText, ExcludeTitle, ExcludeText]
;PostMessage, 0x112, 0xF060,,, WinTitle, WinText ; 0x112 = WM_SYSCOMMAND, 0xF060 = SC_CLOSE
ExitApp
}
Return
Also as a reference, there is a very complete script and thread still going on, here :
OPIE fishing bot for WOW