如何检查Nightmare JS是否在调试模式下运行

时间:2017-06-22 03:18:02

标签: javascript node.js nightmare

有没有办法确定我的梦魇脚本是否正在运行调试输出?

例如,要使用调试输出启动Nightmare,我会使用:

endKeys := "{BS}{Enter}{Insert}{Home}{Pgup}{PdDwn}End}{Delete}" . "{F1}{F2}{F3}{F4}{F5}{F6}{F7}{F8}{F9}{F10}{F11}{F12}" . "{LShift}{RShift}{Tab}{Esc}{CAPSLOCK}{Ctrl}{PrintScreen}{NumLock}" . "{Numpad0}{Numpad0}{Numpad0}{Numpad0}{Numpad0}{Numpad0}{Numpad0}" . "{Numpad7}{Numpad8}{Numpad9}{NumpadDel}{Up}{Down}{Left}{Right}" . "{LAlt}{RAlt}{.}{,}{/}" ~Alt Up:: Input, key, V L1 t0.5 E, % endKeys If (Errorlevel ~= "Alt") { Double_ALT := true Sleep 2000 Double_ALT := false } return ; Press a key within two seconds after double tapping the Alt key, to activate an action: #If (Double_ALT) a:: MsgBox, Test b:: MsgBox, Test c:: MsgBox, Test d:: FormatTime, CurrentDateTime,,MM/dd/yy - hh:mmtt SendInput %CurrentDateTime% Double_ALT :=false return s:: MsgBox, Test f:: MsgBox, Test ; return <-- likely your problem. ; #IF <-- Use this if you don't want your hotkeys below effected by the IF Directive LShift & RShift:: FormatTime, CurrentDateTime,,MM/dd/yy - hh:mmtt SendInput %CurrentDateTime% return RShift & LShift:: FormatTime, CurrentDateTime,,MM/dd/yy - hh:mmtt SendInput %CurrentDateTime% return ;否则,我会使用DEBUG=nightmare node myscript.js

node myscript.js内,如何确定脚本是否与myscript.js一起运行?

1 个答案:

答案 0 :(得分:0)

您可以使用process.env.DEBUG获取DEBUG的值。