In my workflow I open Resultsviewer a lot, and look at the EnergyPlus .err file.
Since this debugging is quite time-consuming, I'm trying to optimize my workflow using AutoHotKey (http://www.autohotkey.com/)
I wrote a script that does the following, for the most recently run .osm-file:
- Ctrl+R: Opens Resultsviewer (and goes to tree view + collapses the tree)
- Ctrl+E: Opens the .err in Notepad++
- Ctrl+D: Opens the folder in explorer
I didn't do any thorough testing, so it may need modifications on your system. Feel free to use/modify.
SetTitleMatchMode, 2
; OpenStudio Shortcuts
OSDir()
{
NewestTime = 20100101000000
NewestName = 0
Loop, %USERPROFILE%\AppData\Local\Temp\OpenStudio*,2
{
;dt = %A_LoopFileTimeModified%
FileGetTime, dt, %A_LoopFileFullPath%\resources
EnvSub, dt, %NewestTime%, seconds
if dt > 0 ; Source file is newer than destination file.
{
IfExist, %A_LoopFileFullPath%\resources\run ; Folder contains run data
{
;NewestTime = %A_LoopFileTimeModified%
FileGetTime, NewestTime, %A_LoopFileFullPath%\resources
NewestName = %A_LoopFileFullPath%
}
}
}
;Newest folder is %NewestName%
return %NewestName%
}
#IfWinActive, osm ahk_class Qt5QWindowIcon
; Open most recent SQL database in ResultsViewer
^r::
OSD := OSDir()
Run "C:\Program Files\OpenStudio 1.6.0\bin\ResultsViewer.exe" "%OSD%\resources\run\5-EnergyPlus-0\eplusout.sql"
WinWait, ResultsViewer,
IfWinNotActive, ResultsViewer, , WinActivate, ResultsViewer,
WinWaitActive, ResultsViewer,
;MouseClick, left, 136, 182
ControlClick, x136 y182
Sleep, 100
;MouseClick, left, 152, 208
ControlClick, x152 y208
Sleep, 100
Send, {DOWN}{LEFT}{DOWN}{LEFT}{DOWN}{LEFT}{DOWN}{LEFT}{DOWN}{LEFT}{DOWN}{LEFT}{DOWN}{LEFT}{DOWN}{LEFT}{DOWN}{LEFT}{DOWN}{LEFT}{DOWN}{LEFT}
Return
; Open E+ Error file with Notepad++
^e::
OSD := OSDir()
Run "C:\Program Files (x86)\Notepad++\notepad++.exe" "%OSD%\resources\run\5-EnergyPlus-0\eplusout.err"
Return
; Open Directory containing files
^d::
OSD := OSDir()
Run explorer.exe "%OSD%\resources\run"
Return
#IfWinActive