Jump to content


Photo

Google Go language tool


  • Please log in to reply
No replies to this topic

#1 fredinga

fredinga
  • Members
  • 32 posts

Posted 05 December 2011 - 01:36 PM

I have been trying to learn more about the Google Go language. I downloaded the Win32 installer from this site: <!-- m -->http://code.google.c.../downloads/list<!-- m -->. Then I needed a quick way to organize the various steps to play with the language. AHK to the rescue.

This is a very simple front end for Go written in AutoHotkey. Suggestions and improvements are welcome!

Start here:
Posted Image

Then select options here:
Posted Image

Get a compiled version here:
http://www.autohotke...make/GoMake.exe

;===================================================== Start AHK
#Persistent
#SingleInstance FORCE
#NoEnv
SetWorkingDir %A_ScriptDir%
;======================
onExit,EXIT
HotKey,esc,EXIT
;====================== To INI
gosub, READINI
gosub,getList
return
;===================================================== Close AHK

;Subroutines =====================================================
;------ GUI Sub --------------
getList:
Gui, destroy
Gui, Add, ListView, r12 w300 h300 greadList, .GO Files
Loop, %startPath%\*.go
{
	FileName := A_LoopFileFullPath
	SplitPath,FileName,,,FileExt,FName
	LV_Add("",FName)
}
Gui, Show,, DOUBLE-CLICK ON NAME TO OPEN IT
return

doCommand:
run, %comspec%, %startPath%
return

readList:
if A_GuiEvent = DoubleClick
{
	LV_GetText(txtFile, A_EventInfo, 1)
	FileRead,moItems,%startPath%\%txtFile%.go
}
gosub,showList
return

showList:
Gui, destroy
Gui, Add, ListView, r30 w600 h300, Source
Loop,parse,moItems,`n 
{ 
	String:=A_LoopField
	LV_Add("",String)
}
Gui, Add, Button, x10 gdoMakeEXE, Compile to .EXE
Gui, Add, Button, x+15 gdoMakeLink, Compile - Keep Link
Gui, Add, Button, x+40 gdoEdit, Edit Source
Gui, Add, Button, x+30 gdoCommand, Run Command Window
Gui, Add, Button, x+60 ggetList,Begin Again
Gui, Show,,Program Selected: %startPath%\%txtFile%.go
return

doMakeEXE:
if A_GuiEvent = DoubleClick
{
	LV_GetText(txtFile, A_EventInfo, 1)
}
FileDelete, %startPath%\%vers%.out.exe
FileDelete, %startPath%\%txtFile%.exe
runWait, %comspec% /c %compilerPath%\%vers%g %startPath%\%txtFile%.go,, Hide
runWait, %comspec% /c %compilerPath%\%vers%l %startPath%\%txtFile%.%vers%,, Hide
FileMove, %startPath%\%vers%.out.exe, %startPath%\%txtFile%.exe
FileDelete, %startPath%\%txtFile%.%vers%
msgbox, Done!
return

doMakeLink:
if A_GuiEvent = DoubleClick
{
	LV_GetText(txtFile, A_EventInfo, 1)
}
FileDelete, %startPath%\%vers%.out.exe
FileDelete, %startPath%\%txtFile%.exe
runWait, %comspec% /c %compilerPath%\%vers%g %startPath%\%txtFile%.go,, Hide
runWait, %comspec% /c %compilerPath%\%vers%l %startPath%\%txtFile%.%vers%,, Hide
FileMove, %startPath%\%vers%.out.exe, %startPath%\%txtFile%.exe
msgbox, Done!
return

doEdit:
run, %ProgramFiles%\Windows NT\Accessories\wordpad.exe %startPath%\%txtFile%.go
return
;----------------------------------------------

;==================================================
READINI:
IfNotExist,%A_ScriptDir%\GoMake.ini
{
	ini=[Settings]
	ini=%ini%`n  startPath=C:\go\test
	ini=%ini%`n  compilerPath=C:\go\bin
	ini=%ini%`n  vers=8
	FileAppend,%ini%,%A_ScriptDir%\GoMake.ini
	ini=
}
IniRead,startPath,%A_ScriptDir%\GoMake.ini,Settings,startPath
IniRead,compilerPath,%A_ScriptDir%\GoMake.ini,Settings,compilerPath
IniRead,vers,%A_ScriptDir%\GoMake.ini,Settings,vers
Return

;------ Sub --------------
esc::
GuiClose:
GuiEscape:
EXIT:
  ExitApp
return
;====================== END ==================================