完成后的图示,选择需要模拟的lighttools后,直接进行运行,点击开始模拟,即可逐个模拟完成

lighttools 连接代码:

 1 Private m_ltServer As LTAPI
2
3
4
5 Public Function getLTAPIServer() As LTAPI
6 If m_ltServer Is Nothing Then
7 Dim lt As IUnknown
8 Dim ltLoc As Locator
9 Dim cmd As String
10 Set ltLoc = CreateObject("LTLocator.Locator")
11 ' to get a LightTools Server pointer, you need to know
12 ' the calling server process ID
13 ' if it is passed to this application via command line
14 ' in a shape of "-LTPID1234" (AddIn standard)
15 ' (1234 being hypothetical LightTools Process ID), do this
16 cmd = Command ' get command line
17 ' if command line is in the form of "-LTPID1234" you can
18 ' directly pass it to Locator
19 Set lt = ltLoc.GetLTAPIFromString(cmd)
20 'if the client code knows LT PID somehow, it could use the
21 ' GetLTAPI(pidNumber) interface
22 Set m_ltServer = lt
23 Set ltLoc = Nothing
24 End If
25
26 Set getLTAPIServer = m_ltServer
27 End Function
28 Sub test2()
29 Dim lt As LTAPI
30
31 Set lt = getLTAPIServer()
32 lt.Message ("Correct way of connecting to LightTools")
33 End Sub

窗体代码:

Option Explicit
Dim i As Integer
Dim j As Integer
Dim exist As Boolean Private Sub cmdAddAll_Click()
'添加所有对象至Listbox
On Error Resume Next For i = 0 To filList.ListCount - 1
exist = False
' 排除重复对象
For j = 0 To lstFileOnClosed.ListCount - 1
If lstFileOnClosed.List(j) = DirList.Path & "\" & filList.List(i) Then
exist = True
Exit For
End If
Next j
If exist = False Then
lstFileOnClosed.AddItem DirList.Path & "\" & filList.List(i)
End If Next i
End Sub Private Sub cmdAddSelect_Click()
'添加选择的对象至Listbox
On Error Resume Next
For i = 0 To filList.ListCount - 1
exist = False
' 排除重复对象
If filList.Selected(i) = True Then '判断对象是否被选中 For j = 0 To lstFileOnClosed.ListCount - 1
If lstFileOnClosed.List(j) = DirList.Path & "\" & filList.List(i) Then
exist = True
Exit For
End If
Next j If exist = False Then lstFileOnClosed.AddItem DirList.Path & "\" & filList.List(i)
End If End If
Next i
End Sub Private Sub cmdRemoveAll_Click()
'从listbox中移出所有的对象
lstFileOnClosed.Clear
End Sub Private Sub cmdRemoveSelect_Click()
'从listbox中移出选择的对象
On Error Resume Next
For i = 0 To lstFileOnClosed.ListCount - 1
If lstFileOnClosed.Selected(i) = True Then
lstFileOnClosed.RemoveItem (i)
End If
Next i
End Sub Private Sub Command1_Click()
'Debug.Print lstFileOnClosed.List(0)
'Debug.Print DirList.Path Dim i As Integer
Dim sumok As Integer
Dim sumng As Integer
Dim datebegin As Date
Dim dateend As Date
Dim usetime As Date
sumok = 0
sumng = 0 App.OleRequestPendingMsgText = "模拟中,请等待!" '设置程序等待msg
App.OleServerBusyTimeout = 36000000 '设置程序等待时间单位ms,目前未10h
'排除未选择模拟文件的情况
If batchmode.lstFileOnClosed.ListCount = 0 Then
batchmode.Text1.Text = "请选择要模拟的文件" & vbCrLf
Exit Sub
End If
batchmode.Text1.Text = "模拟过程中请不要点击此窗体" & vbCrLf
For i = 0 To batchmode.lstFileOnClosed.ListCount - 1
Dim lt As New LTAPI
Dim FName As String
Dim status As String
datebegin = Now
FName = batchmode.lstFileOnClosed.List(i)
lt.SetOption "ShowDialogs", 0
lt.SetOption "ShowFileDialogBox", 0
lt.cmd "\VConsole" 'Note that this is case sensitive!
lt.cmd "Open " & lt.Str(FName)
lt.SetOption "ShowDialogs", 1
lt.SetOption "ShowFileDialogBox", 1
lt.cmd "\V3D"
status = lt.cmd("BeginAllSimulations")
dateend = Now
usetime = dateend - datebegin
If status = 0 Then
batchmode.Text1.Text = batchmode.Text1.Text + " sim OK 用时" & usetime & " " & FName & vbCrLf
sumok = sumok + 1
Else
batchmode.Text1.Text = batchmode.Text1.Text + " sim NG;错误代码:" & status & "用时" & usetime & " " & FName & vbCrLf
sumng = sumng + 1
End If
lt.cmd "save"
lt.cmd "close" Next i
batchmode.Text1.Text = batchmode.Text1.Text + "所有模拟已经完成,其中" & sumok & "个模拟OK;其中" & sumng & "个模拟NG。" End Sub Private Sub DirList_Change()
' 更新文件列表框,使它与目录列表框保持同步。
filList.Path = DirList.Path
End Sub Private Sub DirList_LostFocus()
DirList.Path = DirList.List(DirList.ListIndex)
End Sub Private Sub DrvList_Change()
On Error GoTo DriveHandler
DirList.Path = DrvList.Drive
Exit Sub DriveHandler:
DrvList.Drive = DirList.Path
Exit Sub
End Sub Private Sub Form_Load()
'初始化FileListbox的格式及Drivelistbox的驱动盘
filList.Pattern = "*.lts"
DrvList.Drive = App.Path
batchmode.Text1.Text = "欢迎使用此插件!" & vbCrLf
End Sub

然后生成为EXE格式,就可以进行使用。

lighttools batchmode 批处理vb程序代码的更多相关文章

  1. VB程序架构分析

    在08年,我曾经写过VB程序.前面也将该VB程序的架构剥离出来并发出来共享了(具体见http://www.cnblogs.com/lzhdim/archive/2012/03/08/2385028.h ...

  2. 反编译工具 使用.NET JustDecompile来反编译你的程序代码

    原文地址:http://www.it165.net/pro/html/201310/7383.html 前言 在项目的进行中有时会碰到需要去了解由第三方所开发的程序代码或者因为年久已经遗失原始码的程序 ...

  3. OD学习笔记10:一个VB程序的加密和解密思路

    前边,我们的例子中既有VC++开发的程序,也有Delphi开发的程序,今天我们给大家分析一个VB程序的加密和解密思路. Virtual BASIC是由早期DOS时代的BASIC语言发展而来的可视化编程 ...

  4. 学习笔记第六课 VB程序

    VB程序的特殊地方在于: 前几课学的破解方法,诸如设置API断点,修改关键CALL的返回值,MESSAGEBOX断点等,这些对于VB程序都是无效的. 这节课是设置VB的API断点,绕过报错弹窗来破解. ...

  5. 如何:在 DHTML 代码和客户端应用程序代码之间实现双向通信

    https://msdn.microsoft.com/zh-cn/library/a0746166 可以使用 WebBrowser 控件向 Windows 窗体客户端应用程序添加现有的动态 HTML ...

  6. 使用.NET JustDecompile来反编译你的程序代码

    前言 在项目的进行中有时会碰到需要去了解由第三方所开发的程序代码或者因为年久已经遗失原始码的程序,由于因为是别人写的所以我们并没有原始码可以直接阅读,碰到这种情况我们就需要去反编译这些程序及 DLL ...

  7. VB程序逆向反汇编常见的函数(修改版)

    VB程序逆向常用的函数 1) 数据类型转换: a) __vbaI2Str    将一个字符串转为8 位(1个字节)的数值形式(范围在 0 至 255 之间) 或2 个字节的数值形式(范围在 -32,7 ...

  8. 开发指南~小程序代码构成~JSON配置

    2.1 JSON 配置 JSON 是一种数据格式,并不是编程语言,在小程序中,JSON扮演的静态配置的角色. 2.1.1 一个例子 ​先看一个例子,打开开发工具的编辑器,在根目录下可以找到 app.j ...

  9. VB程序去nag

    VB程序去nag 我遇到的vb的nag情况是程序一开始就跳出一个nag,汇编代码如下 push AfKayAs_.004067D4 call <jmp.&MSVBVM50.#100> ...

  10. C# 读取Word文本框中的文本、图片和表格(附VB.NET代码)

    [概述] Word中可插入文本框,在文本框中可添加文本.图片.表格等内容.本篇文章通过C#程序代码介绍如何来读取文本框中的文本.图片和表格等内容.附VB.NET代码,有需要可作参考. [程序环境] 程 ...

随机推荐

  1. 快速入门 DeepSeek-R1 大模型

    国内最新的神级人工智能模型已经正式发布,没错,它就是备受瞩目的DeepSeek-R1大模型.今天,我们将对DeepSeek进行一个简单的了解,并探索如何快速使用和部署这个强大的工具.值得一提的是,De ...

  2. 2025苹果春季发布会前瞻:新品迭出,Apple Intelligence国行版即将上线!

    随着2025年的到来,苹果公司的春季发布会也渐行渐近.作为科技行业的领军企业,苹果每一次的新品发布都备受瞩目.本次春季发布会,苹果预计会带来一系列令人期待的新品,同时,国行Mac用户也将迎来一个重大更 ...

  3. Docker启动Nginx

    Docker启动Nginx 搜索镜像 docker search nginx 拉取镜像 这里拉取的官方镜像 docker pull nginx 创建挂载目录 将nginx的文件都放在/opt/ngin ...

  4. GridControl 给选中的行添加边框显示

    实现方式,通过自定义 RowControl 的样式实现. 参考:https://supportcenter.devexpress.com/ticket/list?searchString=RowCel ...

  5. 大模型工具KTransformer的安装

    技术背景 前面写过几篇关于DeepSeek的文章,里面包含了通过Ollama来加载模型,以及通过llama.cpp来量化模型(实际上Llama.cpp也可以用来加载模型,功能类似于Ollama).这里 ...

  6. Docker安装与镜像加速器的配置

    Docker简介 百科说:Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的Linux机器上,也可以实现虚拟化,容器是完全使用沙箱机 ...

  7. luogu-P3262题解

    简要题意 有一棵不超过十层的满二叉树,需要对每个节点进行染色.每个叶子节点会对其颜色相同的祖先节点产生贡献且黑白贡献不同.求最大贡献. 题解 首先我会暴力!我如果直接暴力枚举每个节点的颜色,复杂度就是 ...

  8. 基于ThreeJs的大屏3D地图(二)——气泡图、渐变柱体与热力图

    前提 上一篇文章中我们完成了地图区块模型的渲染,在此基础之上本篇来讲解气泡图.3D柱形图以及3D热力图的实现方式. 首先,为了更好的关注点分离及与地图渲染模块的解耦,我们可以把所有类型的可视化元素抽象 ...

  9. 分享4款.NET开源、免费、实用的商城系统

    前言 今天大姚给大家分享4款.NET开源.免费.实用的商城系统,希望可以帮助到有商城系统开发需求的同学. nopCommerce nopCommerce是一个.NET开源功能丰富.免费.灵活且可定制的 ...

  10. NCS开发学习笔记-基础篇-前言

    nRF5 SDK 与 nRF Connect SDK 目前Nordic有2套并存的SDK:老的nRF5 SDK和新的nRF Connect SDK(简称NCS),两套SDK相互独立. nRF5 SDK ...