Auto "Stop Using" script

Hi!

I would like to automatically "stop using"/disconnect a device after n seconds.How would I go about?

Thanks

#2

You write a batch file to wait a set number of seconds and then send vhui64.exe -t "STOP USING,<address>" you can send that from any client.

Unfortunately windows doesnt have a sleep (like a linux bash script does) so you need to hack ping like this (e.g 100 sec)

ping 127.0.0.1 -n 100 -w 1000 > nul

#3

Thank you Michael!

I'm actually on a mac. As a none developer, could you point me in the right direction? :)

#4

This might be quite difficult to understand if you are not a developer. But anyway here is a script (chmod +x to make it executable)

#!/bin/sh
sleep 120
/Applications/VirtualHere.app/Contents/MacOS/VirtualHere -t "STOP USING,qnap.11"

Replace qnap.11 with the address of you device. You can find the address by running

/Applications/VirtualHere.app/Contents/MacOS/VirtualHere -t LIST

#5

Works like a charm!
Now I want this to run at all times from the moment I boot up my computer. Here's my solution.

Create an application (/bin/sh script) with Automator with a slight modification of your code:

#!/bin/sh while true do sleep 120 /Applications/VirtualHere.app/Contents/MacOS/VirtualHere -t "STOP USING,qnap.11" done

Then I add my newly created file here: System Preferences > Users & Groups > Login items.

Is this approach and loop a stupid idea? Is there a smarter way that does something like "Look for process VirtualHere: USE > if true do STOP USING after n seconds > start over"

#6

Good one! I wasnt sure if you could do it. Yes you can just run it in Automator. Actually i think automator can run things periodically so you dont need to bother with the sleep and loop. Just do the stop using command only inside the script and just repeat it every 5 minutes or whatever

#7

i am newbie on this and i just start use it look cool and easy but is any way to stop auto use from server side by no need go client pc

#8

No