Page 1 of 1

Startup script not working when executed by Viscosity

Posted: Sun Oct 13, 2019 7:11 pm
by dgfdgfdfgfgdfgfdDDD
I have a startup script that looks like this to start my torrent program when connected:

Code: Select all
TIMEOUT /T 10
taskkill /f /im qBittorrent.exe
TIMEOUT /T 25
:while1
TIMEOUT /T 30
if exist e:\ (
     start "" "C:\Program Files\qBittorrent\qbittorrent.exe"
) else (
    goto :while1
)

When I run this file with my terminal, it works just fine. But when I connect to my vpn, the script does not seem to work when Viscosity runs it. The script doesn't even start.

I also a shutdown script and that works just fine though:
Code: Select all
TIMEOUT /T 2
taskkill /f /im qBittorrent.exe
I have also tried using VBS script and do the same thing. And I have the same problem, startup doesn't work but stop does.

Re: Startup script not working when executed by Viscosity

Posted: Mon Oct 14, 2019 11:58 am
by Eric
Hi,

Viscosity will terminate scripts that run for longer than 60 seconds to prevent scripts getting in a stuck state forever. It looks like your script is timed to not start your application until at least 65 seconds after it's first run if I'm reading your timeout values correctly.

You have two options, you can shorten the delays in your scripts, or lengthen the delay in Viscosity until it terminates a script. To do the latter, run the following from Start -> Run or a command prompt:
Code: Select all
"C:\Program Files\Viscosity\Viscosity.exe" SetPref ConnectionScriptTimeout 120
Replacing 120 with however many seconds you'd like Viscosity to wait until it terminates a script. I would not recommend taking this value beyond 240.

Regards,
Eric

Re: Startup script not working when executed by Viscosity

Posted: Thu Oct 24, 2019 3:27 am
by dgfdgfdfgfgdfgfdDDD
Mon Oct 14, 2019 11:58 amEric wrote:
Hi,

Viscosity will terminate scripts that run for longer than 60 seconds to prevent scripts getting in a stuck state forever. It looks like your script is timed to not start your application until at least 65 seconds after it's first run if I'm reading your timeout values correctly.

You have two options, you can shorten the delays in your scripts, or lengthen the delay in Viscosity until it terminates a script. To do the latter, run the following from Start -> Run or a command prompt:
Code: Select all
"C:\Program Files\Viscosity\Viscosity.exe" SetPref ConnectionScriptTimeout 120
Replacing 120 with however many seconds you'd like Viscosity to wait until it terminates a script. I would not recommend taking this value beyond 240.

Regards,
Eric
Hi, thanks.

I reduces the timout in the script and it worked. Then for good measure, I increased the ConnectionScriptTimeout as you said to 120 seconds. However this seems to have broken something because now my disconnect script doesn't work any more. I tried installing Viscosity, but it didn't work. How can I reset the settings?

Re: Startup script not working when executed by Viscosity

Posted: Thu Oct 24, 2019 11:06 am
by Eric
Hi,

To reset this setting, Exit Viscosity and then run:
Code: Select all
"C:\Program Files\Viscosity\Viscosity.exe" SetPref ConnectionScriptTimeout deletepref
To reset all settings, delete the file at %appdata%\Viscosity\Settings.xml (type in %appdata%\Viscosity into an explorer window and press Enter). Please keep in mind this will also delete your license and you will need to re-enter it.

We'll take a look and see if we can replicate the problem.

Regards,
Eric