Hello again.
I would like to ask the wizards about a small problem that is wasting some of my time.
We have installed Directory Opus on some computers at work and we use many common scripts. My issue is that any time I change something on a script I have to go around and replace manually the previous script on all machines. Is there any way to have the scripts executed from a single network location so I only have to make the changes once?
Thank you in advance
lxp
May 26, 2023, 10:30am
2
Thank you very much for the prompt help. Sorry I couldn't answer earlier to thank you.
I am trying to make it work with some VBScripts that use resources but still haven't manage to.
I have saved my script as a vbs file and tried to have the resources in the same file separated by "==SCRIPT RESOURCES" as I have seen in some other threads but I have the feeling I am way off and lack some understanding.
I have managed to make the Dopusrt work with internal directory opus commands though.
Do you have any insight to share?
Leo
May 29, 2023, 3:42pm
4
Can we see the script / file?
How are you running it?
Where is it stored?
My script is the wall of text below.
Function OnClick(ByRef clickData)
Set dlg = DOpus.Dlg
dlg.window = clickData.func.sourcetab
dlg.template = "New Design Folder"
dlg.detach = true
dlg.Show
'7 - Example for Log Printing ---> DOpus.Output("WOOHOO")
Do
Set msg = dlg.GetMsg()
'10 - If the event is Pressed Button then -------------------------------------
if msg.event = "click" Then
' Checks if the Client and Job textfiels are completed
if dlg.Control("TB_Client").value = "" or dlg.Control("TB_Job").value = "" then
if msg.control = "BT_CreateFolder" Then
Set dlg2 = DOpus.Dlg
dlg2.window = clickData.func.sourcetab
dlg2.template = "Warning_Text_Fields"
dlg2.detach = true
dlg2.Show
end if
else
'22 - If the User pushes the Create Folder Button then do so
if msg.control = "BT_CreateFolder" Then
Dim oFSO
Set oFSO = CreateObject("Scripting.FileSystemObject")
Dim sourcePath
sourcePath = clickData.func.SourceTab.Path
sourcePath = DOpus.FSUtil.Resolve(sourcePath)
'29 - folderpath is the path of the folder that we create
'30 - If the Suffix checkbox is checked add at the folder name CD or FD else leave it without
if dlg.Control("CHB_Suffix").value=-1 then
if dlg.Control("CB_Type").value=0 or dlg.Control("CB_Type").value=2 then folderpath = sourcePath + "\" + dlg.Control("TB_Client").value + " - " + dlg.Control("TB_Job").value + " FD\"
if dlg.Control("CB_Type").value=1 then folderpath = sourcePath + "\" + dlg.Control("TB_Client").value + " - " + dlg.Control("TB_Job").value + " CD\"
else
folderpath = sourcePath + "\" + dlg.Control("TB_Client").value + " - " + dlg.Control("TB_Job").value + "\"
end if
DOpus.Output(folderpath+" MPE")
oFSO.CreateFolder folderpath
oFSO.CreateFolder folderpath + "1-CAD"
oFSO.CreateFolder folderpath + "2-3D"
if dlg.Control("CHB_FloorSc").value=-1 Then
oFSO.CopyFile "Z:\4-Designers Info\Templates\Templates for Keyshot\Scenes\P1 Scene - Floor.bip" , folderpath + "2-3D\"
ofso.GetFile(folderpath + "2-3D\P1 Scene - Floor.bip").attributes = ofso.GetFile(folderpath + "2-3D\P1 Scene - Floor.bip").attributes - 1
end if
'if dlg.Control("CHB_FloorScOpacity").value=-1 Then
' oFSO.CopyFile "Z:\4-Designers Info\Templates\Templates for Keyshot\Scenes\P1 Scene - Floor - Opaque Models.bip" , folderpath + "2-3D\"
' ofso.GetFile(folderpath + "2-3D\P1 Scene - Floor - Opaque Models.bip").attributes = ofso.GetFile(folderpath + "2-3D\P1 Scene - Floor - Opaque Models.bip").attributes - 1
'end if
if dlg.Control("CHB_CounterSc").value=-1 Then
oFSO.CopyFile "Z:\4-Designers Info\Templates\Templates for Keyshot\Scenes\P1 Scene - Counter.bip" , folderpath + "2-3D\"
ofso.GetFile(folderpath + "2-3D\P1 Scene - Counter.bip").attributes = ofso.GetFile(folderpath + "2-3D\P1 Scene - Counter.bip").attributes - 1
end if
'if dlg.Control("CHB_CounterScOpacity").value=-1 Then
' oFSO.CopyFile "Z:\4-Designers Info\Templates\Templates for Keyshot\Scenes\P1 Scene - Counter - Opaque Models.bip" , folderpath + "2-3D\"
' ofso.GetFile(folderpath + "2-3D\P1 Scene - Counter - Opaque Models.bip").attributes = ofso.GetFile(folderpath + "2-3D\P1 Scene - Counter - Opaque Models.bip").attributes - 1
'end if
if dlg.Control("CHB_SuperMarketSc").value=-1 Then
oFSO.CopyFile "Z:\4-Designers Info\Templates\Templates for Keyshot\Scenes\P1 Scene - Super Market Shelves.bip" , folderpath + "2-3D\"
ofso.GetFile(folderpath + "2-3D\P1 Scene - Super Market Shelves.bip").attributes = ofso.GetFile(folderpath + "2-3D\P1 Scene - Super Market Shelves.bip").attributes - 1
end if
if dlg.Control("CHB_PharmacySc").value=-1 Then
oFSO.CopyFile "Z:\4-Designers Info\Templates\Templates for Keyshot\Scenes\P1 Scene - Pharmacy Shelves.bip" , folderpath + "2-3D\"
ofso.GetFile(folderpath + "2-3D\P1 Scene - Pharmacy Shelves.bip").attributes = ofso.GetFile(folderpath + "2-3D\P1 Scene - Pharmacy Shelves.bip").attributes - 1
end if
oFSO.CreateFolder folderpath + "2-3D\Images"
if dlg.Control("CHB_ColorWhite").value=-1 Then
oFSO.CopyFile "Z:\4-Designers Info\Templates\Templates for 3DS Max\Textures\Color White.jpg" , folderpath + "2-3D\Images\"
ofso.GetFile(folderpath + "2-3D\Images\Color White.jpg").attributes = ofso.GetFile(folderpath + "2-3D\Images\Color White.jpg").attributes - 1
end if
if dlg.Control("CHB_CorrugatedStrip").value=-1 Then
oFSO.CopyFile "Z:\4-Designers Info\Templates\Templates for 3DS Max\Textures\Corrugated strip.jpg" , folderpath + "2-3D\Images\"
ofso.GetFile(folderpath + "2-3D\Images\Corrugated strip.jpg").attributes = ofso.GetFile(folderpath + "2-3D\Images\Corrugated strip.jpg").attributes - 1
end if
if dlg.Control("CHB_Cardboard").value=-1 Then
oFSO.CopyFile "Z:\4-Designers Info\Templates\Templates for 3DS Max\Textures\Cardboard.jpg" , folderpath + "2-3D\Images\"
ofso.GetFile(folderpath + "2-3D\Images\Cardboard.jpg").attributes = ofso.GetFile(folderpath + "2-3D\Images\Cardboard.jpg").attributes - 1
end if
oFSO.CreateFolder folderpath + "2-3D\Renders"
oFSO.CreateFolder folderpath + "3-Presentation"
oFSO.CreateFolder folderpath + "3-Presentation\Illustrator"
oFSO.CreateFolder folderpath + "3-Presentation\Layout"
oFSO.CreateFolder folderpath + "Info-Briefs"
exit do
end if
end if
'If the User pushes the Cancel Button then Exit
if msg.control = "BT_Cancel" Then exit do
end if
'If the event is change of a Combobox then -------------------------------------
if msg.event = "selchange" Then
'If the Type of Display Combobox changes then
if msg.control = "CB_Type" Then
'If the user chooses Cardboard Floor Display
if dlg.Control("CB_Type").value=0 Then
dlg.Control("CHB_FloorSc").value=-1
dlg.Control("CHB_CounterSc").value=0
dlg.Control("CHB_SuperMarketSc").value=0
dlg.Control("CHB_PharmacySc").value=0
dlg.Control("CHB_ColorWhite").value=-1
dlg.Control("CHB_CorrugatedStrip").value=-1
dlg.Control("CHB_Cardboard").value=0
end if
'If the user chooses Counter/Small Factor Display
if dlg.Control("CB_Type").value=1 Then
dlg.Control("CHB_FloorSc").value=0
dlg.Control("CHB_CounterSc").value=-1
dlg.Control("CHB_SuperMarketSc").value=0
dlg.Control("CHB_PharmacySc").value=0
dlg.Control("CHB_ColorWhite").value=-1
dlg.Control("CHB_CorrugatedStrip").value=0
dlg.Control("CHB_Cardboard").value=0
end if
'If the user chooses Other Material Floor Display
if dlg.Control("CB_Type").value=2 Then
dlg.Control("CHB_FloorSc").value=-1
dlg.Control("CHB_CounterSc").value=0
dlg.Control("CHB_SuperMarketSc").value=0
dlg.Control("CHB_PharmacySc").value=0
dlg.Control("CHB_ColorWhite").value=-1
dlg.Control("CHB_CorrugatedStrip").value=0
dlg.Control("CHB_Cardboard").value=0
end if
end if
end if
Loop While msg
End Function
==SCRIPT RESOURCES
<resources>
<resource name="New Design Folder" type="dialog">
<dialog fontsize="10" height="256" lang="english" title="New Design Folder" width="280">
<control halign="center" height="12" name="TB_Client" type="edit" width="195" x="47" y="26" />
<control halign="center" height="12" name="TB_Job" type="edit" width="195" x="47" y="46" />
<control height="40" name="CB_Type" type="combo" width="129" x="47" y="66">
<contents>
<item text="Floor Display (Cardboard)" />
<item text="Counter/Small Factor Display" />
<item text="Floor Display (Other Material)" />
</contents>
</control>
<control halign="left" height="8" name="LB_Client" title="Client" type="static" valign="top" width="20" x="20" y="28" />
<control halign="left" height="8" name="LB_Job" title="Job Name" type="static" valign="top" width="12" x="28" y="48" />
<control halign="right" height="18" name="LB_Type" title="Type of Display" type="static" valign="top" width="26" x="14" y="64" />
<control height="14" name="BT_CreateFolder" title="Create Folder" type="button" width="56" x="123" y="231" />
<control height="14" name="BT_Cancel" title="Cancel" type="button" width="56" x="187" y="231" />
<control height="10" name="CHB_FloorSc" title="Floor Display Scene" type="check" width="85" x="92" y="98" />
<control height="10" name="CHB_CounterSc" title="Counter Display Scene" type="check" width="85" x="92" y="112" />
<control height="10" name="CHB_SuperMarketSc" title="Super market Shelves Scene" type="check" width="103" x="92" y="126" />
<control height="10" name="CHB_PharmacySc" title="Pharmacy Shelves Scene" type="check" width="103" x="92" y="140" />
<control height="65" name="GB_Scenes" title="Render Scenes" type="group" width="196" x="47" y="90" />
<control height="51" name="GB_Textures" title="Textures" type="group" width="196" x="47" y="166" />
<control height="10" name="CHB_ColorWhite" title="White Texture" type="check" width="85" x="118" y="174" />
<control height="10" name="CHB_CorrugatedStrip" title="Corrugated Strip" type="check" width="85" x="118" y="188" />
<control height="10" name="CHB_Cardboard" title="Cardboard" type="check" width="85" x="118" y="202" />
<control halign="center" height="8" name="ST_Header" title="Create Design Folder" type="static" valign="top" width="75" x="102" y="8" />
<control enable="no" height="10" name="CHB_FloorScOpacity" title="Opacity" type="check" visible="no" width="37" x="190" y="98" />
<control enable="no" height="10" name="CHB_CounterScOpacity" title="Opacity" type="check" visible="no" width="37" x="190" y="112" />
<control checked="yes" height="10" name="CHB_Suffix" title="Suffix (CD/FD)" type="check" width="54" x="186" y="68" />
</dialog>
</resource>
<resource name="Warning_Text_Fields" type="dialog">
<dialog fontsize="14" height="52" lang="english" standard_buttons="ok" title="Incomplete Info" width="163">
<control halign="center" height="8" name="ST_Warning" title="Please Complete the Client and Job Fields" type="static" valign="center" width="130" x="17" y="12" />
</dialog>
</resource>
</resources>
==SCRIPT RESOURCES
<resources>
<resource name="New Design Folder" type="dialog">
<dialog fontsize="10" height="256" lang="english" title="New Design Folder" width="280">
<control halign="center" height="12" name="TB_Client" type="edit" width="195" x="47" y="26" />
<control halign="center" height="12" name="TB_Job" type="edit" width="195" x="47" y="46" />
<control height="40" name="CB_Type" type="combo" width="129" x="47" y="66">
<contents>
<item text="Floor Display (Cardboard)" />
<item text="Counter/Small Factor Display" />
<item text="Floor Display (Other Material)" />
</contents>
</control>
<control halign="left" height="8" name="LB_Client" title="Client" type="static" valign="top" width="20" x="20" y="28" />
<control halign="left" height="8" name="LB_Job" title="Job Name" type="static" valign="top" width="12" x="28" y="48" />
<control halign="right" height="18" name="LB_Type" title="Type of Display" type="static" valign="top" width="26" x="14" y="64" />
<control height="14" name="BT_CreateFolder" title="Create Folder" type="button" width="56" x="123" y="231" />
<control height="14" name="BT_Cancel" title="Cancel" type="button" width="56" x="187" y="231" />
<control height="10" name="CHB_FloorSc" title="Floor Display Scene" type="check" width="85" x="92" y="98" />
<control height="10" name="CHB_CounterSc" title="Counter Display Scene" type="check" width="85" x="92" y="112" />
<control height="10" name="CHB_SuperMarketSc" title="Super market Shelves Scene" type="check" width="103" x="92" y="126" />
<control height="10" name="CHB_PharmacySc" title="Pharmacy Shelves Scene" type="check" width="103" x="92" y="140" />
<control height="65" name="GB_Scenes" title="Render Scenes" type="group" width="196" x="47" y="90" />
<control height="51" name="GB_Textures" title="Textures" type="group" width="196" x="47" y="166" />
<control height="10" name="CHB_ColorWhite" title="White Texture" type="check" width="85" x="118" y="174" />
<control height="10" name="CHB_CorrugatedStrip" title="Corrugated Strip" type="check" width="85" x="118" y="188" />
<control height="10" name="CHB_Cardboard" title="Cardboard" type="check" width="85" x="118" y="202" />
<control halign="center" height="8" name="ST_Header" title="Create Design Folder" type="static" valign="top" width="75" x="102" y="8" />
<control enable="no" height="10" name="CHB_FloorScOpacity" title="Opacity" type="check" visible="no" width="37" x="190" y="98" />
<control enable="no" height="10" name="CHB_CounterScOpacity" title="Opacity" type="check" visible="no" width="37" x="190" y="112" />
<control checked="yes" height="10" name="CHB_Suffix" title="Suffix (CD/FD)" type="check" width="54" x="186" y="68" />
</dialog>
</resource>
<resource name="Warning_Text_Fields" type="dialog">
<dialog fontsize="14" height="52" lang="english" standard_buttons="ok" title="Incomplete Info" width="163">
<control halign="center" height="8" name="ST_Warning" title="Please Complete the Client and Job Fields" type="static" valign="center" width="130" x="17" y="12" />
</dialog>
</resource>
</resources>
==SCRIPT RESOURCES
<resources>
<resource name="New Design Folder" type="dialog">
<dialog fontsize="10" height="256" lang="english" title="New Design Folder" width="280">
<control halign="center" height="12" name="TB_Client" type="edit" width="195" x="47" y="26" />
<control halign="center" height="12" name="TB_Job" type="edit" width="195" x="47" y="46" />
<control height="40" name="CB_Type" type="combo" width="129" x="47" y="66">
<contents>
<item text="Floor Display (Cardboard)" />
<item text="Counter/Small Factor Display" />
<item text="Floor Display (Other Material)" />
</contents>
</control>
<control halign="left" height="8" name="LB_Client" title="Client" type="static" valign="top" width="20" x="20" y="28" />
<control halign="left" height="8" name="LB_Job" title="Job Name" type="static" valign="top" width="12" x="28" y="48" />
<control halign="right" height="18" name="LB_Type" title="Type of Display" type="static" valign="top" width="26" x="14" y="64" />
<control height="14" name="BT_CreateFolder" title="Create Folder" type="button" width="56" x="123" y="231" />
<control height="14" name="BT_Cancel" title="Cancel" type="button" width="56" x="187" y="231" />
<control height="10" name="CHB_FloorSc" title="Floor Display Scene" type="check" width="85" x="92" y="98" />
<control height="10" name="CHB_CounterSc" title="Counter Display Scene" type="check" width="85" x="92" y="112" />
<control height="10" name="CHB_SuperMarketSc" title="Super market Shelves Scene" type="check" width="103" x="92" y="126" />
<control height="10" name="CHB_PharmacySc" title="Pharmacy Shelves Scene" type="check" width="103" x="92" y="140" />
<control height="65" name="GB_Scenes" title="Render Scenes" type="group" width="196" x="47" y="90" />
<control height="51" name="GB_Textures" title="Textures" type="group" width="196" x="47" y="166" />
<control height="10" name="CHB_ColorWhite" title="White Texture" type="check" width="85" x="118" y="174" />
<control height="10" name="CHB_CorrugatedStrip" title="Corrugated Strip" type="check" width="85" x="118" y="188" />
<control height="10" name="CHB_Cardboard" title="Cardboard" type="check" width="85" x="118" y="202" />
<control halign="center" height="8" name="ST_Header" title="Create Design Folder" type="static" valign="top" width="75" x="102" y="8" />
<control enable="no" height="10" name="CHB_FloorScOpacity" title="Opacity" type="check" visible="no" width="37" x="190" y="98" />
<control enable="no" height="10" name="CHB_CounterScOpacity" title="Opacity" type="check" visible="no" width="37" x="190" y="112" />
<control checked="yes" height="10" name="CHB_Suffix" title="Suffix (CD/FD)" type="check" width="54" x="186" y="68" />
</dialog>
</resource>
<resource name="Warning_Text_Fields" type="dialog">
<dialog fontsize="14" height="52" lang="english" standard_buttons="ok" title="Incomplete Info" width="163">
<control halign="center" height="8" name="ST_Warning" title="Please Complete the Client and Job Fields" type="static" valign="center" width="130" x="17" y="12" />
</dialog>
</resource>
</resources>
Leo
May 29, 2023, 3:48pm
6
That has multiple ==SCRIPT RESOURCES <resources> ... </resources>
sections, which looks wrong.
Assuming it works without the resources, that's probably where the problem is.
While in Customize mode, you can drag a button to a folder to create a .dcf file containing it (which can then be run by double-clicking the .dcf file, or dragged back to a toolbar). That's the easiest way to turn a button into a file, and doesn't require any manual editing.
I messed the whole copy paste thing.
Thank you Leo that really helped and it worked flawlessly with the .dcf file which I managed to call with dopusrt
I guess I had a brain fart to not think of that.
Thank you both for your help.
1 Like