1

请帮帮我,我想修改这个文件应该是这样的

  1. 运行脚本
  2. 执行 For 循环 5 次
  3. 等待 5 分钟
  4. 再次执行 For 循环 5 次
  5. 等待 5 分钟
  6. 再次执行 For 循环 5 次
  7. 如果脚本已运行 For Loop 3 次,则退出脚本

希望你能帮我

dim wsh
jumlah=5
delay=2000
set wsh=wscript.createobject("wscript.shell")
wscript.sleep 5000
for i=1 to jumlah
WScript.Sleep 3000
wsh.run "nircmd.exe setcursor 100 398"
WScript.Sleep 1000
wsh.run "nircmd.exe sendmouse left down"
WScript.Sleep 1000
wsh.run "nircmd.exe sendmouse left up"
WScript.Sleep 1000
wsh.sendkeys "Semoga sukses selalu dan ditambah rezekinya yg banyak "
wsh.sendkeys "{ENTER}"
wsh.sendkeys "Semoga sukses selalu dan ditambah rezekinya yg banyak "
wsh.sendkeys "{ENTER}"
wsh.sendkeys "Semoga sukses selalu dan ditambah rezekinya yg banyak "
wsh.sendkeys "{ENTER}"
wsh.sendkeys "ig: raihanrj1999 "
WScript.Sleep delay
wsh.run "nircmd.exe setcursor 834 504"
WScript.Sleep 3000
wsh.run "nircmd.exe sendmouse left down"
WScript.Sleep 1000
wsh.run "nircmd.exe sendmouse left up"
WScript.Sleep 1000
next
'END        
4

1 回答 1

0

我创建了一个解决方案,将问题分为三个功能:

  1. isEndProcess,控制停止算法的条件
  2. 进程,您将在其中放置要运行的代码
  3. loopManager,控制何时调用流程函数您可以更改常量的值以满足您的需要。

const EXECUTIONS_TO_STOP = 3
const EXECUTIONS_EACH_LOOP = 5
const TIME = 1000


let executions = 0
const isEndProcess = () => {
  return executions >= EXECUTIONS_TO_STOP
}

const process = () => {
  console.log(executions)
}

const loopManager = () => {
  if(isEndProcess()){
    return clearInterval(interval)
  }
  
  executions++
  
  for(let i=0; i<EXECUTIONS_EACH_LOOP; i++){
    process()
  }
}

const interval = setInterval(loopManager, TIME)

于 2020-05-04T03:08:25.960 回答