Sign in to follow this  
Followers 0
AdmiralAlkex

(IE Automation) Read game details from Steam Store

5 posts in this topic

I'm working on something that is more or less a list of my games from Steam and now I want to get their capabilities too.

Yes I could just do some string crunching, but that's no fun!

Example page:

#include <IE.au3>
$oIE = _IECreate("http://store.steampowered.com/app/22650/?l=english")

Just to be clear what I want:

Posted Image

Code for that list:

<div class="details_block">
<div class="game_area_details_specs">
<div class="icon">
<img align="top" src="http://cdn.store.steampowered.com/public/images/ico/ico_singlePlayer.gif">
</div>
<div class="name">Single-player</div>
</div>
<div class="game_area_details_specs">
<div class="icon">
<img align="top" src="http://cdn.store.steampowered.com/public/images/ico/ico_coop.gif">
</div>
<div class="name">Co-op</div>
</div>
<div class="game_area_details_specs">
<div class="icon">
<img align="top" src="http://cdn.store.steampowered.com/public/images/ico/ico_achievements.gif">
</div>
<div class="name">Steam Achievements</div>
</div>
<div class="game_area_details_specs">
<div class="icon">
<img align="top" src="http://cdn.store.steampowered.com/public/images/ico/ico_leaderboards.gif">
</div>
<div class="name">Steam Leaderboards</div>
</div>
<div class="game_area_details_specs">
<div class="icon">
<img align="top" src="http://cdn.store.steampowered.com/public/images/ico/ico_stats.gif">
</div>
<div class="name">Stats</div>
</div>
<div class="game_area_details_specs">
<div class="icon">
<img align="top" src="http://cdn.store.steampowered.com/public/images/ico/ico_controller.gif">
</div>
<div class="name">Controller enabled</div>
</div>
</div>

If I could just somehow get an array containing the names from the details_block...

I don't know where to go from here ;)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I got this:

#include <IE.au3>
$oIE = _IECreate([url="http://store.steampowered.com/app/22650/?l=english"]http://store.steampowered.com/app/22650/?l=english[/url])
$oInputs = _IETagNameGetCollection($oIE, "div")
For $oInput In $oInputs
If String($oInput.classname) = "details_block" Then
  $button = $oInput
ExitLoop
Else
  ConsoleWrite("** Not this one: " & _IEPropertyGet($oInput, "innertext") & @LF)
EndIf
Next
If IsObj($button) Then
    MsgBox(0, "We found them: ",_IEPropertyGet($button, "innertext") & @LF)
Else
    ConsoleWrite("We never found them" & @LF)
EndIf
Exit

The only problem is that there are more than one div with classname "details_block" so it gives resault of the other one above....Make a loop to find the others.

Changing classname to this "game_area_details_specs" finds them but you should loop through it till it find them all because it find the only one.

Hope that helps.

Edited by ileandros

I feel nothing.It feels great.

Share this post


Link to post
Share on other sites

I got this:

#include <IE.au3>
$oIE = _IECreate([url="http://store.steampowered.com/app/22650/?l=english"]http://store.steampowered.com/app/22650/?l=english[/url])
$oInputs = _IETagNameGetCollection($oIE, "div")
For $oInput In $oInputs
If String($oInput.classname) = "details_block" Then
  $button = $oInput
ExitLoop
Else
  ConsoleWrite("** Not this one: " & _IEPropertyGet($oInput, "innertext") & @LF)
EndIf
Next
If IsObj($button) Then
    MsgBox(0, "We found them: ",_IEPropertyGet($button, "innertext") & @LF)
Else
    ConsoleWrite("We never found them" & @LF)
EndIf
Exit

The only problem is that there are more than one div with classname "details_block" so it gives resault of the other one above....Make a loop to find the others.

Changing classname to this "game_area_details_specs" finds them but you should loop through it till it find them all because it find the only one.

Hope that helps.

Yes that helped alot, thank you!! After playing with it a bit I ended with this:

#include <IE.au3>
#include <Array.au3>

$asList = _GetGameDetails()
If $asList[0] <> "" Then
    _ArrayDisplay($asList)
EndIf

Func _GetGameDetails()
    Local $asDetails[1]

    $oIE = _IECreate("http://store.steampowered.com/app/22650/?l=english", 0, 0)

    $oDivs = _IETagNameGetCollection($oIE, "div")
    For $oDiv In $oDivs
        If String($oDiv.classname) = "game_area_details_specs" Then
            If IsObj($oDiv) Then
                $asDetails[UBound($asDetails) -1] = _IEPropertyGet($oDiv, "innertext")
                ReDim $asDetails[UBound($asDetails) +1]
            EndIf
        EndIf
    Next
    ReDim $asDetails[UBound($asDetails) -1]

    _IEQuit($oIE)
    Return $asDetails
EndFunc

Works great with Alien Breed, now on to integrate it in my script...

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Works great with Alien Breed, now on to integrate it in my script...

Which is?? I cant understand why you got those names??? What kind of automatation can you get displaying those in array???

I have never played that game though.

Good luck!

Edited by ileandros

I feel nothing.It feels great.

Share this post


Link to post
Share on other sites

Which is?? I cant understand why you got those names??? What kind of automatation can you get displaying those in array???

I have never played that game though.

Good luck!

It's so the script can display a list of the available "tags" and then if the user selects any of them only games with that "tag" is displayed.

Maybe you will see when it's finished.

I haven't really played that game either ;)

Share this post


Link to post
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
Sign in to follow this  
Followers 0

  • Similar Content

    • Aipion
      By Aipion
      A Simple function to get information of all the monitors such as the Name, Monitor Type, Manufacturer, Resolution and more.


      #cs FUNCTION ==================================================================================================================== Name...........: _Get_MonitorsInformation Description....: Gets details of all the Displays. Syntax.........: _Get_MonitorsInformation() Parameters.....: None Return values..: The array returned is 8 dimensional and is made up as follows: Success ====> $array[0][0] = The number of displays on the computer $array[0][1] = The Error code returned by WMIService Object $array[1][0] = Name $array[1][1] = Monitor Type $array[1][2] = Manfucturer $array[1][3] = DPI X $array[1][4] = DPI Y $array[1][5] = Screen Width $array[1][6] = Screen Height $array[1][7] = Display Type Failure ====> $array[0][0] = 0 $array[0][1] = The Error code returned by WMIService Object Author.........: Antonio Do Rosario (Aipion) Remarks........: Works with Windows 2000, 2003, XP, Vista and 7 Example........: Yes #ce=============================================================================================================================== Func _Get_MonitorsInformation() Local $objWMIService ; As Object Local $colItems ; As Object Local $objItem ; As Object Local $DisplaysArray[1][8] Local $objWMIService = ObjGet("winmgmts:.rootcimv2") $DisplaysArray[0][1] = Hex(@error, 8) If @error Then ;Error Getting an active WMIService Object. $DisplaysArray[0][0] = 0 Return $DisplaysArray EndIf $colItems = $objWMIService.ExecQuery("Select * From Win32_DesktopMonitor") For $objItem In $colItems $DisplaysArray[0][0] += 1 ReDim $DisplaysArray[$DisplaysArray[0][0]+1][8] $DisplaysArray[$DisplaysArray[0][0]][0] = $objItem.Name ;Name $DisplaysArray[$DisplaysArray[0][0]][1] = $objItem.MonitorType ;Monitor Type $DisplaysArray[$DisplaysArray[0][0]][2] = $objItem.MonitorManufacturer ;Manfucturer $DisplaysArray[$DisplaysArray[0][0]][3] = $objItem.PixelsPerXLogicalInch ;DPI X $DisplaysArray[$DisplaysArray[0][0]][4] = $objItem.PixelsPerYLogicalInch ;DPI Y $DisplaysArray[$DisplaysArray[0][0]][5] = $objItem.ScreenWidth ;Screen Width $DisplaysArray[$DisplaysArray[0][0]][6] = $objItem.ScreenHeight ;Screen Height ;Display Type Switch $objItem.DisplayType Case 0 $DisplaysArray[$DisplaysArray[0][0]][7] = "Unknown" Case 1 $DisplaysArray[$DisplaysArray[0][0]][7] = "Other" Case 2 $DisplaysArray[$DisplaysArray[0][0]][7] = "MultiScan Color" Case 3 $DisplaysArray[$DisplaysArray[0][0]][7] = "MultiScan Monochrome" Case 4 $DisplaysArray[$DisplaysArray[0][0]][7] = "Fixed Frequency Color" Case 5 $DisplaysArray[$DisplaysArray[0][0]][7] = "Fixed Frequency Monochrome" Case Else $DisplaysArray[$DisplaysArray[0][0]][7] = "Unknown" EndSwitch Next Return $DisplaysArray EndFunc


      Example of Use:

      #include <Array.au3> $GetMonArray = _Get_MonitorsInformation() _ArrayDisplay($GetMonArray) #cs FUNCTION ==================================================================================================================== Name...........: _Get_MonitorsInformation Description....: Gets details of all the Displays. Syntax.........: _Get_MonitorsInformation() Parameters.....: None Return values..: The array returned is 8 dimensional and is made up as follows: Success ====> $array[0][0] = The number of displays on the computer $array[0][1] = The Error code returned by WMIService Object $array[1][0] = Name $array[1][1] = Monitor Type $array[1][2] = Manfucturer $array[1][3] = DPI X $array[1][4] = DPI Y $array[1][5] = Screen Width $array[1][6] = Screen Height $array[1][7] = Display Type Failure ====> $array[0][0] = 0 $array[0][1] = The Error code returned by WMIService Object Author.........: Antonio Do Rosario (Aipion) Remarks........: Works with Windows 2000, 2003, XP, Vista and 7 Example........: Yes #ce===============================================================================================================================Func _Get_MonitorsInformation() Local $objWMIService ; As Object Local $colItems ; As Object Local $objItem ; As Object Local $DisplaysArray[1][8] Local $objWMIService = ObjGet("winmgmts:.rootcimv2") $DisplaysArray[0][1] = Hex(@error, 8) If @error Then ;Error Getting an active WMIService Object. $DisplaysArray[0][0] = 0 Return $DisplaysArray EndIf $colItems = $objWMIService.ExecQuery("Select * From Win32_DesktopMonitor") For $objItem In $colItems $DisplaysArray[0][0] += 1 ReDim $DisplaysArray[$DisplaysArray[0][0]+1][8] $DisplaysArray[$DisplaysArray[0][0]][0] = $objItem.Name ;Name $DisplaysArray[$DisplaysArray[0][0]][1] = $objItem.MonitorType ;Monitor Type $DisplaysArray[$DisplaysArray[0][0]][2] = $objItem.MonitorManufacturer ;Manfucturer $DisplaysArray[$DisplaysArray[0][0]][3] = $objItem.PixelsPerXLogicalInch ;DPI X $DisplaysArray[$DisplaysArray[0][0]][4] = $objItem.PixelsPerYLogicalInch ;DPI Y $DisplaysArray[$DisplaysArray[0][0]][5] = $objItem.ScreenWidth ;Screen Width $DisplaysArray[$DisplaysArray[0][0]][6] = $objItem.ScreenHeight ;Screen Height ;Display Type Switch $objItem.DisplayType Case 0 $DisplaysArray[$DisplaysArray[0][0]][7] = "Unknown" Case 1 $DisplaysArray[$DisplaysArray[0][0]][7] = "Other" Case 2 $DisplaysArray[$DisplaysArray[0][0]][7] = "MultiScan Color" Case 3 $DisplaysArray[$DisplaysArray[0][0]][7] = "MultiScan Monochrome" Case 4 $DisplaysArray[$DisplaysArray[0][0]][7] = "Fixed Frequency Color" Case 5 $DisplaysArray[$DisplaysArray[0][0]][7] = "Fixed Frequency Monochrome" Case Else $DisplaysArray[$DisplaysArray[0][0]][7] = "Unknown" EndSwitch Next Return $DisplaysArray EndFunc