huangoujian 发表于 2007-1-15 16:42:37

极简单的脚本总报错误,请高手帮忙

Const NOTEPAD_CAPTION = "Caption=无标题–记事本"
Sub Main
    Dim Result As Integer

    'Initially Recorded: 2007-1-1514:55:17
    'Script Name: simpleTest1
   
    'Window SetContext, "Class=Shell_TrayWnd", ""
    'Toolbar Click, "Text=Quick Launch;\;ItemText=ciq2000", "Coords=12,9"
    startapplication "notepad"
   
   Window SetContext, NOTEPAD_CAPTION, ""
    InputKeys "123"
    MenuSelect "格式(O)->字体(F)..."
   
    Window SetContext, "Caption=字体", ""
    ComboListBox Click, "Label=字体(F):", "Text=宋体"
    ComboListBox Click, "Label=字形(Y):", "Text=粗体"
    PushButton Click, "Text=确定"

End Sub

注释:这段代码是在已回放成功的脚本中修改的,报错点总是在{MenuSelect "格式(O)->字体(F)..."}这句话,但是这话我并没有个修改过。想不明白了,请高手们帮忙指点下

[ 本帖最后由 huangoujian 于 2007-1-15 16:48 编辑 ]

Spark.lee 发表于 2007-1-15 17:00:56

你录制了 没有修改吗》?

Const NOTEPAD_CAPTION = "Caption=无标题–记事本"

这个是什么啊 !!!!
Sub Main
    Dim Result As Integer

    'Initially Recorded: 2007-1-1516:49:01
    'Script Name: 111
    StartApplication "C:\WINDOWS\system32\notepad.exe"
   
    Window SetContext, "Caption=无标题 - 记事本", ""
    EditBox Click, "ObjectIndex=1", "Coords=43,39"
    InputKeys "123"
    EditBox Left_Drag, "ObjectIndex=1", "Coords=39,9,-25,8"
    MenuSelect "格式(O)->字体(F)..."
   
    Window SetContext, "Caption=字体", ""
    ComboListBox Click, "Label=字体(F):", "Text=宋体"
    ComboListBox Click, "Label=字形(Y):", "Text=粗体"
    PushButton Click, "Text=确定"
   
    Window SetContext, "Caption=无标题 - 记事本", ""
    Window CloseWin, "", ""
   
    Window SetContext, "Caption=记事本", ""
    PushButton Click, "Text=是(Y)"
   
    Window SetContext, "Caption=另存为", ""
    ComboEditBox Left_Drag, "ObjectIndex=3", "Coords=7,5,-33,5"
    InputKeys "s"
    PushButton Click, "Text=保存(S)"

End Sub

[ 本帖最后由 Spark.lee 于 2007-1-15 17:08 编辑 ]

huangoujian 发表于 2007-1-15 17:13:21

to Spark.lee (子木清风) :
1.我是录制了才改的,并且是录制后回放成功,再进行修改的。
2.Const NOTEPAD_CAPTION = "Caption=无标题–记事本",这句话是定义全局变量,是记事本的标题名称。

huangoujian 发表于 2007-1-16 09:26:55

问题已经解决了,是因为 "Caption=无标题–记事本"这个字符串的中划线与回放时弹出记事本窗口的标题的中划线不匹配。sdlkfj3

shuyanping1004 发表于 2010-5-6 11:21:50

录制的下划线回放时却没有(请高手帮忙,谢谢!)

录制脚本为W_012-(W_013+W_014+W_015+W_016)-W_018-W_019
回放时却为W 012-(W 013+W 014+W 015+W 016)-W 018-W 019

村上舞!舞!舞 发表于 2010-5-11 16:00:13

什么意思?是指输入动作?
你试试InputChars"W_012-(W_013+W_014+W_015+W_016)-W_018-W_019"
页: [1]
查看完整版本: 极简单的脚本总报错误,请高手帮忙