codestack icon indicating copy to clipboard operation
codestack copied to clipboard

Quick view from file explorer macro not running

Open Sarang0550 opened this issue 1 year ago • 0 comments

Hello I tried a solidworks macros from code stack about quick view option to view solidworks assembly directly from file explorer .....please let me know if there are some specific system or software specifications for this macros. Or any changes I have to make in script....I did everything...but it's not working.

This was on codestack

The following guide explains how to enable Quick View mode directly from the Windows File Explorer.

Create new folder which will contain the script to open the file in Quick View mode Create a text file with an extension of .vbs and name it opener.vbs Paste the following code into this file

THE CODE:

'********************** 'Copyright(C) 2024 Xarial Pty Limited 'Reference: https://www.codestack.net/solidworks-api/getting-started/scripts/vbscript/open-quick-view/ 'License: https://www.codestack.net/license/ '**********************

Dim swApp Set swApp = CreateObject("SldWorks.Application") swApp.Visible = True

Dim filePath filePath = WScript.Arguments.Item(0)

If filePath <> "" then

Dim docSpec
Set docSpec = swApp.GetOpenDocSpec(filePath)
docSpec.ViewOnly = True

Dim swModel
Set swModel = swApp.OpenDoc7(docSpec)

If swModel is Nothing Then
	MsgBox "Failed to open document"
End If

Else MsgBox "File path is not specified" End If

Create another text file and name it install.cmd Add the following line into the install.cmd which will enable a Quick Mode for assemblies

Code:

reg add "HKCR\SldAssem.Document\shell\Quick View\command" /ve /d "wscript.exe """%~dp0opener.vbs""" ""%%1""" /f

Save both files. It is important to keep those files in the same folder

Run install.cmd. You might need to run this as an administrator As the result the Quick View context menu command is added to the Windows File Explorer. Select any assembly and click right mouse button. Click Quick View and the file will be opened in the quick view mode in SOLIDWORKS.

Screenshot_2024-09-07-03-58-20-83_40deb401b9ffe8e1df2f1cc5ba480b12 Screenshot_2024-09-07-03-58-30-86_40deb401b9ffe8e1df2f1cc5ba480b12 Screenshot_2024-09-07-03-58-35-25_40deb401b9ffe8e1df2f1cc5ba480b12 Screenshot_2024-09-07-03-58-14-99_40deb401b9ffe8e1df2f1cc5ba480b12

Sarang0550 avatar Sep 07 '24 09:09 Sarang0550