Skip to content

Instantly share code, notes, and snippets.

@johnlindquist
Created August 8, 2011 22:49
Show Gist options
  • Save johnlindquist/1132950 to your computer and use it in GitHub Desktop.
Save johnlindquist/1132950 to your computer and use it in GitHub Desktop.
A script to launch or focus and refresh the Corona Simulator
Set WshShell = WScript.CreateObject ("WScript.Shell")
Set colProcessList = GetObject("Winmgmts:").ExecQuery ("Select * from Win32_Process")
'Check if Corona is already running
For Each objProcess in colProcessList
If objProcess.name = "Corona Simulator.exe" then
vFound = True
End if
Next
If vFound = True then
'If Corona is already running, then switch to it and refresh
WshShell.AppActivate "C:\Program Files (x86)\Ansca\Corona SDK\Corona Simulator.exe"
WScript.Sleep 100
WshShell.SendKeys "{ESC}"
WScript.Sleep 100
WshShell.AppActivate "Corona Simulator"
WScript.Sleep 200
WshShell.SendKeys "^r"
Else
'If Corona isn't running, launch it with your main.lua
WshShell.Run """C:\Program Files (x86)\Ansca\Corona SDK\Corona Simulator.exe """ & WScript.Arguments(0)
End If
@royiversen
Copy link

Hi, thanks for the script, it helped a lot. However, refreshing the simulator does not work completely.

Line 16 needs a hyphen, like so:
WshShell.AppActivate "- Corona Simulator"

This will give focus to the simulator instead of the ouput, thus refreshing should work again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment