Anyone know how to set up a macro so the task scheduler can open a file and then save it. Not to convert, just save.
Thanks.
Anyone know how to set up a macro so the task scheduler can open a file and then save it. Not to convert, just save.
Thanks.
You may use this macro Zoom and Rebuild
OR
You need to create SolidWorks Macro Template to use in task scheduler (Search for SolidWorks Macro Template under task scheduler help files)
Sorry for the bad link, I have fixed it now.
You just need to edit the macro as change the file location. And then finally run it though SW (no need to use task scheduler).
Extract the macro to a known location. Then check these linkf for how to
And if you need to go via task scheduler route, you need to create a SolidWorks Macro Template
Good to know that you're getting into it.
Now to fix this issue, edit your macro (using the method I stated above) and go to Tools > References. Now uncheck any missing library and select the corresponding one for the SW version you have. Click OK to apply the changes and then click on Save to save the settings. Run the macro again (make sure you have changed the file location)
Michael Cudnik wrote:
I attempted to set the number to 200 on your new macro and it still stopped at 128.
I said the macro stops at 128 (not sure why) in macro and that's why I have put the counter to 100. You may put 128 if you wish.
Michael Cudnik wrote:
Anyway to "type in" the starting file number and then it will go 128 from that one??
I don't know any option to do that. May be create another folder in the same location and move the updated files in that. After that rerun the macro.
Hi Michael,
I didn't have time to test this, but I suspect the problem was from the MAX_PATH constant set to 260 characters...
You must have a massive folder structure behind these assemblies you're trying to run, and by coincidence, it's always been the 128th assembly...
Try this macro out...and report back...
Hope this helps
Cheers
Please disregard my previous post...as that max_path constant was strictly for the search folder...
I'm assuming you trying to achieve the same you asked in your other thread....so go with the macro I wrote up instead...
As for what's wrong with this macro, my next guess would be, that the Function Dir that's being used to get the file list, must have a limitation in characters...if you still wish to use this macro...i would recommend moving your assemblies a couple of levels (of folders) down...
Here's the solution...
https://forum.solidworks.com/message/190147#190147
cheers
Deepak,
Is it possible to add the function of the macro below into your "Batch File Open and Save" macro, so that it can perform the original function and the additional function found on my macro below?
' ******************************************************************************
' Created and Copyright by Raúl Rosa (08/02/2010) - All rights Reserved
' ******************************************************************************
Dim swApp As Object
Dim Part As Object
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Dim MyProp(1, 1) As String
'Property names
MyProp(0, 0) = "ECCN"
MyProp(0, 1) = "Export Control Flag"
'Property values
MyProp(1, 0) = ""
MyProp(1, 1) = "EXPORT CONTROLLED: READ THE DESIGN BINDER"
Dim m As Integer
For m = 0 To 1
retval = Part.AddCustomInfo3("", MyProp(0, m), 30, _
MyProp(1, m))
Next m
Set SelMgr = Part.SelectionManager
boolstatus = Part.Extension.SelectByID2("Design Binder", "DOCSFOLDER", 0, 0, 0, False, 0, Nothing, 0)
boolstatus = Part.Extension.InsertAttachment("J:\SolidWorks 2009 Settings\Macros\Export Control\Add Export Control Metadata\EXPORT CONTROLLED.doc", False)
boolstatus = Part.Extension.InsertAttachment("J:\SolidWorks 2009 Settings\Macros\Export Control\Add Export Control Metadata\PROPRIETARY NOTICE.doc", False)
Dim longstatus As Long, longwarnings As Long
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
boolstatus = Part.Extension.SelectByID2("", "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)
Dim myComment As Object
Set myComment = Part.Extension.AddComment("EXPORT CONTROLED")
Part.ClearSelection2 True
End Sub
-----------------------------------------------------------------------------------------------------------------------------------------
Thanks in advance for any help.
Raul
Don't know why that is not working. Try the attached one, just extract and run.
Currently the macro works for SW Drawings. Change the codes for parts or assemblies. And no need to set the folder/file location in the macro, just use browse option.