iLogic make a excel list , check out write iProp, checkin and next read seznam check out write iProp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
What I need,
I have Vault Basic, which doesn't allow for lifecycles. I'm trying to replace it with iLlogic. Which is to write the status released, save, checkin and checkout for the user "Released project" to the documentation from the release list. It writes the iprop only so that when the user sets the "Released project" to unchanged it will be returned back. We want the "Released project" user to checkin and make it obvious at a glance that the documentation has been released and is undergoing change control.
Now i have two ilogic. The first one creates a list of checkout assemblies and all referenced parts. It writes the status released and checkin the assembly and parts. For checkin I using:
ThisApplication.CommandManager.ControlDefinitions.Item("VaultCheckinTop").Execute2(False) System.Windows.Forms.SendKeys.SendWait("" & Chr(9) & vbCrLf)
This works well when called at the end of the code. Not in the second macro, which read through the list in excel to release the file and write the iProp.
This is a sub modified from @JhoelForshav I think that in the mVltCon object it should be possible to checkout the file, and write iprop. I blindly tried the objects it contains, but without success.
now I have this. It not work god 🙂 the problem is the line
System.Windows.Forms.SendKeys.SendWait(vbCrLf)
when any part is open and iLogic is started, which loads excel and opens individual files and performs individual steps the send keys command is started when the document is closed again. I cannot get control over this.
Sub Zarad(fileName, oRow) Dim oDoc As Document ' objekt dokumentu Dim oWF As String = mVltCon.WorkingFoldersManager.GetWorkingFolder("$/").FullPath If fileName.ToLower().Contains(oWF.ToLower()) Then oVaultFileName = fileName.Replace(oWF, "$/").Replace("\", "/") Else oCell = xlWs.Cells(oRow, 7) : oCell.Value = "Nenuložený/špatná cesta" 'zápis do určené buňky Trace.WriteLine("<Debug> 'Neuložený/špatná cesta ") ' Debugovací výstup do Trace Konzole Exit Sub End If Dim oWSmgr As Autodesk.Connectivity.WebServicesTools.WebServiceManager = mVltCon.WebServiceManager Dim oFile As ACW.File = oWSmgr.DocumentService.FindLatestFilesByPaths(New String() {oVaultFileName }).FirstOrDefault() If oFile.Id = -1 Then oCell = xlWs.Cells(oRow, 7) : oCell.Value = "Není ve Vault" 'zápis do určené buňky Trace.WriteLine("<Debug> 'File Not in vault 2 ") ' Debugovací výstup do Trace Konzole Exit Sub End If Dim oFileIteration As New VDF.Vault.Currency.Entities.FileIteration(mVltCon, oFile) Dim oProps As PropertyDefinitionDictionary = mVltCon.PropertyManager.GetPropertyDefinitions(VDF.Vault.Currency.Entities.EntityClassIds.Files, Nothing, PropertyDefinitionFilter.IncludeAll) Dim oVaultStatus As PropertyDefinition = oProps(PropertyDefinitionIds.Client.VaultStatus) Dim status As EntityStatusImageInfo = TryCast(mVltCon.PropertyManager.GetPropertyValue(oFileIteration, oVaultStatus, Nothing), EntityStatusImageInfo) Dim oCheckoutState As EntityStatus.CheckoutStateEnum = status.Status.CheckoutState ' Dim wsFiels() As ACW.File = mVltCon.WebServiceManager.DocumentService.FindLatestFilesByPaths(VaultPaths) ' Dim mFileIt As VDF.Vault.Currency.Entities.FileIteration = New VDF.Vault.Currency.Entities.FileIteration(conn, wsFiels(0)) Dim vydal As String = oFileIteration.CreateUserName If oCheckoutState = EntityStatus.CheckoutStateEnum.NotCheckedOut Trace.WriteLine("<Debug> 'nevydáno " + CStr(fileName)) ' Debugovací výstup do Trace Konzole Try oDoc = ThisApplication.Documents.Open(fileName, True) Catch oCell = xlWs.Cells(oRow, 8) : oCell.Value = "nepodařilo se otevřít soubor" 'nastaví zápis na určenou buňku 'nepodařilo se otevřít soubor End Try Trace.WriteLine("<Debug> před release Kalan " + CStr(fileName)) ' Debugovací výstup do Trace Konzole oCtrdef = ThisApplication.CommandManager.ControlDefinitions.Item("VaultGetLatest") If Not oCtrdef Is Nothing Then 'Kontrola zda definovany ctrdef vubec existuje oCtrdef.Execute2(False) System.Windows.Forms.SendKeys.SendWait(vbCrLf) ThisApplication.CommandManager.StopActiveCommand ' přeruší pokračující příkaz, pokud je stále v běhu Trace.WriteLine("<Debug> VaultGetLatest OK " + CStr(fileName)) ' Debugovací výstup do Trace Konzole Else Trace.WriteLine("<Debug> VaultGetLatest Neproveden " + CStr(fileName)) ' Debugovací výstup do Trace Konzole End If oCtrdef2 = ThisApplication.CommandManager.ControlDefinitions.Item("VaultCheckoutTop") ThisApplication.CommandManager.ControlDefinitions.Item("VaultCheckinTop").Execute2(False) System.Windows.Forms.SendKeys.SendWait("" & Chr(9) & vbCrLf) If Not oCtrdef2 Is Nothing Then oCtrdef2.Execute2(False) 'Kontrola zda definovany ctrdef vubec existuje Trace.WriteLine("<Debug> VaultCheckoutTop OK " + CStr(fileName)) ' Debugovací výstup do Trace Konzole ThisApplication.CommandManager.StopActiveCommand ' přeruší pokračující příkaz, pokud je stále v běhu oCell = xlWs.Cells(oRow, 7) : oCell.Value = "OK" 'nastaví zápis na určenou buňku Else oCell = xlWs.Cells(oRow, 7) : oCell.Value = "NE" 'nastaví zápis na určenou buňku Trace.WriteLine("<Debug> VaultCheckoutTop Neproveden " + CStr(fileName)) ' Debugovací výstup do Trace Konzole End If oDoc.Close ElseIf oCheckoutState = EntityStatus.CheckoutStateEnum.CheckedOutByOtherUser oCell = xlWs.Cells(oRow, 8) : oCell.Value = vydal 'nastaví zápis na určenou buňku Trace.WriteLine("<Debug> vydáno někomu jinému " + CStr(fileName)) ' Debugovací výstup do Trace Konzole ElseIf oCheckoutState = EntityStatus.CheckoutStateEnum.CheckedOutByCurrentUser oCell = xlWs.Cells(oRow, 8) : oCell.Value = "již byl proveden release Kalan" 'nastaví zápis na určenou buňku Trace.WriteLine("<Debug> již byl proveden release Kalan " + CStr(fileName)) ' Debugovací výstup do Trace Konzole Else Trace.WriteLine("<Debug> neznámý stav " + CStr(fileName)) ' Debugovací výstup do Trace Konzole End If End Sub