AutoHotkey Community

It is currently May 27th, 2012, 12:59 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 39 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject:
PostPosted: December 3rd, 2011, 8:59 pm 
Offline
User avatar

Joined: August 23rd, 2010, 6:22 pm
Posts: 781
Location: Ontario, Canada
Strelok wrote:
Okay, I'm new to this, how do I download this?


If you already have AutoHotkey installed, here are the steps:

  1. Save the script in the "AutoHotkey.net" link (in the Download section) as "SomeFile.ahk". Ensure it has a .ahk extension, instead of something like "SomeFile.ahk.txt".
  2. Run the script by opening the .ahk file.


If you do not have AutoHotkey installed, I recommend you download and install it here.

_________________
AutoHotkey.net | GitHub

My default license.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 4th, 2011, 11:11 pm 
Offline
User avatar

Joined: December 5th, 2010, 7:19 pm
Posts: 311
Could you seperate the players/max players into two coloums?
And put a button/entry for localhost connection?

Oh and i wanted to drop this code off:
Code:
AoS2IP(ip)
{
 ; Chop off the aos:// and convert the reversed decimal IP to a standard 4-dot IP
 ip := RegExReplace(ip, "^.{6}")
 ip := (ip&0xFF) "." ((ip&0xFF00)>>8) "." ((ip&0xFF0000)>>16) "." ((ip&0xFF000000)>>24)
 return ip
}


It turns aos addresses into ip addresses.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 5th, 2011, 1:50 am 
Offline
User avatar

Joined: August 23rd, 2010, 6:22 pm
Posts: 781
Location: Ontario, Canada
Update:

  • Players and server capacity split into two columns.
  • Button added for localhost connection.
  • IP address column (I was unaware of that, thanks gamax92!)
  • Refreshing the list maintains the sort order.

_________________
AutoHotkey.net | GitHub

My default license.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 11th, 2011, 10:27 pm 
Offline
User avatar

Joined: December 5th, 2010, 7:19 pm
Posts: 311
http://aos.mp2.dk/

pyspades lead me to this server page. You could try using it as a backup or an alternative. For me that page loads faster.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 23rd, 2011, 3:10 am 
Offline
User avatar

Joined: August 23rd, 2010, 6:22 pm
Posts: 781
Location: Ontario, Canada
Update:

  • Current server name is now shown in the window title.
  • Fixed window and control sizing issue.

_________________
AutoHotkey.net | GitHub

My default license.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 27th, 2011, 12:20 am 
Offline
User avatar

Joined: August 23rd, 2010, 6:22 pm
Posts: 781
Location: Ontario, Canada
Update:

  • Enter key now connects to the currently selected server.
  • Fixed a resizing issue in which refreshing the server list would trigger the GuiSize routine.

_________________
AutoHotkey.net | GitHub

My default license.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 30th, 2011, 1:48 am 
Offline
User avatar

Joined: August 23rd, 2010, 6:22 pm
Posts: 781
Location: Ontario, Canada
Update:

The last update had a bug in which server selection was triggered on any ListView event. This has now been fixed.

Edit: also AutoJoin could not be stopped by using a hotkey. This is now fixed.

_________________
AutoHotkey.net | GitHub

My default license.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 30th, 2012, 3:58 pm 
Offline

Joined: January 30th, 2012, 3:56 pm
Posts: 1
nimda wrote:
With a quick change, this works with AOS Portable too! :)
Now I can remove my hotkey which sent a rightclick, arrow keys, and ran aos with the clipboard :P


Sorry for the late bump, but you have an AoS portable? I can't seem to find one anywhere. Would you mind pointing me in the direction?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 31st, 2012, 3:23 am 
Offline

Joined: December 26th, 2010, 7:40 pm
Posts: 4172
Location: Awesometown, USA
Ace of Spades is portable except for the registry-write required to make the aos:// protocol work. So just take the whole AoS folder + the OP script, and change
Code:
Run, %Server%,, UseErrorLevel
to
Code:
Run, "%A_ScriptDir%\client.exe" %Server%,, UseErrorLevel
Then put the OP script in the AoS folder.
I can upload my folder as a .zip later if you want, but it's just a one-line change

_________________
Autofire, AutoClick, Toggle, SpamWindow Control Tools
Recommended: AutoHotkey_L


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 15th, 2012, 10:17 pm 
Offline

Joined: December 26th, 2010, 7:40 pm
Posts: 4172
Location: Awesometown, USA
Bump. As of 0.75 the address field is broken.

_________________
Autofire, AutoClick, Toggle, SpamWindow Control Tools
Recommended: AutoHotkey_L


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 15th, 2012, 10:48 pm 
Offline

Joined: March 27th, 2008, 2:14 pm
Posts: 700
nimda, this:
Code:
Run, "%A_ScriptDir%\client.exe" %Server%,, UseErrorLevel


Needs to be changed to:
Code:
Run, "%A_ScriptDir%\client.exe" "%Server%",, UseErrorLevel


The address (aos://*) needs to be quoted on the command line, otherwise client.exe doesn't recognize it.

_________________
Scripts - License


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 15th, 2012, 11:52 pm 
Offline

Joined: December 26th, 2010, 7:40 pm
Posts: 4172
Location: Awesometown, USA
Actually, that part works fine for me. I was referring to the address field of the listview.

_________________
Autofire, AutoClick, Toggle, SpamWindow Control Tools
Recommended: AutoHotkey_L


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 16th, 2012, 12:00 am 
Offline

Joined: March 27th, 2008, 2:14 pm
Posts: 700
AoS just updated to version 7.5, so maybe something changed. http://www.ace-spades.com/grab-ace-of-spades-beta-0-75-now/

_________________
Scripts - License


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 16th, 2012, 1:45 am 
Offline

Joined: December 26th, 2010, 7:40 pm
Posts: 4172
Location: Awesometown, USA
I know.
nimda wrote:
Bump. As of 0.75 the address field is broken.

_________________
Autofire, AutoClick, Toggle, SpamWindow Control Tools
Recommended: AutoHotkey_L


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 16th, 2012, 7:05 am 
Offline

Joined: March 27th, 2008, 2:14 pm
Posts: 700
Fixed. Apparently as of 0.75, the aos:// link includes the port. I adjusted for it, and added port column. I also fixed the insane one-space indentation.

Btw, this is for a portable installation (put it in your aos dir). Also, I use ahk_l, I'm not sure if it still works on basic.
Code:
#NoEnv
#SingleInstance, Force

URL := "http://www.ace-spades.com/play/"

SetTitleMatchMode, RegEx

AutoJoin := 0

Gui, Font, s16 Bold, Arial
Gui, Add, Text, x10 y0 h30 vTitle Center, Server List
Gui, Font, s8 Norm
SortColumns := [1,0,0,0,0,0]
Gui, Add, ListView, x10 y30 vServerList gListViewEvent, Index|Name|Players|Capacity|Ping|Server|Address|Port
Gui, Font, Bold
Gui, Add, Text, x10 w80 h20 vServerCount
Gui, Add, Button, w80 h20 vLocalServer gLocalServer, &Local Server
Gui, Add, Button, w80 h20 vRefreshList gRefreshList Default, &Refresh
Gui, +Resize +MinSize270x150

Gosub, RefreshList

Gui, Show, Center w600 h450
Return

GuiEscape:
GuiClose:
ExitApp

GuiSize:
GuiControl, Move, Title, % "w" . (A_GuiWidth - 20)
GuiControl, Move, ServerList, % "w" . (A_GuiWidth - 20) . " h" . (A_GuiHeight - 70)
GuiControl, Move, ServerCount, % "y" . (A_GuiHeight - 30)
GuiControl, Move, LocalServer, % "x" . (A_GuiWidth - 180) . " y" . (A_GuiHeight - 30)
GuiControl, Move, RefreshList, % "x" . (A_GuiWidth - 90) . " y" . (A_GuiHeight - 30)
WinSet, Redraw
Return

LocalServer:
Gui, Hide
Server := "aos://16777343:32887"
Name := "Local Server"
JoinServer(Server,Name)
Gui, Show
Return

ListViewEvent:
If (A_GuiEvent = "ColClick")
    Gosub, SortColumns
If (A_GuiEvent != "DoubleClick")
    Return
Gosub, SelectServer
Return

SelectServer:
Row := LV_GetNext()
LV_GetText(Server,Row,6) ;retrieve the server from the fourth column of the selected row
LV_GetText(Name,Row,2) ;retrieve the server name from the first column of the selected row
Gui, Hide
JoinServer(Server,Name)
Gui, Show
Return

SortColumns:
If SortColumns[A_EventInfo]
    SortColumns[A_EventInfo] := (SortColumns[A_EventInfo] & 1) + 1 ;toggle sorting types between ascending and descending
Else
    SortColumns[A_EventInfo] := (A_EventInfo = 3 || A_EventInfo = 4) ? 2 : 1 ;enable sorting for the column

For Index In SortColumns ;disable sorting on all other columns
{
    If (Index != A_EventInfo)
        SortColumns[Index] := 0
}
Return

RefreshList:
;request the server selection page
Try
{
    WebRequest := ComObjCreate("WinHttp.WinHttpRequest.5.1")
    WebRequest.Open("GET",URL) ;open request
    WebRequest.Send() ;send request
    ServerPage := WebRequest.ResponseText ;retrieve response
    WebRequest := "" ;free request
}
Catch Error
{
    WebRequest := "" ;free request
    If (Error.Extra = "Send")
        MsgBox, 16, Error, Could not request server list.
    Else If (Error.Extra = "ResponseText")
        MsgBox, 16, Error, Could not retrieve server list.
    ServerPage := ""
}

RegExMatch(ServerPage,"iS)<div\b[^<]*<a\b[^>]*>[^<]*?([\d\.]+)",Output)
Version := (Output1 = "") ? "Unknown Version" : ("Version " . Output1) ;find the current version

;retrieve the server list
ServerPage := SubStr(ServerPage,InStr(ServerPage,"<pre>") + 5) ;remove everything before the server list
ServerPage := SubStr(ServerPage,1,InStr(ServerPage,"</pre>") - 1) ;remove everything after the server list
StringReplace, ServerPage, ServerPage, `r,, All ;remove carriage returns
ServerPage := Trim(ServerPage,"`n") ;trim off leading and trailing newlines
ServerPage := SubStr(ServerPage,InStr(ServerPage,"`n") + 1) ;remove the header row

GuiControl, -Redraw, ServerList ;prevent redrawing of the ListView

LV_Delete() ;remove all listview entries

;populate the ListView
Loop, Parse, ServerPage, `n
{
    RegExMatch(A_LoopField,"S)\s*(\d+)\s*/\s*(\d+)\s*(\d+)\s*[^>]*>\s*[^""]*""([^""]+)[^>]*>([^<]+)",Output)
    RegExMatch(Output4, "aos\:\/\/(?<server>\d+)(?:\:(?<port>\d+))", output)
    Server := outputserver
    Port := outputport
    Address := (Server & 0xFF) . "." . ((Server & 0xFF00) >> 8) . "." . ((Server & 0xFF0000) >> 16) . "." . ((Server & 0xFF000000) >> 24)
    LV_Add("",A_Index,Output5,Output1,Output2,Output3,Output4,Address,Port)
}

;adjust column widths to suit their headers and contents
LV_ModifyCol(1,"AutoHdr Integer") ;index
LV_ModifyCol(2,"AutoHdr") ;server name
LV_ModifyCol(3,"AutoHdr Integer Desc") ;players
LV_ModifyCol(4,"AutoHdr Integer Desc") ;capacity
LV_ModifyCol(5,"AutoHdr Integer") ;ping
LV_ModifyCol(6,"AutoHdr") ;server
LV_ModifyCol(7,"AutoHdr") ;address

For Index, Value In SortColumns
{
    If Value
    {
        LV_ModifyCol(Index,"Sort" . ((Value = 1) ? "" : "Desc"))
        Break
    }
}

GuiControl, +Redraw, ServerList ;allow the ListView to be redrawn

GuiControl,, ServerCount, % LV_GetCount() . " servers." ;update the server count
Gui, Show,, Ace of Spades (%Version%) Servers
Return

JoinServer(Server,Name = "")
{
    global AutoJoin
    Loop
    {
        ;open Ace of Spades
        run, "%A_ScriptDir%\client.exe" "%Server%", %A_ScriptDir%, UseErrorLevel
        If ErrorLevel
        {
            MsgBox, 16, Error, Could not open server "%Server%".
            Return, 1
        }
        WinWait, Ace of Spades|ERROR ahk_class Ace of Spades|#32770,, 5
       
        ;check for connection errors
        WinGetClass, WindowClass
        If (WindowClass != "Ace of Spades") ;error dialogue
        {
            WinClose
            If !AutoJoin
            {
                MsgBox, 22, Error, Could not connect to "%Name%": server is full or misconfigured.`n`nSelect "Try Again" to retry the connection`, or "Continue" to automaticially join.
                IfMsgBox, Cancel
                {
                    Gosub, StopAutoJoin
                    Break
                }
                IfMsgBox, Continue
                {
                    AutoJoin := 1
                    ToolTip, Press Esc to stop automatic retrying.
                    Hotkey, Esc, StopAutoJoin, On
                }
            }
        }
        Else
        {
            Gosub, StopAutoJoin
            If ErrorLevel ;window wait operation timed out
                Return, 1
            WinSetTitle, Ace of Spades ahk_class Ace of Spades,, Ace of Spades - %Name%
            WinWaitClose
            Break
        }
    }
    Return, 0
   
    StopAutoJoin:
    AutoJoin := 0
    ToolTip
    Hotkey, Esc, StopAutoJoin, Off
    Return
}

#If ListViewFocused()

ListViewFocused()
{
    GuiControlGet, CurrentFocus, FocusV
    Return, CurrentFocus = "ServerList" && LV_GetNext()
}

Enter::Gosub, SelectServer

#If

_________________
Scripts - License


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 39 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bon, sks and 21 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group