51Testing软件测试论坛

标题: 再次帮我修改脚本 [打印本页]

作者: lovoo    时间: 2007-2-8 16:15
标题: 再次帮我修改脚本
配置文件pinyin生成,生成一个pinyin.ini文件,包含所有拼音的一个列表,在附件里。

public function CmdWrite(commandline)
{
        static handle;
        static testfile1;
        static testfile2;
        static old;
        static new;
        static i;
        static line;
       
        if(invoke_application("C:\\test\\pinyin.ini", SW_SHOWMINIMIZED) != 0)
        {
                handle = file_open("C:\\test\\pinyin.ini", FO_MODE_APPEND);
                type("[PinYin]");
                file_close(handle);
                file_open("C:\\test\\test.bak", FO_MODE_APPEND);
                file_printf("C:\\test\\test.bak", "%s" & tolower(line)"\n");
        }       
       
        testfile1 = "C:\\test\\pinyin.ini";
        testfile2 = "C:\\test\\pinyin.ini" & "test.bak";
        old = file_open(testfile1, FO_MODE_READ);
        new = file_open(testfile2, FO_MODE_APPEND);
       
        i=0;
        while(file_getline(old, line) == 0)
        {
            i++;
            file_printf(new, "%s" & tolower(line)"\n",i);
        }

        file_close(old);
        file_close(new);
}

public pinyin[] =
{
        "a ai an ang ao ba bai ban bang bao bei ben beng bi bian biao bie bin bing bo bu ca cai can cang cao ce cen ceng cha chai chan chang chao",
        "che chen cheng chi chong chou chu chua chuai chuan chuang chui chun chuo ci cong cou cu cuan cui cun cuo da dai dan dang dao de dei den",
        "gei gen geng gong gou gu gua guai guan guang gui gun guo ha hai han hang hao he hei hen heng hng hong hou hu hua huai huan huang hui hun",
        "huo ji jia jian jiang jiao jie jin jing jiong jiu ju juan jue jun ka kai kan kang kao ke kei ken keng kong kou ku kua kuai kuan kuang kui",
        "kun kuo la lai lan lang lao le lei leng li lia lian liang liao lie lin ling liu lo long lou lu luan lun luo lv lve m ma mai man mang mao me",
        "mei men meng mi mian miao mie min ming miu mo mou mu n na nai nan nang nao ne nei nen neng ng ni nian niang niao nie nin ning niu nong",
        "nou nu nuan nuo nv nve o ou pa pai pan pang pao pei pen peng pi pian piao pie pin ping po pou pu qi qia qian qiang qiao qie",
        "qin qing qiong qiu qu quan que qun ran rang rao re ren reng ri rong rou ru ruan rui run ruo sa sai san sang sao se sen seng sha shai shan",
        "shang shao she shei shen sheng shi shou shu shua shuai shuan shuang shui shun shuo si song sou su suan sui sun suo ta tai tan tang tao te",
        "teng ti tian tiao tie ting tong tou tu tuan tui tun tuo wa wai wan wang wei wen weng wo wu xi xia xian xiang xiao xie xin xing xiong xiu",
        "xu xuan xue xun ya yan yang yao ye yi yin ying yo yong you yu yuan yue yun za zai zan zang zao ze zei zen zeng zha zhai zhan zhang zhao",
        "zhe zhei zhen zheng zhi zhong zhou zhu zhua zhuai zhuan zhuang zhui zhun zhuo zi zong zou zu zuan zui zun zuo"
};

count = 0;
for(i = 0; i <= 11; i++)
{
        start = 1;
        finish = pinyin & "" & start;
       
        if(finish == 0)
                break;
        else
        {        count = count+1;
                paramcount = substr(pinyin, start, finish - start);
                start = finish +1;
               
                CmdWrite(count & "=" & paramcount);       
        }
        if(finish == length(pinyin))
                break;
        if(start <= length(pinyin))
        {
                finish = length(pinyin) + 1;
                count = count + 1;
                paramcount = substr(name, start, finish - start);
               
                CmdWrite(count & "=" & paramcount);
        }       
               
}
作者: dionysus    时间: 2007-2-8 17:06
楼主要说明什么问题?重新编辑一下帖子吧
作者: wonew1228    时间: 2007-2-8 17:42
你要干什么呀?看了半天也不知道你要干什么?写出你有什么问题?要别人帮你什么?
作者: kolecat    时间: 2007-2-9 18:02
handle = file_open("C:\\test\\pinyin.ini", FO_MODE_APPEND);

这个handle 返回的是一个bool值吧?

file_close(handle);
这样用handle是不是错的?




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2