All Things WinBatch > WebBatch

Inactivity

(1/3) > >>

jfrasier:
I am configuring a computer for a public library. I would like to have a script that detects when there is no activity (keystrokes or mouse) and if a certain amount of time has passed I would like the script to restart the browser (Chrome). Is this possible?

Thanks

Jane

Deana:
You are in luck. There is a code sample containing a UserDefinedFunction called Idle_Tick to handle this in the tech database: http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/tsleft.web+WinBatch/DllCall~Information+Check~for~Input~Idle~-~No~User~Input.txt

jfrasier:
Thanks. I was trying to figure out something along those lines but was stuck.

jfrasier:
I am kind of breaking this down into smaller pieces to test.

I have :

TimeDelay(5)
;this is testing. I have to click on the application in these 5 seconds

currentwin = WinGetactive( )

; just to see what it thinks is the current window
Message("WinGetActive", "Current window is %currentwin%.")

WinClose("currentwin")
TimeDelay(5)
Run(currentwin, "incognito")


The error is that it can't find the window in this line WinClose("currentwin")

I have also tried ("~currentwin") (~new tab")    (which is the beginning of the window name.

Can you help?

thanks.

Deana:

--- Quote from: jfrasier on August 14, 2013, 01:38:05 pm ---I am kind of breaking this down into smaller pieces to test.

I have :

TimeDelay(5)
;this is testing. I have to click on the application in these 5 seconds

currentwin = WinGetactive( )

; just to see what it thinks is the current window
Message("WinGetActive", "Current window is %currentwin%.")

WinClose("currentwin")
TimeDelay(5)
Run("incognito","")


The error is that it can't find the window in this line WinClose("currentwin")

I have also tried ("~currentwin") (~new tab")    (which is the beginning of the window name.

Can you help?

thanks.

--- End quote ---

Quotation marks are used to specify a string. Yet, it looks like you are trying to pass the variable currentwin to the WinClose function. You will need to remove the quotation marks around your variable name to have it treated as a variable rather than a string.


--- Code: Winbatch ---TimeDelay(5)
;this is testing. I have to click on the application in these 5 seconds

currentwin = WinGetActive( )

; just to see what it thinks is the current window
Message("WinGetActive", "Current window is ":currentwin:".") ;Uses the colon operator for string concatenation.

WinClose(currentwin)
TimeDelay(5)
Run("incognito","").

Navigation

[0] Message Index

[#] Next page

Go to full version