Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 04, 2016, 12:34:17 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: 'Connect to Internet' shortcut needed.  (Read 5496 times)

pilgrim

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 316
  • Cogito ergo ?
    • View Profile
    • Pilgrim's Page
    • Donate to Member
'Connect to Internet' shortcut needed.
« on: March 21, 2013, 06:16:08 AM »
When I am not using the internet, several programs that I only need online and the connection itself are disabled.
I have been trying to find a way to create a single keyboard shortcut that will allow me to enable both programs and connection with a single click, most recently I have tried Lacuna Launcher.

Starting the programs is not a problem but I have so far failed to find a way to start the connection from the same shortcut.

I have a shortcut in Quick Launch to the connection and if I click on properties the target shows as: {BA126ADB-2166-11D1-B1D0-00805FC1270E}, the 'Start in' box is empty.
I have not found any way to trigger either this shortcut of the connection itself from any program.

I have wondered whether it would be possible to create a batch file to do what I want but I suspect that if I could find the correct command it would work from a launcher as well.

I have the same situation on both Windows 7 and XP computers, any ideas?
I spent 25 years training to be an eccentric then I woke up one morning and realised that I'd cracked it.
I've not had to try since.

I wonder what happens if I click on thi

PhilB66

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 1,522
    • View Profile
    • Donate to Member

pilgrim

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 316
  • Cogito ergo ?
    • View Profile
    • Pilgrim's Page
    • Donate to Member
Re: 'Connect to Internet' shortcut needed.
« Reply #2 on: March 21, 2013, 08:22:59 AM »
Thanks for that.

I just downloaded NICToggle, I cannot try it at the moment as I do not want the connexion to drop.

One thing I did notice was that it puts an icon in the system tray which would be a problem on my Netbook.
Another thing is that it uses Devcon.exe which has two versions, x64 & x86.
On my computers Windows 7 is x64, XP is x86.

When I have the time I'll check through the other links on that thread as well, at least I have more ideas than I had when I posted earlier.
I spent 25 years training to be an eccentric then I woke up one morning and realised that I'd cracked it.
I've not had to try since.

I wonder what happens if I click on thi

app103

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,666
    • View Profile
    • App's Apps
    • Read more about this member.
    • Donate to Member
Re: 'Connect to Internet' shortcut needed.
« Reply #3 on: March 21, 2013, 11:44:29 AM »
You could use the path to the shortcut file itself, in Lacuna Launcher. Just remember that shortcut files end in .LNK, even if you do not see this file extension visible in Explorer.  ;)

Now when you run Lacuna Launcher, it will launch the shortcut, which in turn will launch your connection.

pilgrim

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 316
  • Cogito ergo ?
    • View Profile
    • Pilgrim's Page
    • Donate to Member
Re: 'Connect to Internet' shortcut needed.
« Reply #4 on: March 21, 2013, 12:17:15 PM »
After two hours I have got part of the way there.

NICToggle provided me with an ID for the NIC which I then used to create a batch file with two shortcuts, enable and disable.
I removed the program but put a copy of Devcon.exe into the System 32 folder and the shortcuts work.

What I have not been able to do is create a batch file to first start the programs and then the NIC.

The items I am trying to run in order are as follows:

C:\Program Files (x86)\D4\D4.exe
C:\Program Files (x86)\Sandboxie\SbieCtrl.exe
C:\Program Files (x86)\PeerBlock\peerblock.exe
C:\Toggle Router\ToggleNIC_ON.bat.lnk

It would also be nice to create a batch file to stop them in reverse order.

I already had Hotkeyz installed and my thinking is to create the batch files and use that to activate them, tomorrow!(?)

app103,

I just caught your post as I was typing and it made me take a look, the shortcuts to the batch file for the NIC were showing as .bat the same as the file itself but when I copied the path it showed up as above.

I downloaded Lacuna Launcher a long time ago and put it with my 'might be useful one day downloads', when I couldn't get Hotkeyz to work with this I gave it a try, unfortunately I could not get it to work with that either.

I'll try again tomorrow.
I spent 25 years training to be an eccentric then I woke up one morning and realised that I'd cracked it.
I've not had to try since.

I wonder what happens if I click on thi

app103

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,666
    • View Profile
    • App's Apps
    • Read more about this member.
    • Donate to Member
Re: 'Connect to Internet' shortcut needed.
« Reply #5 on: March 21, 2013, 12:30:41 PM »
I have a shortcut in Quick Launch to the connection and if I click on properties the target shows as: {BA126ADB-2166-11D1-B1D0-00805FC1270E}, the 'Start in' box is empty.

If you can click that shortcut to connect and it works, use the path to that shortcut file in Lacuna Launcher's list. Don't use the target info shown in the properties box, use the path to that actual shortcut file itself.

pilgrim

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 316
  • Cogito ergo ?
    • View Profile
    • Pilgrim's Page
    • Donate to Member
Re: 'Connect to Internet' shortcut needed.
« Reply #6 on: March 22, 2013, 10:14:25 AM »
After several more hours I have decided that I have severe RAM degradation and the CPU is not as fast as it used to be.
And that's just me! :(

I have thrown everything at this that I can think of and I still cannot get the NIC to start from the same source as the programs.

I have the original BAT file with its two shortcuts, enable/disable.
I have created two other BAT files to separate the enable/disable options.
All of them work independently using 'PCI\VEN_8086&DEV_1503'.
I even tried converting them into EXE files which did not work at all.
Try to include them in any launcher program and they will not work.

I also had problems getting all three of the programs to either start or stop using a batch file.
Although they do all start using a launcher.
From what I read start commands should begin with 'start /d' on each line and stop instructions with 'taskkill /im'.
In each case it worked for D4 but not for the other two programs no matter what order they were in?

I have a shortcut in Quick Launch to the connection and if I click on properties the target shows as: {BA126ADB-2166-11D1-B1D0-00805FC1270E}, the 'Start in' box is empty.

If you can click that shortcut to connect and it works, use the path to that shortcut file in Lacuna Launcher's list. Don't use the target info shown in the properties box, use the path to that actual shortcut file itself.

I tried your suggestion but all that happened was that the connection's status window appeared for a second and then disappeared there was no indication of it actually trying to connect.
It was definitely disconnected when I tried it as the Network Activity Indicator icon was grey and it never even flickered.
I considered a 'permissions' problem but everything that can be is set to 'Run as Administrator'.


I shall continue to look into this but at the moment I am right out of fresh ideas.


UPDATE:


After much tinkering with Hotkeyz (the help file (online) is the worst part of the program) I now have a single hotkey to turn the programs on and another to turn them off.
Still no success with including the NIC.
I spent 25 years training to be an eccentric then I woke up one morning and realised that I'd cracked it.
I've not had to try since.

I wonder what happens if I click on thi
« Last Edit: March 22, 2013, 11:40:51 AM by pilgrim-online »

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,473
    • View Profile
    • Donate to Member
Re: 'Connect to Internet' shortcut needed.
« Reply #7 on: March 23, 2013, 11:41:50 PM »

UPDATE:


After much tinkering with Hotkeyz (the help file (online) is the worst part of the program) I now have a single hotkey to turn the programs on and another to turn them off.
Still no success with including the NIC.

Are you sure you're formatting the devcon command correctly?

eg.

devcon.exe disable =net "@PCI\VEN_10EC&DE
V_8136&SUBSYS_015B1025&REV_02\4&25F1891F&0&00E1"


That should work from a CLI, (substitute your particular hardware ID of course), so you should be able to put the command into a batch file.

The =net is not required, I include it to ensure that I'm only affecting a network class device, (just in case there's a non-network device with the same ID - which there never should be).

pilgrim

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 316
  • Cogito ergo ?
    • View Profile
    • Pilgrim's Page
    • Donate to Member
Re: 'Connect to Internet' shortcut needed.
« Reply #8 on: March 24, 2013, 07:54:38 AM »
4wd,

Thanks for the reply.

As far as the batch files went the biggest problem was punctuation, particularly inverted commas in the wrong places.
(At one point by removing them from around the NIC my screen resolution changed from 1920x1080 t0 800x600.) :-[

I now have two batch files which work as required with both the programs and the NIC:

Internet_ON.bat

@echo off

start /d "C:\Program Files (x86)\D4" D4.exe
start /d "C:\Program Files (x86)\Sandboxie" SbieCtrl.exe
start /d "C:\Program Files (x86)\PeerBlock" peerblock.exe

devcon enable  "PCI\VEN_8086&DEV_1503"

------------------------------------------------------

Internet_OFF.bat

@echo off

TASKKILL /F /IM peerblock.exe
TASKKILL /F /IM SbieCtrl.exe
TASKKILL /F /IM D4.exe

devcon disable "PCI\VEN_8086&DEV_1503"

------------------------------------------------------

At the moment I have placed shortcuts to them in a toolbar on the taskbar.
I have still failed to trigger them using Hotkeyz, it will open/close the programs but has no effect on the NIC.
I remember using a program called Coolbarz on XP and that was the same, it would not work with Network Adapters.
I suspect this may be true of most, if not all, launchers although I would have thought there was a way around it.
(Then again what do I know about programming?) :read:

I could create hotkeys from the shortcuts using Windows but that requires 3 keys for each (Ctrl + Alt + x), Hotkeyz can work with 2 which is easier.
I spent 25 years training to be an eccentric then I woke up one morning and realised that I'd cracked it.
I've not had to try since.

I wonder what happens if I click on thi

pilgrim

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 316
  • Cogito ergo ?
    • View Profile
    • Pilgrim's Page
    • Donate to Member
Re: 'Connect to Internet' shortcut needed.
« Reply #9 on: March 24, 2013, 12:29:51 PM »
SOLVED:

Internet_ON.bat

@echo off

start /d "C:\Program Files (x86)\D4" D4.exe
start /d "C:\Program Files (x86)\Sandboxie" SbieCtrl.exe
start /d "C:\Program Files (x86)\PeerBlock" peerblock.exe

netsh interface set interface "Router Connection" ENABLED

--------------------------------------------------------

Internet_OFF.bat

@echo off

TASKKILL /F /IM peerblock.exe
TASKKILL /F /IM SbieCtrl.exe
TASKKILL /F /IM D4.exe

netsh interface set interface "Router Connection" DISABLED

--------------------------------------------------------

I found the answer on a 6 year old Sysinternals Forum Thread.

This now runs in Hotkeyz and it now works in Coolbarz as well, so I am guessing it would work in any launcher program.

Pilgrm :rip:
I spent 25 years training to be an eccentric then I woke up one morning and realised that I'd cracked it.
I've not had to try since.

I wonder what happens if I click on thi

pilgrim

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 316
  • Cogito ergo ?
    • View Profile
    • Pilgrim's Page
    • Donate to Member
Re: 'Connect to Internet' shortcut needed.
« Reply #10 on: March 26, 2013, 11:50:34 AM »
 netsh command not working on XP! :wallbash:

neither is devcon!
I spent 25 years training to be an eccentric then I woke up one morning and realised that I'd cracked it.
I've not had to try since.

I wonder what happens if I click on thi
« Last Edit: March 27, 2013, 08:02:47 AM by pilgrim-online »

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,473
    • View Profile
    • Donate to Member
Re: 'Connect to Internet' shortcut needed.
« Reply #11 on: March 28, 2013, 02:49:45 AM »
And if you use the full instance ID?

eg. devcon disable "@PCI\VEN_8086&DEV_1503.................."

pilgrim

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 316
  • Cogito ergo ?
    • View Profile
    • Pilgrim's Page
    • Donate to Member
Re: 'Connect to Internet' shortcut needed.
« Reply #12 on: March 28, 2013, 04:28:08 AM »
And if you use the full instance ID?

eg. devcon disable "@PCI\VEN_8086&DEV_1503.................."

Same thing - nothing.

I found an old article somewhere saying that devcon would not work for this on XP and it suggested using a VB script.
In the first place that is beyond my understanding, in the second there was no indication as to whether the OP actually got it working?
Also, the script listed was to toggle the adapter, I need to keep enable and disable separate.

Not that I can see it should make a difference but the connection on both my XP computers is wireless, built in on my Netbook, a dongle on my old PC.
I have only tried it on the Netbook so far, the ID is:
PCI\VEN_168C&DEV_001C&SUBSYS_E00C105B&REV_01\4&192AC53F&0&00E0.

I tried all the variations listed above but none of them worked, I will try again because a number of times I got an error message but never copied it.

On Windows 7 the last batch files I posted are still working perfectly.
I spent 25 years training to be an eccentric then I woke up one morning and realised that I'd cracked it.
I've not had to try since.

I wonder what happens if I click on thi

pilgrim

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 316
  • Cogito ergo ?
    • View Profile
    • Pilgrim's Page
    • Donate to Member
Re: 'Connect to Internet' shortcut needed.
« Reply #13 on: March 28, 2013, 11:55:19 AM »
Meanwhile, many hours later:

Internet_ON.bat

@echo off

start "" "C:\Program Files\D4\D4.exe"
C:\WINDOWS\system32\sleep.exe 1
start "" "C:\Program Files\Sandboxie\SbieCtrl.exe"
C:\WINDOWS\system32\sleep.exe 1
start "" "C:\Program Files\PeerBlock\peerblock.exe"
C:\WINDOWS\system32\sleep.exe 3

C:\WINDOWS\system32\devcon.exe enable *DEV_001C*

------------------------------------------------------

Internet_OFF.bat

@echo off

start /d "C:\WINDOWS\system32\taskkill.exe" taskkill /F /IM peerblock.exe
start /d "C:\WINDOWS\system32\taskkill.exe" taskkill /F /IM SbieCtrl.exe
start /d "C:\WINDOWS\system32\taskkill.exe" taskkill /F /IM D4.exe

C:\WINDOWS\system32\devcon.exe disable *DEV_001C*

------------------------------------------------------

NOTES:

devcon.exe will work in XP but only after I used the full path.

taskkill.exe is not in XP Home so I copied it from XP Mode and while it was recognised by the system, it too required the full path to work.
sleep.exe was the same.

The time delays in the 'ON' file were to get the icons in the order I wanted in the System Tray, not an issue in Windows 7.

While the batch files I now have all work, when the 'OFF' files are run the program icons remain in the System Tray in both OS' until I run the cursor over them.
The network icon on 7 goes grey (disabled), on XP it disappears, both normal actions.


Two down, one to go.
I spent 25 years training to be an eccentric then I woke up one morning and realised that I'd cracked it.
I've not had to try since.

I wonder what happens if I click on thi

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,473
    • View Profile
    • Donate to Member
Re: 'Connect to Internet' shortcut needed.
« Reply #14 on: March 28, 2013, 03:09:06 PM »
devcon.exe will work in XP but only after I used the full path.

Sounds like you don't have System32 in the PATH environment, ie.

Quote
C:\>path
PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32
\WindowsPowerShell\v1.0\

C:\>

As for SysTray leftover icons, attached is a small program that will remove them, (works on XP, Vista & 7 - not tested on 8 ).


pilgrim

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 316
  • Cogito ergo ?
    • View Profile
    • Pilgrim's Page
    • Donate to Member
Re: 'Connect to Internet' shortcut needed.
« Reply #15 on: March 29, 2013, 05:03:55 AM »
4wd,

I came across references to PATH in the many things I read but forgot about it, I'll check it when I get back on that computer.

One thing that I found in much of what I read is that a lot of people give information about XP without taking into consideration the differences between Home and Pro.

In case it is of interest to anyone a lot of the most useful information I learned came from Computer Hope, it was one of the first sites I ever bookmarked but have rarely used till now.

Thanks for the file, I have added it to the OFF batch file on 7 so it should work when I go offline, I will add it to the others later, much appreciated.

UPDATE:

XP: Added path and modified files:

Internet_ON.bat

@echo off

start "" "C:\Program Files\D4\D4.exe"
sleep 1
start "" "C:\Program Files\Sandboxie\SbieCtrl.exe"
sleep 1
start "" "C:\Program Files\PeerBlock\peerblock.exe"
sleep 3

devcon enable *DEV_001C*

---------------------------------

Internet_OFF.bat

@echo off

taskkill /F /IM peerblock.exe
taskkill /F /IM SbieCtrl.exe
taskkill /F /IM D4.exe

devcon disable *DEV_001C*

CleanTray: On 7 I could only get it to work by clicking on the EXE, when it was in the batch file the icons remained, in both cases it had changed the order of the icons the next time I ran the ON file.
I was using the 'start /d' command which works for the other programs.
On XP I had a similar problem, when I ran the EXE directly it removed the 3 icons, moved all the others to the left and I had three empty spaces at the right hand end of the System Tray, once again the next time I ran the ON file the icons appeared in a different order to before.
I spent 25 years training to be an eccentric then I woke up one morning and realised that I'd cracked it.
I've not had to try since.

I wonder what happens if I click on thi
« Last Edit: March 29, 2013, 11:34:27 AM by pilgrim-online »

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,473
    • View Profile
    • Donate to Member
Re: 'Connect to Internet' shortcut needed.
« Reply #16 on: March 30, 2013, 01:25:02 AM »
CleanTray: On 7 I could only get it to work by clicking on the EXE, when it was in the batch file the icons remained, in both cases it had changed the order of the icons the next time I ran the ON file.

Strange because that's how I run it on my W7 machine - in a batch file and it works OK.

Don't use 'start', just have a line:

<path if req>CleanTray.exe

pilgrim

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 316
  • Cogito ergo ?
    • View Profile
    • Pilgrim's Page
    • Donate to Member
Re: 'Connect to Internet' shortcut needed.
« Reply #17 on: March 30, 2013, 12:40:54 PM »
Got it working on 7 using the full path but it is still rearranging the icons when I restart the programs, not just those of the programs and the NIC in the batch file but other programs that are closed at the time I run it. Icons for programs that are always running stay put. It seems that it is causing the OS to forget where the closed icons were.

Don't worry about it because my main aim was the batch files and now that I know they are working I can tell by the NIC icon on both OS' if the programs are active or not.
Running the cursor over the icons to close them is still quicker than closing each program and disabling the NIC individually.
I spent 25 years training to be an eccentric then I woke up one morning and realised that I'd cracked it.
I've not had to try since.

I wonder what happens if I click on thi