'IMPORTANT - WHEN YOU UPDATE THIS FILE IN THE CMS, REPLACE IT ALSO IN data\sw_support
'ON THE OUTPUT GENERATOR FOR ALL ACTIVE OG INSTANCES
'AWH 03Aug2015 commented out Alerts in OpenCWFile function
'AWH 30Jul15 - Updated CSQuickTips.QuickTips.23 to CSQuickTips.QuickTips.24 for use with SW Simulation 2016
'AWH 25Mar15 - Updated SwHtmlInterface.23 to SwHtmlInterface.24 for use with SW2016'
'ALF 28May14 - Updated SwHtmlInterface.22 to SwHtmlInterface.23 for use with SW2015'
'AWH 11Jun14 - Updated CSQuickTips.QuickTips.21 to CSQuickTips.QuickTips.23 for use with SW Simulation 2015
'CTO 09Jul13 - Updated SwHtmlInterface.21 to SwHtmlInterface.22 for use with SW2014'
'CAS 17Jan12 - Updated SwHtmlInterface.20 to SwHtmlInterface.21 for use with SW2013'
'CAS 17Jan12 - Updated CSQuickTips.QuickTips.20 to CSQuickTips.QuickTips.21 for use with SW Simulation 2013
'AWH 06Jun11 - Updated CSQuickTips.QuickTips.1 to CSQuickTips.QuickTips.20 for use with SW Simulation 2012
'AWH 13Apr11 - Updated SwHtmlInterface.19 to SwHtmlInterface.20 for use with SW2012
'CAS 04Jan10 - Updated SwHtmlInterface.18 to SwHtmlInterface.19 for use with SW2011
'CAS 17Mar09 - Updated SwHtmlInterface.17 to SwHtmlInterface.18 for use with SW2010
'DKG 23Feb09 - Added ShowMe function for 2010 Project 14670: Tutorials that drive
' the SolidWorks Interface (show me how). This function was created
' by John Sweeney.
'SRC 13June08 - SPR 430845, Changes in function OpenCWFile().
'CAS 27May08 - Updated SwHtmlInterface.16 to SwHtmlInterface.17 for use with SW2009
'JDR 23Mar07 - Updated SwHtmlInterface.15 to SwHtmlInterface.16 for use with SW2008
'CSH 061129 - Added functions to open the tutorial welcome page or a specific tutorial
'(both in the correct size window) and resize SolidWorks
'CSH 061122 - Added functions to open sldworks.chm or a topic inside sldworks.chm.
'CSH 061026 - Added function to run a macro inside SolidWorks.
'CSH 060710 - FlashAPI added, use this instead of FlashIt when you are
' flashing an add-in toolbar button.
'JBC 09Feb06 - Updated SwHtmlInterface.14 to SwHtmlInterface.15 for use with SW2007
'JDR 27Apr05 - Updated SwHtmlInterface.13 to SwHtmlInterace.14 for use with SW2005
'JDR 25Mar04 - Updated SwHtmlInterface.12 to SwHtmlInterace.13 for use with SW2005
'JDR 2Apr03 - When you call the OpenSWFile function from a help topic, use JavaScript: to
'call the function. I realize this seems strange because you are calling a VBScript
'function, but it is the only way to get it to work. Additionally, you can add a new
'js file and call the function through that (it would then call the VBScript function).
'this has been tested but requires an additional baggage file so do not use it unless
'the first method above fails.
'DKG 26Feb09 - Added ShowMe function for 2010 Project 14670.
' Pass in the lesson folder and macro name, for example:
' Introduction_to_SolidWorks\auto_My_First_Part.swp
Function ShowMe(macroName)
Dim pSldWorks
Set pSldWorks = CreateObject("SwHtmlControl.SwHtmlInterface.24")
Dim swPath
swPath = pSldWorks.GetExecutablePath
Dim macroToRun
macroToRun = swPath + "\autotutorial\Lessons\" + macroName
' MsgBox macroToRun
moduleName = "MainModule" 'All lessons have the same module name
procedureName = "main" 'All lessons have the same procedure name
pSldWorks.Visible = TRUE
pSldWorks.RunMacro macroToRun, moduleName, procedureName
End Function
Function OpenSWFile(swFileName, swFileType)
Dim pSldWorks
Dim swFileOpen
Dim swExePath
Set pSldWorks = CreateObject("SwHtmlControl.SwHtmlInterface.24")
pSldWorks.Visible = TRUE
swExePath = pSldWorks.GetExecutablePath()
swFileOpen = swExePath & swFileName
pSldWorks.OpenDoc swFileOpen, swFileType
End Function
'JDR 25Jul03 Added the Function OpenNonSWFile that is required by FeatureWorks.
Function OpenNonSWFile(swFileName)
Dim pSldWorks
Dim swFileOpen
Dim swExePath
Set pSldWorks = CreateObject("SwHtmlControl.SwHtmlInterface.24")
pSldWorks.Visible = TRUE
swExePath = pSldWorks.GetExecutablePath()
swFileOpen = swExePath & swFileName
pSldWorks.LoadFile swFileOpen, ""
End function
'JDR 23Mar07 Added the Function OpenCWFile that is required by COSMOSWorks because of the different install path.
Function OpenCWFile(swFileName, swFileType)
Dim pSldWorks
Dim pCWWorks
Dim swFileOpen
Dim swExePath
Dim CWAppPath
Dim WshShell
Set pSldWorks = CreateObject("SwHtmlControl.SwHtmlInterface.24")
pSldWorks.Visible = TRUE
'Set WshShell = CreateObject ("WScript.Shell")
'CWAppPath = WshShell.RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\srac\Cosmos/Works\Current Version\LOCALPATHNAME")
'Alert("hey!!")
Set pCwWorks = CreateObject("CSQuickTips.QuickTips.24")
'Set pCwWorks = GetObject("","CSQuickTips.QuickTips.24")
if (pCWWorks.CheckIfCWBusy(FALSE) = FALSE) Then
CWAppPath = pCwWorks.GetExecutablePath()
swFileOpen = CWAppPath & swFileName
'Alert(swFileOpen)
pSldWorks.OpenDoc swFileOpen, swFileType
End If
End Function
'JDR 4Jun03 - The FlashIt function has been upgraded to flash AND show a bubble tip.
function FlashIt(ButtonID)
Dim pSldWorks
Dim newButtonID
Dim flashCommands
newButtonID = ButtonID
Set pSldWorks = CreateObject("SwHtmlControl.SwHtmlInterface.24")
pSldWorks.Visible = TRUE
flashCommands = "" + CStr(newButtonID) + ""
pSldWorks.ShowBubbleTooltip newButtonID, flashCommands, 0, "", ""
End function
Sub CreateNewPart()
Dim pSldWorks
Set pSldWorks = CreateObject("SwHtmlControl.SwHtmlInterface.24")
pSldWorks.Visible = TRUE
pSldWorks.NewPart
End Sub
Sub CreateNewSketch()
Dim pSldWorks
Set pSldWorks = GetObject("", "SwHtmlControl.SwHtmlInterface.24")
pSldWorks.Visible = TRUE
Set swModel = pSldWorks.ActiveDoc
swModel.InsertSketch
End Sub
Sub MakeNewDimension()
Dim pSldWorks
Set pSldWorks = GetObject("", "SwHtmlControl.SwHtmlInterface.24")
pSldWorks.Visible = TRUE
Set swModel = pSldWorks.ActiveDoc
swModel.AddDimension 0, 0, 0
End Sub
Sub ZoomToFitModel()
Dim pSldWorks
Set pSldWorks = GetObject("", "SwHtmlControl.SwHtmlInterface.24")
pSldWorks.Visible = TRUE
Set swModel = pSldWorks.ActiveDoc
swModel.ViewZoomtofit2
End Sub
Sub EnableToggleOption(tOptionID)
Dim pSldWorks
Set pSldWorks = CreateObject("SwHtmlControl.SwHtmlInterface.24")
pSldWorks.Visible = TRUE
pSldWorks.SetUserPreferenceToggle tOptionID, TRUE
MsgBox "Done!", 0, "SolidWorks Help"
End Sub
Sub DisableToggleOption(tOptionID)
Dim pSldWorks
Set pSldWorks = CreateObject("SwHtmlControl.SwHtmlInterface.24")
pSldWorks.Visible = TRUE
pSldWorks.SetUserPreferenceToggle tOptionID, FALSE
MsgBox "Done!", 0, "SolidWorks Help"
End Sub
Sub ChangeDoubleOption(dOptionID, setting)
Dim pSldWorks
Set pSldWorks = CreateObject("SwHtmlControl.SwHtmlInterface.24")
pSldWorks.Visible = TRUE
pSldWorks.SetUserPreferenceDoubleValue dOptionID, setting
MsgBox "Done!", 0, "SolidWorks Help"
End Sub
Sub ChangeIntegerOption(iOptionID, iValue)
Dim pSldWorks
Set pSldWorks = CreateObject("SwHtmlControl.SwHtmlInterface.24")
pSldWorks.Visible = TRUE
pSldWorks.SetUserPreferenceIntegerValue iOptionID, iValue
MsgBox "Done!", 0, "SolidWorks Help"
End Sub
Sub ChangeStringOption(sOptionID, strValue)
Dim pSldWorks
Set pSldWorks = CreateObject("SwHtmlControl.SwHtmlInterface.24")
pSldWorks.Visible = TRUE
pSldWorks.SetUserPreferenceStringValue sOptionID, strValue
MsgBox "Done!", 0, "SolidWorks Help"
End Sub
Sub ChangeTextFormatOption(tfOptionID)
Dim pSldWorks
Set pSldWorks = CreateObject("SwHtmlControl.SwHtmlInterface.24")
pSldWorks.Visible = TRUE
pSldWorks.SetUserPreferenceTextFormat tfOptionID, TRUE
MsgBox "Done!", 0, "SolidWorks Help"
End Sub
'MIQ 4Nov03 Added this function to highlight and flash COSMOS toolbar buttons
'JDR 23Mar07 Merged this function from the COSMOS script file.
Sub FlashCosmosButton(ButtonID, flashCommands, titleString, messageString)
Dim pCWorks
Dim newButtonID
Set pCWorks = GetObject("","CSQuickTips.QuickTips.24")
pCWorks.ShowBubbleTooltip ButtonID, flashCommands,0,titleString, messageString
End Sub
' CSH 060710
' This function flashes a button on an API toolbar .
function FlashAPI(ClsID,UserCmdID )
Dim pSldWorks
Dim newButtonID
Dim flashCommands
Set pSldWorks = CreateObject("SwHtmlControl.SwHtmlInterface.24")
newButtonID = pSldWorks.GetCommandID ( ClsID, UserCmdID)
pSldWorks.Visible = TRUE
flashCommands = "" + CStr(newButtonID) + ""
pSldWorks.ShowBubbleTooltip newButtonID, flashCommands, 0, "", ""
End function
'CSH 061026
' This function runs a macro inside SolidWorks.
Function RunMacro(MacroPathName, MacroModuleName, MacroProceedureName)
Dim pSldWorks
Dim swFileOpen
Dim swExePath
Set pSldWorks = CreateObject("SwHtmlControl.SwHtmlInterface.24")
pSldWorks.Visible = TRUE
swExePath = pSldWorks.GetExecutablePath()
swFileOpen = swExePath & MacroPathName
pSldWorks.RunMacro swFileOpen, MacroModuleName, MacroProceedureName
End Function
'CSH 061122
' This function opens sldworks.chm or a topic inside sldworks.chm.
' To open sldworks.chm only, use:
'
' *****note that inside the parenthesis are two single quotes******
' To open a specific topic, use:
'
Function OpenSWHelpTopic(TopicPath)
Dim pSldWorks
Set pSldWorks = CreateObject("SwHtmlControl.SwHtmlInterface.24")
pSldWorks.Visible = TRUE
If (TopicPath = "") then
pSldWorks.openhtmlhelp("sldworks.chm")
Else
pSldWorks.openhtmlhelp("sldworks.chm::/" + TopicPath)
End If
End function
'CSH 061129
' This function opens the tutorial welcome page in the correct size window and resizes SolidWorks.
Function OpenTutorialWindow()
Dim pSldWorks
Set pSldWorks = CreateObject("SwHtmlControl.SwHtmlInterface.24")
pSldWorks.Visible = TRUE
pSldWorks.openhtmlhelp("swtutorial.chm")
' To access function, put scripts into the topic, then use this call:
'
End function
'CSH 061129
' This function opens a specific tutorial, to a specific page, in the correct size window, and resizes SolidWorks.
Function OpenTutorial(TutorialName, TopicPath)
Dim pSldWorks
Set pSldWorks = CreateObject("SwHtmlControl.SwHtmlInterface.24")
pSldWorks.Visible = TRUE
pSldWorks.openhtmlhelp("swtutorial.chm::/" + TutorialName + "::/" + TopicPath)
' To access function, put scripts into the topic, then use this type of call:
'
' example:
'
' Note: The topic_name can be any topic in the tutorial, to open at the beginning,
' use the name of the default topic.
End function