Jump to content

Hello! 👋

These forums are now archived (read only).

Join us on Discord.

Profiles for multiple networks?


Recommended Posts

anniesboobs
Hello, I love using Synergy, it's a great tool that allows me to more easily use my desktop along side my laptop. Something I've been wondering, however. Is it possible to set up profiles for which network I'm on? Meaning, when I'm home the server IP is 192.168.0.10 for my desktop. When I'm at work, the server IP is a different IP, relevant to my work network. I still run the server from my work desktop, but the IP schema is different. Is it possible for my Synergy client to use profiles dependent on whichever network i'm connected to?
Link to post
Share on other sites
  • 1 month later...
For Windows - instead of starting the Synergy wizard, use a startup .bat file to check your IP address, then specify the startup command as '%synergy-path%/synergyc.exe <hostname>'. Start here[1] for some ideas. However - having the Synergy client stop and start as an interface function, though, and only start on "well known" networks, but not on public networks like coffee shops would be a very cool built-in function, so I don't have to remember to stop the client before going into sleep or hibernate and moving to another network. [1] Stack Overflow, how to use batch files based on IP Address http://stackoverflow.com/questions/1458 ... -a-program
Link to post
Share on other sites
Ben Koenig
Having full control of your connections is always my favorite way to go. Having to manually type IP addresses gets real monotonous really fast. Personally I type an IP at least a few times every half hour.. Synergy does add to that. :cry: An IP profile list... if only I knew how to add one. Do you guys have any more thoughts on what you would want this to look like?
Link to post
Share on other sites
Ben Koenig
Almost forgot! Scott had really cool idea for automating the launch of a Synergy client! Probably doesn't help everyone because you are running without the graphical awesomeness. However if you need to get a client up and running really fast he has outlined it. For anyone who needs this functionality definitely check it out: [quote="CP Scott"]For Windows - instead of starting the Synergy wizard, use a startup .bat file to check your IP address, then specify the startup command as '%synergy-path%/synergyc.exe <hostname>'. Start here[1] for some ideas. However - having the Synergy client stop and start as an interface function, though, and only start on "well known" networks, but not on public networks like coffee shops would be a very cool built-in function, so I don't have to remember to stop the client before going into sleep or hibernate and moving to another network. [1] Stack Overflow, how to use batch files based on IP Address http://stackoverflow.com/questions/1458 ... -a-program[/quote] Thanks for the Pro Tip.
Link to post
Share on other sites
I decided to poke at this a bit more when I realized how useful it could be for me. Here's what I've come up with. Unfortunately, it leaves a cmd window running, rather than forking into the background and closing the CMD and leaving the tasktray icon for visibility. However, it works well enough for now. [spoiler][code] @echo off setlocal enabledelayedexpansion taskkill /f /im "synergy.exe" taskkill /f /im "synergyc.exe" taskkill /f /im "synergys.exe" REM I do not start the Synergy service on boot on my laptop, on an overabundance of paranoia and coffee shop wifi. YMMV REM Check service status, just in case - Exit gracefully or pause and wait for another window? Change Pause to Exit if you just want it to go away. for /F "tokens=3 delims=: " %%H in ('sc query "synergy" ^| findstr " STATE"') do ( if /I "%%H" NEQ "RUNNING" ( echo "Synergy service not running; please start it before continuing" pause ) ) REM find default gateway; establish network location REM I decided that default gateway was a more useful address to track on than the local address, as I use DHCP most places. REM for /f "tokens=2 delims=:" %%a in ('netsh interface ip show address ^| findstr "Default"') do ( set ip=%%a set ip=!ip: =! echo %%a ) server: if %ip%==10.0.0.1 ( REM Desktop (server) network start "" "C:/Program Files/Synergy/synergys.exe" --daemon --debug INFO --ipc --stop-on-desk-switch --enable-drag-drop --enable-crypto --profile-dir "C:\Users\username\AppData\Local" --log "C:/Users/username/Documents/logs/synergy/synergy.log" -c "C:/Users/username/synergys.sgc" --address :24800 exit /B 0 ) client: if %ip%==192.168.42.1 ( REM Home (client) network start "" "c:\Program Files\Synergy\synergyc.exe" --daemon --debug INFO --enable-crypto --profile-dir "C:\Users\username\AppData\Local" --log "C:/Users/username/Documents/logs/synergy/synergy.log" home.media.server.foo exit /B 0 ) if %ip%==172.16.0.1 ( REM Work WiFi (client) network start "" "c:\Program Files\Synergy\synergyc.exe" --daemon --debug INFO --enable-crypto --profile-dir "C:\Users\username\AppData\Local" --log "C:/Users/username/Documents/logs/synergy/synergy.log" work.server.domain.com exit /B 0 ) else ( REM Default behavior, something's broken. Start the gui. echo . echo "Not on Work Network; start wizard GUI for manual configuration" "c:\Program Files\Synergy\synergy.exe" exit /B 1 ) eof [/code][/spoiler]
Link to post
Share on other sites
[quote="Ben Koenig"]An IP profile list... if only I knew how to add one. Do you guys have any more thoughts on what you would want this to look like?[/quote] What about something like Firefox's Profile Manager startup option? Most folks don't even know that it's there, but if you do 'firefox -p' to start from a command line, you get the ability to select how firefox will run. It's super useful for troubleshooting web app errors when a plugin or toolbar is broken, but 99% of the population doesn't need it, so it's not exposed by default. I sometimes wish that Firefox would make the "start with the profile manager on by default" option part of their main preferences window, so it was a little easier to find, but this is ok too. Outlook does this too, for another way of doing it. https://support.mozilla.org/en-US/kb/pr ... x-profiles
Link to post
Share on other sites
  • 9 months later...
Jonathan Weinberg
Hmmm. You can get around the CMD window staying open and visible if you launch it with a VBS file. http://superuser.com/a/699910 [quote] Just to expand on the "Use Windows Scripting" answers (which I consider best because it's built-in already) here's how to do it by using a single wrapper script and passing the name of the "real" batch file as a parameter. Additional parameters will be passed on to the batch file. If WScript.Arguments.Count >= 1 Then ReDim arr(WScript.Arguments.Count-1) For i = 0 To WScript.Arguments.Count-1 Arg = WScript.Arguments(i) If InStr(Arg, " ") > 0 Then Arg = """" & Arg & """" arr(i) = Arg Next RunCmd = Join(arr) CreateObject("Wscript.Shell").Run RunCmd, 0, True End If So e.g. save the above file as NoShell.vbs somewhere then call: NoShell.vbs c:\foo\my_batch_file.bat Finally, if you're looking to run this from somewhere that doesn't understand the .vbs file (such as an "External Tools" in Visual Studio), you'll want to call C:\Windows\System32\wscript.exe with the vbs file as its first parameter and your batch file as the second.[/quote]
Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...