TC官方合作论坛

 找回密码
 立即注册
查看: 798|回复: 7
打印 上一主题 下一主题

[讨论] 请教下传参到问题 一个功能方法能不能返回2个值 有源码 麻烦看下

[复制链接]
跳转到指定楼层
楼主
发表于 2013-5-21 12:47:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上加入TC

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
源码如下:
我就是想只用一个功能方法让他返回账号和密码2个文本

  1. namespace gmail
  2. var Meter=0
  3. var accnumber,Passwd
  4. function getaccnumber(number)
  5. EachLine=array[]
  6. SpecificContent=array[]
  7. Rtc=file.readfileex("d://zhh.txt") //读取账号路径
  8. if(Rtc!="") // 内容不等于空白 才执行
  9. var linenumber
  10. str.split(Rtc,"\r\n",EachLine) // \r\n是换行符
  11. arraysp.size(EachLine,linenumber)
  12. if(EachLine[linenumber-1]=="") //避免最后一行出现空串 也写入内容
  13. linenumber=linenumber-1
  14. endif
  15. endif
  16. existence=file.exist("d://zhh1.txt")
  17. if(existence)
  18. help.sleep(500)
  19. else
  20. filehwnd=file.createfile("d://zhh1.txt","rw")
  21. endif
  22. for(i=Meter;i<=Meter;i++) //遍历账号文件
  23. var linenumber
  24. str.split(EachLine[i],",",SpecificContent)
  25. arraysp.size(SpecificContent,linenumber)
  26. for(j=0;j<1;j++)
  27. number=SpecificContent[j]
  28. PasswdID=SpecificContent[j+1]
  29. endfor
  30. endfor
  31. return (number)
  32. endfunction
  33. function getPasswd(PasswdID)
  34. EachLine=array[]
  35. SpecificContent=array[]
  36. Rtc=file.readfileex("d://zhh.txt") //读取账号路径
  37. if(Rtc!="") // 内容不等于空白 才执行
  38. var linenumber
  39. str.split(Rtc,"\r\n",EachLine) // \r\n是换行符
  40. arraysp.size(EachLine,linenumber)
  41. if(EachLine[linenumber-1]=="") //避免最后一行出现空串 也写入内容
  42. linenumber=linenumber-1
  43. endif
  44. endif
  45. existence=file.exist("d://zhh1.txt")
  46. if(existence)
  47. help.sleep(500)
  48. else
  49. filehwnd=file.createfile("d://zhh1.txt","rw")
  50. endif
  51. for(i=Meter;i<=Meter;i++) //遍历账号文件
  52. var linenumber
  53. str.split(EachLine[i],",",SpecificContent)
  54. arraysp.size(SpecificContent,linenumber)
  55. for(j=0;j<1;j++)
  56. number=SpecificContent[j]
  57. PasswdID=SpecificContent[j+1]
  58. endfor
  59. endfor
  60. return (PasswdID)
  61. endfunction
  62. function 当前()
  63. //这里添加你要执行的代码
  64. edit.settext("edit0",gmail.getaccnumber(""))
  65. edit.settext("edit2",gmail.getPasswd(""))
  66. endfunction
  67. function 退出()
  68. web.go("explorer0","https://mail.google.com/mail/u/0/?logout&hl=zh-CN&hlor")
  69. endfunction
  70. function go()
  71. web.go("explorer0","gmail.com")
  72. help.sleep(help.randto(100,150))
  73. web.htmlinput("explorer0",gmail.getaccnumber(accnumber),"name:Email")
  74. help.sleep(help.randto(100,200))
  75. web.htmlinput("explorer0",gmail.getPasswd(Passwd),"name:Passwd")
  76. help.sleep(500)
  77. web.htmlclick("explorer0","class:g-button g-button-submit")
  78. help.sleep(500)
  79. Meter=Meter+1
  80. endfunction
  81. function 改密码()
  82. web.go("explorer0","https://accounts.google.com/EditPasswd?hl=zh-CN")
  83. help.sleep(1100)
  84. web.htmlinput("explorer0",gmail.getPasswd(Passwd),"name:OldPasswd")
  85. help.sleep(400)
  86. web.htmlinput("explorer0","shangye2013","name:Passwd")
  87. help.sleep(400)
  88. web.htmlinput("explorer0","shangye2013","name:PasswdAgain")
  89. help.sleep(400)
  90. web.htmlclick("explorer0","save")
  91. endfunction
  92. function 改外发邮箱()
  93. web.go("explorer0","https://mail.google.com/mail/?hl=zh-cn&shva=1#settings/accounts")
  94. endfunction
  95. function button2_click()
  96. threadhwnd=thread.beginthread("gmail.改密码","")
  97. endfunction
  98. function button1_click()
  99. threadhwnd=thread.beginthread("gmail.改外发邮箱","")
  100. endfunction
  101. function button3_click()
  102. threadhwnd=thread.beginthread("gmail.退出","")
  103. endfunction
  104. function start_click()
  105. threadhwnd=thread.beginthread("gmail.go","")
  106. threadhwnd=thread.beginthread("gmail.当前","")
  107. endfunction
  108. function exit_click()
  109. help.exit()
  110. endfunction
  111. function init()
  112. threadhwnd=thread.beginthread("gmail.当前","")
  113. web.cleartemp()
  114. help.sleep(help.randto(200,500))
  115. web.clearcookie()
  116. help.sleep(help.randto(200,500))
  117. web.go("explorer0","gmail.com")
  118. help.sleep(help.randto(200,500))
  119. endfunction
  120. endnamespace
复制代码

回复

使用道具 举报

沙发
 楼主| 发表于 2013-5-21 12:48:43 | 只看该作者
可能有点乱。。。
回复 支持 反对

使用道具 举报

板凳
发表于 2013-5-21 12:50:40 | 只看该作者
返回一个具有分隔符的串或者引用账号、密码都行
回复 支持 反对

使用道具 举报

地板
发表于 2013-5-21 12:50:46 | 只看该作者
全都是英文 木有看懂
回复 支持 反对

使用道具 举报

5#
 楼主| 发表于 2013-5-21 12:52:44 | 只看该作者
回复 3楼Sky_Pro的帖子

那还不是 要开一个功能方法 在分割字符串。。我只是想简洁点。。
回复 支持 反对

使用道具 举报

6#
发表于 2013-5-21 13:06:06 | 只看该作者
回复 5楼狂奔的蜗牛的帖子

引用啊,那个不用返回啥
回复 支持 反对

使用道具 举报

7#
发表于 2013-5-21 15:12:04 | 只看该作者
不清楚..........
回复 支持 反对

使用道具 举报

8#
发表于 2013-5-21 23:24:35 | 只看该作者
使用两个全局变量
回复 支持 反对

使用道具 举报

*滑动验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

站长推荐上一条 /2 下一条

关闭

小黑屋|TC官方合作论坛 (苏ICP备18043773号

GMT+8, 2025-10-4 10:03 , Processed in 0.135478 second(s), 23 queries .

Powered by 海安天坑软件科技有限公司

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表