Automatically download the newest daily build

Powershell version to automatically download latest build

I finally got around to writing this today.

A powershell version of this script that as long as you have powershell downloaded you don't need any compilation or other programs.

Note this downloads and launches the file from the directory the .ps1 is stored in

Code:
#download latest
$loc=(Split-Path -parent $MyInvocation.MyCommand.Definition)
$webclient = New-Object System.Net.WebClient
$results=$webClient.DownloadString("http://builds.kolmafia.us")
$results=$results.substring($results.IndexOf('http://builds.kolmafia.us/KoLmafia-'),80)
$latest=$results.substring(0,$results.indexof('.jar')+4)
$filename=$latest.substring($latest.lastindexof('/')+1)
if (!(Test-Path $loc\$filename)) { $webClient.DownloadFile($latest, "$loc\$filename") }

#cleanup old, leave latest 2
get-childitem $loc\*.jar | sort -desc -prop LastWriteTime | select -skip 2 | del

#launch latest
cd $loc
& $((get-childitem $loc\*.jar | sort -prop LastWriteTime | select -last 1).ToString())

My desktop shortcut looks something like this:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -file "C:\KoLmafia\Launch.ps1"
 

matt.chugg

Moderator
Rinn's download works on the basis of the first build on the page being the latest, this will fix itself when fewyn fixes the daily build page.
 
I've fixed my updater to work around this glitch. My updater made the exact same assumption in V8.0 and earlier. Now it determines what the latest KoLmafia version is by looking at the Last 30 Changes area, instead. ;)
 

matt.chugg

Moderator
Can someone fix this python version, please?

same problem as the others,

Code:
		break		#End the loop, since we found the first (ie most recent) daily build

removing the break would fix as it would be the last link on the page, however I don't know where 10001 is going to put itself on the page, so its a bit difficult fixing anything properly!
 

tgetgel

Member
I reloaded SW on a PC (XP Pro up through SP2). Now I get this application error: The application failed to initialize properly (0xc0000135). Click OK to terminate application.

The internet says to install the .NET framework. Does it make sense for that to solve the issue? Thanks in advance.
 

kitsunegami

New member
I reloaded SW on a PC (XP Pro up through SP2). Now I get this application error: The application failed to initialize properly (0xc0000135). Click OK to terminate application.

The Internet says to install the .NET framework. Does it make sense for that to solve the issue? Thanks in advance.
My wife, for some unknown reason, despises .NET to the point where she refuses to install it no matter how many .NET apps she'd like to use. She actually prefers to manually download a new hourly build every couple of days. I, on the other hand, absolutely adore Rinn's immensely helpful bit of code and am willing to put up with .NET to use it. 8o)

If you, like my wife, would prefer to not use .NET, there is now an OS-agnostic automatic updater but my wife hasn't had time to try it out yet so I don't anything about it since I'm happy using Rinn's app.
 

Raven434

Member
No problems ever, I just started getting these:

Unhandled Exception: System.FormatException: Input string was not in a correct format.
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at KoLMafiaUpdate.Program.Main(String[] args)
 

EdFox

Member
I can confirm Raven's report. It functioned fine on 10578 and this happened when 10608 was the latest version. That's a pretty broad range, unfortunately.
 

Theraze

Active member
Appears that the problem is probably KoLmafia-10600M.jar which has a letter, not just numbers...
 

fronobulax

Developer
Staff member
KoLmafia-10600M.jar

My build tools append the M if the source is not 100% in synch with the latest from SVN. I have expended a fair amount of effort to use the project's build file so I would suggest that the KoLmafia-10600M.jar has no business being in a repository of files that are built from the latest source. Perhaps someone who understands and monitors that build process might check this out?
 

fewyn

Administrator
Staff member
Something probably didn't get cleaned out properly in the auto build process (ant daily) I have setup and it got created. I just manually deleted the file so it should be fine now.
 

fronobulax

Developer
Staff member
Something probably didn't get cleaned out properly in the auto build process (ant daily) I have setup and it got created. I just manually deleted the file so it should be fine now.

Thanks. I have sometimes gotten unintended M versions when I updated SVN external to the build process and/or something got interrupted or restarted.
 
Top