TC官方合作论坛

标题: 请教下传参到问题 一个功能方法能不能返回2个值 有源码 麻烦看下 [打印本页]

作者: 狂奔的蜗牛    时间: 2013-5-21 12:47
标题: 请教下传参到问题 一个功能方法能不能返回2个值 有源码 麻烦看下
源码如下:
我就是想只用一个功能方法让他返回账号和密码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
可能有点乱。。。
作者: Sky_Pro    时间: 2013-5-21 12:50
返回一个具有分隔符的串或者引用账号、密码都行
作者: rggt1234    时间: 2013-5-21 12:50
全都是英文 木有看懂
作者: 狂奔的蜗牛    时间: 2013-5-21 12:52
回复 3楼Sky_Pro的帖子

那还不是 要开一个功能方法 在分割字符串。。我只是想简洁点。。
作者: Sky_Pro    时间: 2013-5-21 13:06
回复 5楼狂奔的蜗牛的帖子

引用啊,那个不用返回啥
作者: 舍我其谁    时间: 2013-5-21 15:12
不清楚..........
作者: zc1835429    时间: 2013-5-21 23:24
使用两个全局变量




欢迎光临 TC官方合作论坛 (http://bbs.52tc.co/) Powered by Discuz! X3.1