diff --git a/Output/Setup_RevitPythonShell_2018.exe b/Output/2017.07.24_Setup_RevitPythonShell_2018.exe similarity index 88% rename from Output/Setup_RevitPythonShell_2018.exe rename to Output/2017.07.24_Setup_RevitPythonShell_2018.exe index 48dc059..e6573cb 100644 Binary files a/Output/Setup_RevitPythonShell_2018.exe and b/Output/2017.07.24_Setup_RevitPythonShell_2018.exe differ diff --git a/RevitPythonShell/RevitPythonShellApplication.cs b/RevitPythonShell/RevitPythonShellApplication.cs index ffd2fbf..50c1ec3 100644 --- a/RevitPythonShell/RevitPythonShellApplication.cs +++ b/RevitPythonShell/RevitPythonShellApplication.cs @@ -52,7 +52,10 @@ Result IExternalApplication.OnStartup(UIControlledApplication application) } catch (Exception ex) { - TaskDialog.Show("Error setting up RevitPythonShell", ex.ToString()); + var td = new TaskDialog("Error setting up RevitPythonShell"); + td.MainInstruction = ex.Message; + td.ExpandedContent = ex.ToString(); + td.Show(); return Result.Failed; } } @@ -61,7 +64,7 @@ private static void ExecuteStartupScript(UIControlledApplication uiControlledApp { // we need a UIApplication object to assign as `__revit__` in python... var versionNumber = uiControlledApplication.ControlledApplication.VersionNumber; - var fieldName = versionNumber == "2017" ? "m_uiapplication": "m_application"; + var fieldName = int.Parse(versionNumber) >= 2017 ? "m_uiapplication": "m_application"; var fi = uiControlledApplication.GetType().GetField(fieldName, BindingFlags.NonPublic | BindingFlags.Instance); var uiApplication = (UIApplication)fi.GetValue(uiControlledApplication); // execute StartupScript diff --git a/RpsRuntime/RpsExternalApplicationBase.cs b/RpsRuntime/RpsExternalApplicationBase.cs index dd511be..1327062 100644 --- a/RpsRuntime/RpsExternalApplicationBase.cs +++ b/RpsRuntime/RpsExternalApplicationBase.cs @@ -173,7 +173,7 @@ private void ExecuteStartupScript(UIControlledApplication uiControlledApplicatio { // we need a UIApplication object to assign as `__revit__` in python... var versionNumber = uiControlledApplication.ControlledApplication.VersionNumber; - var fieldName = versionNumber == "2017" ? "m_uiapplication" : "m_application"; + var fieldName = int.Parse(versionNumber) >= 2017 ? "m_uiapplication" : "m_application"; var fi = uiControlledApplication.GetType().GetField(fieldName, BindingFlags.NonPublic | BindingFlags.Instance); var uiApplication = (UIApplication)fi.GetValue(uiControlledApplication); // execute StartupScript