- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everybody,
I've searched this forum to see if there already was a thread which answers my question, but alas...
For every project I start working on I first need to create folder structures in several places.
i.e.: Folders related to order number, serial number and photos/videos (all in different directories).
I've coded a little tool in VB.net which creates these folders in the right directories, but I would like it (if at all possible) to create these as well in the Vault.
Unfortunately, since this is the first tool I've ever written, I have absolutely no idea how to go about this.
Some further information:
We run Vault Workgroup 2019 at our company and everybody who should be using this tool has their own login (but if more simple, it would be just fine to use "generic credentials" for this tool to work).
Permissions are set in a way that they can add sub-folders to the required folder.
I hope you can guide me in the right direction on how to incorporate this.
Thanks in advance.
Below my code for the tool (creation of folder structures in Windows Explorer) and attached a visual of my tool.
Public Class Form5a
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
'Create project and media folders
'declare variables
Dim CN, CC, CL, CA, AN, PRN, SD As String
CN = Me.TextBox1.Text
CC = Me.ComboBox11.Text
CL = Me.TextBox2.Text
CA = Me.TextBox3.Text
AN = Me.TextBox4.Text
PRN = Me.TextBox5.Text
Dim substring As String
substring = Strings.Right(CC, 4)
SD = CL & " " & substring & " - " & CA
'compile path
If System.IO.Directory.Exists("K:\Master Data Management\02. External Projects\" & PRN) = True Then
MessageBox.Show("Project directory already exists!")
Else
System.IO.Directory.CreateDirectory("K:\Master Data Management\02. External Projects\" & PRN)
My.Computer.FileSystem.CopyDirectory("K:\Master Data Management\02. External Projects\00. Folder Templates\Folder Template - Order\00000 (Ordernr)", "K:\Master Data Management\02. External Projects\" & PRN)
MessageBox.Show("Project directory succesfully created!")
End If
If System.IO.Directory.Exists("\\Nas01\Mediadisk\External Projects\" & CN & "\" & SD & "\" & "Area" & " " & AN & "\") = True Then
MessageBox.Show("Media directory already exists!")
Else
System.IO.Directory.CreateDirectory("\\Nas01\Mediadisk\External Projects\" & CN & "\" & SD & "\" & "Area" & " " & AN & "\")
My.Computer.FileSystem.CopyDirectory("\\Nas01\Mediadisk\External Projects\00. Folder Templates\Naam bestemmingsrelatie\Plaats (landcode) - Adres\Area No", "\\Nas01\Mediadisk\External Projects\" & CN & "\" & SD & "\" & "Area" & " " & AN & "\")
MessageBox.Show("Media directory succesfully created!")
End If
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim CN, PRN As String
CN = Me.TextBox1.Text
PRN = Me.TextBox5.Text
Process.Start("explorer.exe", "K:\Project Data\02. External Projects\" & PRN)
Process.Start("explorer.exe", "\\Nas01\Mediadisk\External Projects\" & CN)
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim Foldername As String
Dim CN, CC, CL, CA, AN, SD As String
CN = Me.TextBox1.Text
CC = Me.ComboBox11.Text
CL = Me.TextBox2.Text
CA = Me.TextBox3.Text
AN = Me.TextBox4.Text
Dim substring As String
substring = Strings.Right(CC, 4)
SD = CL & " " & substring & " - " & CA
For Each Foldername In Me.ListBox2.Items
System.IO.Directory.CreateDirectory("K:\Master Data Management\01. Service Objects\" & Foldername)
System.IO.Directory.CreateDirectory("\\Nas01\Mediadisk\External Projects\" & CN & "\" & SD & "\" & "Area" & " " & AN & "\" & "02. Production" & "\" & Foldername)
System.IO.Directory.CreateDirectory("\\Nas01\Mediadisk\External Projects\" & CN & "\" & SD & "\" & "Area" & " " & AN & "\" & "04. Installation" & "\" & Foldername)
System.IO.Directory.CreateDirectory("\\Nas01\Mediadisk\External Projects\" & CN & "\" & SD & "\" & "Area" & " " & AN & "\" & "05. Aftersales" & "\" & Foldername)
My.Computer.FileSystem.CopyDirectory("K:\Master Data Management\01. Service Objects\00. Folder Template - Service Objects\[SON] - [SOD]-[(SOC)]", "K:\Master Data Management\01. Service Objects\" & Foldername)
Next
MessageBox.Show("Service Object directories succesfully created!")
End Sub
'Add
Private Sub Add(text As String)
Dim SON, SOD, PUC, SOC As String
SON = Me.NumericUpDown1.Value
SOD = Me.ComboBox1.Text
SOC = Me.NumericUpDown2.Value
'create PUC abbreviation
If SOD = "Box Handling" Then
PUC = "BH"
End If
If SOD = "Buffer System" Then
PUC = "BS"
End If
If SOD = "Cart Handling" Then
PUC = "CH"
End If
If SOD = "Filling System" Then
PUC = "FS"
End If
If SOD = "Information System" Then
PUC = "IS"
End If
If SOD = "Packing Line" Then
PUC = "PL"
End If
If SOD = "Palletising System" Then
PUC = "PS"
End If
If SOD = "Tipping System" Then
PUC = "TS"
End If
'merge to text string
text = SON & " " & "-" & " " & SOD & " " & "(" & PUC & SOC & ")"
ListBox2.Items.Add(text)
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Add(Text)
End Sub
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
Dim selected As String = Me.ListBox2.SelectedItem.ToString
If selected IsNot "" Then
Me.ListBox2.Items.Remove(selected)
End If
End Sub
Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
Me.ListBox2.Items.Clear()
End Sub
End Class
Solved! Go to Solution.