函数

上一篇 / 下一篇  2007-09-14 11:04:11

再贴一个,这是我自己写的.....
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

'向目标计算机发送消息
'例如:sendmsg "rsgui","test complete!"
Declare Function SendMsg(computer as string,txt as string)
Function SendMsg(computer as string,txt as string)
dim operate as string
operate="/c net send " & computer & " " & txt
shellexecute 0,"open","cmd.exe",operate,"c:\",0
End Function
 
 
 
 
 
'得到控件的属性,并保留到文件中
function SaveAllPropertyValues (ObjectRec As String, Filename As String)
Dim Result As Integer
Dim Properties() As String
Dim Value As Variant
Dim n As Integer
Open Filename For Output As #1
Result = SQAGetPropertyNames(ObjectRec, Properties)
If Result <> sqaSuccess Then
SQALogMessage sqaWarning, "Unable to capture """ + ObjectRec + """ properties", "Error" + Str$(Result) + ": " + Error$(Result)
Exit function
End If
For n = 0 to UBound(Properties)
Result = SQAGetPropertyAsString(ObjectRec, Properties(n), Value)
If Result = sqaSuccess Then
Write #1, Properties(n), Value
End If
    Next n
    Close #1
SQALogMessage sqaNone, "Properties of " + ObjectRec + " saved in " + Filename, ""
End function
 
 
 
 
 
 
 
我不觉得,楼主 所写的 获得控件属性值 ,并写入文件 有什么太大用处,就我个人使用而言, 我觉得,大家 多用用
SQAgetPropertyValue 和 SQAWaitforPropertyValue ,SQAlogMessage以及 Msgbox这几个常用函数就构了, 第一个函数,我们常用来获取一些对象 某个属性值,用它进行判断,或者于预期值进行比较.

我们不需要得到控件的所有属性值,事实上,某些没有太大的用处,所以用第一个函数,就构了.

第二个函数,主要用来判断某个对象(控件)存不存在,或者说在指定时间内存在时,作者希望 作些什么其它操作.

第三个函数,常用来,将作者认为 有必要的信息,写进 结果日志里.(当一个脚本很长的时候,通常可以判断脚本执行到何处)

最后一个函数, 常用来调试脚本,当对脚本进行参数化后,希望运行时得到某些参数值的时候,经常用到.

 
 
 
 
 

TAG:

 

评分:0

我来说两句

日历

« 2024-05-01  
   1234
567891011
12131415161718
19202122232425
262728293031 

我的存档

数据统计

  • 访问量: 10155
  • 日志数: 28
  • 图片数: 1
  • 建立时间: 2007-09-11
  • 更新时间: 2007-09-14

RSS订阅

Open Toolbar