Jump to content

An Attempt to Automate Steam Updates


 Share

Recommended Posts

This is what I have so far:

I am using keyboard commands instead of mouse commands because if the window is moved to another location, the mouse command won't click on the desired locations. I would prefer to use mouse commands instead, but I don't really know how to make it find specific text/buttons in the Steam window.

Opt("TrayIconHide", 1) ; Hide the tray icon

Run("C:\Games\Steam\Steam.exe") ; Start Steam

Do

$title = WinGetTitle("")

MsgBox(0, "Active", $title)

Until $title = "STEAM "

WinWaitActive("STEAM") ; Wait until the main Steam window is active

Sleep(3000)

If WinActive("Valve Hardware Survey") Then ; Check to see if the hardware survey is open

MouseClick("left", 464, 527)

MouseClick("left", 713, 678)

EndIf

Sleep(2000)

WinActivate("STEAM") ; Set the main Steam window as active

If WinActive("STEAM") Then

Send("{TAB} & {RIGHT} & {SPACE}")

Sleep(1000)

Send("{TAB} & {HOME}")

$text = WinGetText("STEAM", "")

MsgBox(0, "Text read was:", $text) ; Attempts to display what is active (for testing only-not for desired results)

EndIf

Sleep(2000)

If WinActive("Video Driver Outdated") Then ; Outdated video driver may appear - this will tell it not to check anymore

MouseClick("left", 401, 640) ; Check "Don't show this again"

MouseClick("left", 680, 635) ; Click Next

EndIf

This code is not finished, by the way.

Is there possibly an easier way than what I am attempting?

Edited by buymeapc
Link to comment
Share on other sites

i noticed your other post regarding moving this window...

more importantly if you use this

opt("MouseCoordMode", 0) ;1=absolute, 0=relative, 2=client

it wont matter where the window is... just as long as it IS the active window

8)

@hankjrfan: Steam is an application which enables you to play Half Life games.

@Valuater: I'm not sure I understand...

What he means is,

1= mouse clicks coords relative to the ENTIRE windows screen

0= mouse clicks only coords relative to your steam window, meaning if you move your steam around the window, it will still click where its suposed to

2= not quite sure what this one does B)

Link to comment
Share on other sites

I am using keyboard commands instead of mouse commands because if the window is moved to another location, the mouse command won't click on the desired locations.

You can also use the following code to get the exact location of the button you want even if it is in a different location each time:

$realsize = WinGetPos("MyTargetDialogBox")
MouseClick("Left",$realsize[0]+63,$realsize[1]+309); click on the button

Where: 63 and 309 are the x and y coordinates of the button you want to press on the dialog box in question. You find these values by turning on AutoITInfo and moving the dialog box to the top left corner of your screen and then getting the x/y of the button. This also assumes that the name of your dialog box is "MyTargetDialogBox".

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Link to comment
Share on other sites

Say the list has three games in it:

Counter Strike: Source

Half Life 2

Half Life 2: Deathmatch

I want to be able to have the mouse click on each listed title (one of the above three), launch it, close it, and move on to the next game listed to do the same thing.

But, there is a catch.....Not all of these computers have only three titles. A lot have somewhere around eight titles listed.

Basically, I need the mouse to be smart and only click on the games in the list and realize when there are no more games in the list and stop the process.

I hope I've clarified it....B)

Link to comment
Share on other sites

; that clarified the question... thank you

;ok... this is just an idea because i don't understand everything

; so... how about checking to see if the game exists on the computer

if not FileExists(@ProgramFilesDir & "\Halflfe\halflife.exe") then
;mouse click the next position
; run... install.. bla bla
EndIf

8)

NEWHeader1.png

Link to comment
Share on other sites

Unfortunately, it's not that easy (I think).

Each PC has its own unique user ID for Steam. So each PC's path to the game files will be different.

ex.:

PC1: C:\Games\Steam\SteamApps\User1\....

PC2: C:\Games\Steam\SteamApps\User2\....

PC3: C:\Games\Steam\SteamApps\User3\....

and so on... B)

Link to comment
Share on other sites

ok just a little more complicated

but this works

$_File = "Halflife.exe"

RunWait(@ComSpec & ' /c ' & 'dir "' & "C:\Games\Steam\SteamApps\" & $_File & '" /a :h /b /s' & ' > "' & @TempDir & '\dir.txt"', '', @SW_HIDE)
    Sleep(2000)
    
    
    $hFile = FileOpen(@TempDir & "\dir.txt", 0)
    
; Check if file opened for reading OK
    If $hFile = -1 Then
        MsgBox(0, "Error", "Unable to open file.")
    EndIf
    
    $sLine = FileReadLine($hFile)
    
    If not FileExists($sline) then
    ;mouse click the next position
    ; run... install.. bla bla
    EndIf
    
; for testing
    MsgBox(0,"test", $sLine )

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

I'm not sure...

The message box at the end does not have any output in it.

Here's the code I used:

$_File = "hl2.exe"

RunWait(@ComSpec & ' /c ' & 'dir "' & "C:\Games\Steam\SteamApps\" & $_File & '" /a :h /b /s' & ' > "' & @TempDir & '\dir.txt"', '', @SW_HIDE)
    Sleep(2000)
    
    
    $hFile = FileOpen(@TempDir & "\dir.txt", 0)
    
; Check if file opened for reading OK
    If $hFile = -1 Then
        MsgBox(0, "Error", "Unable to open file.")
    EndIf
    
    $sLine = FileReadLine($hFile)
    
    If not FileExists($sline) then
    MsgBox(0, "Box", "$sline not found")
    EndIf
    
; for testing
    MsgBox(0,"test", $sLine )

EDIT: My mistake, it found the file and output the path to the message box at the end. Awesome code! B)

I will play with this a bit further. Thank you so much for your help, so far!

Edited by buymeapc
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...