Auto "Stop Using" script

8 posts / 0 new
Last post
slimeslimeslime
Auto "Stop Using" script

Hi!

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

Thanks

Michael
You write a batch file to

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

slimeslimeslime
Thank you Michael!

Thank you Michael!

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

Michael
.

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

slimeslimeslime
Works like a charm!

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"

Michael
.

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

chandarakk
STOP AUTO USE BY SERVER SIDE

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

Michael
.

No

Log in or register to post comments