Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Autohotkey open Resultsviewer and E+ error file

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

Autohotkey open Resultsviewer and E+ error file

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 I was looking for a way to optimize my workflow using AutoHotKey (http://www.autohotkey.com/)

I wrote a script that does the following, can for the most recently run .osm-file:instance open ResultsViewer, and i easily modifiable to perform other actions.

  • 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

Autohotkey open Resultsviewer and E+ error file

In my workflow I open Resultsviewer a lot, and look at the EnergyPlus .err file.

Since this debugging is quite time-consuming, I was looking for a way to optimize my workflow using AutoHotKey (http://www.autohotkey.com/)

I wrote a script that can for instance open ResultsViewer, and i is easily modifiable to perform other actions.

Autohotkey open Resultsviewer and E+ error file

In my workflow I open Resultsviewer a lot, and look at the EnergyPlus .err file.

Since this debugging is quite time-consuming, I was looking for a way to optimize my workflow using AutoHotKey (http://www.autohotkey.com/)

I wrote a script that can for instance open ResultsViewer, and is easily modifiable to perform other actions.

Autohotkey open Resultsviewer and E+ error file

In my workflow I open Resultsviewer a lot, and look at the EnergyPlus .err file.

Since this debugging is quite time-consuming, I was looking for a way to optimize my workflow using AutoHotKey (http://www.autohotkey.com/)

I wrote a script that can for instance open ResultsViewer, and is easily modifiable to perform other actions.

Autohotkey open Resultsviewer and E+ error file

In my workflow I open Resultsviewer a lot, and look at the EnergyPlus .err file.

Since this debugging is quite time-consuming, I was looking for a way to optimize my workflow using AutoHotKey (http://www.autohotkey.com/)

I wrote a script that can for instance open ResultsViewer, and is easily modifiable to perform other actions.

Autohotkey open Resultsviewer and E+ error file

In my workflow I open Resultsviewer a lot, and look at the EnergyPlus .err file.

Since this debugging is quite time-consuming, I was looking for a way to optimize my workflow using AutoHotKey (http://www.autohotkey.com/)

I wrote a script that can for instance open ResultsViewer, and is easily modifiable to perform other actions.

Autohotkey open Resultsviewer and E+ error file

In my workflow I open Resultsviewer a lot, and look at the EnergyPlus .err file.

Since this debugging is quite time-consuming, I was looking for a way to optimize my workflow using AutoHotKey (http://www.autohotkey.com/)

I wrote a script that can for instance open ResultsViewer, and is easily modifiable to perform other actions.