Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quick view from file explorer macro not running #369

Open
Sarang0550 opened this issue Sep 7, 2024 · 0 comments
Open

Quick view from file explorer macro not running #369

Sarang0550 opened this issue Sep 7, 2024 · 0 comments

Comments

@Sarang0550
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant