- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to automate updating of reports in a wire harness .idw file. I can call HSL:Cable:Generate_Report just fine but I can't find any documentation on how to automate the actual generation of reports, namely specifying file save names and config files to reference. Has anyone ever done this before?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I had a quick look in the API help and there is little information on the cable and harness API 2020.
You can use either send keys or mouse control to navigate through the dialogue box.
The below opens the "Add files to List" dialogue in Reports in the assembly environment. It will at least remove some tedious clicks and help navigate.
'https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.sendkeys.send?view=net-5.0 Sub Main Dim oCommandMgr As CommandManager oCommandMgr = ThisApplication.CommandManager Dim oControlDef As ControlDefinition oControlDef = oCommandMgr.ControlDefinitions.Item("HSL:Cable:Generate_Report") Call oControlDef.Execute Call wait(0.6) System.Windows.Forms.SendKeys.SendWait("{F10}") System.Windows.Forms.SendKeys.SendWait("{RIGHT 2}") System.Windows.Forms.SendKeys.SendWait("{ENTER}") System.Windows.Forms.SendKeys.SendWait("{ENTER}") System.Windows.Forms.SendKeys.SendWait(" ") End Sub 'https://stackoverflow.com/questions/15857893/wait-5-seconds-before-continuing-code-vb-net 'Timer to allow time for form to come into focus. Private Sub wait(ByVal seconds As Integer) For i As Integer = 0 To seconds * 100 System.Threading.Thread.Sleep(10) ' ThisApplication.DoEvents() Next End Sub
Or if this helped you, please, click (like)
Regards
Alan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm using VBA, not iLogic but I got it mostly running. I'm hung up on the line "System.Threading.Thread.Sleep (10)". Method or data member not found. Any advice?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
NM, I went with Application.Wait(1) and it's working fine. This is what I have so far:
Public Sub ReportUpdate()
Dim oCommandMgr As CommandManager
Set oCommandMgr = ThisApplication.CommandManager
Dim oControlDef As ControlDefinition
Set oControlDef = oCommandMgr.ControlDefinitions.Item("HSL:Cable:Edit_Nailboard_Sketch")
Call oControlDef.Execute
Set oControlDef = oCommandMgr.ControlDefinitions.Item("HSL:Cable:Generate_Report")
Call oControlDef.Execute
'Call wait(600)
Application.wait (1)
SendKeys ("{F10}")
SendKeys ("{RIGHT 2}")
SendKeys ("{ENTER}")
SendKeys ("{ENTER}")
SendKeys (" ")
SendKeys ("C:\Vault Local\Report Configuration Files\Connector with Color.cfg")
SendKeys ("{ENTER}")
End SubThis gets me to the point of picking the config file but I can't select the item in the list once I pick that config to change the name of the output file. No amount of keyboard basing seems to get it. Any ideas? @A.Acheson
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
No advise really other than to hopefully find the keyboard stroke to get to you destination. It took me a while to even find the alt/F10 stroke to access the tabs. If you are really stuck you could use mouse control but I would be wary of that where accessing files are concerned.
I just tested it there and to access what I assume is a vba list box use: TAB, RIGHT 3.
Or if this helped you, please, click (like)
Regards
Alan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report