Joined
·
79,142 Posts
Alright, so I've kinda reached a breaking point. I have a bunch of items pinned to the Taskbar, but sometimes I have bad mouse aim and I click the wrong one when I meant to click the one right next to it. This can be especially irritating if that program I accidentally opened takes a long time to open. So, what I'd like to do is to find a way to have a message that pops up first that asks me if I'm sure I want to open it. That way, I can just press Esc for "No" or "Cancel". That way, I don't have to wait for the program to open just so I can close it.
So, do you think there's a way to do this?
Edit: I have been given the solution by larsch (with some additional assistance provided by Quantum Reality as seen in Post # 29). In short, it's a .vbs script as seen in larsch's first post below:
Quote:
Code:
Here's how to use it:
Now, when you click that pinned item, you should see something like this:
Yep. Crysis. lol
I'm obsessed with it. What can I say? Here's what the Target box looks like for my Crysis shortcut (the pinned item on my Taskbar):
C:\Confirm.vbs "C:\Program Files (x86)\Electronic Arts\Crytek\Crysis\Bin32\Crysis.exe"
Anyway, here are some variables in the script that are good to change as you see fit:
Do you REALLY want to open this?
vbYesNoCancel
Are you sure?
For the "vbYesNoCancel" I strongly recommend looking up MsgBox commands because you can't just have it say anything you want (here's a guide I found a few minutes ago - look for the section called "Second Group"). Like, you can't put "vbSureNahGoAway". Note: if you change vbYesNoCancel" to something else, like say "vbOKCancel", then you must also change the following part:
If result = vbYes
to this:
If result = vbOK
That's why I put "OK" in bold.
If you have any questions though, then just post them and I know someone here will be able to answer them!
So, do you think there's a way to do this?
Edit: I have been given the solution by larsch (with some additional assistance provided by Quantum Reality as seen in Post # 29). In short, it's a .vbs script as seen in larsch's first post below:
Quote:
I then made some very minor changes to it and then larsch added a question mark icon to the MsgBox. After all that, here's my current version of this script:Originally Posted by larsch
You can use vbOKCancel. And let us add a question mark also
Code:
Code:result = MsgBox("Do you want to run this application?" + vbCrLf + vbCrLf + WScript.Arguments(0), vbOKCancel + vbQuestion, "Run it?") If result = vbOk Then WScript.CreateObject("WScript.Shell").Run cmd
Code:
Code:
cmd = ""
x = WScript.Arguments.Count - 1
For i=0 To x
cmd = cmd + """" + WScript.Arguments(i) + """"
If i < x Then cmd = cmd + " "
Next
result = MsgBox("Do you REALLY want to open this?" + vbCrLf + vbCrLf + WScript.Arguments(0), vbYesNoCancel + vbQuestion, "Are you sure?")
If result = vbYes Then WScript.CreateObject("WScript.Shell").Run cmd
- Open the Folder Options control panel
- Make sure to disable "Hide extensions for known file types"
- Click OK or press Enter
- Create a new Text Document anywhere you want.
- Rename it to anything you want, but change the .txt extension to .vbs
- Windows will warn you, "If you change a file name extension, the file might become unstable. Are you sure you want to change it?". Click Yes, or just press Enter
- Right-click it and choose Edit (or just Right-Click and press 'E')
- Copy/paste my current version of this script
- Close Notepad
- Say "Yes" to saving changes (or just press Enter)
- For pinned items on the Taskbar, hold Shift and right-click the pinned item (while holding shift). Let go of shift after right-clicking. For all other shortcuts (including the ones that you might have in the Quick Launch toolbar), just right-click.
- Choose Properties
- Make sure the path inside the Target box is inside of quotations. If not, then put quotes around it now.
- In front of this path (left-click once inside of the box and then press Home, or just hold your left arrow key until you get to the very beginning), put the full path to your script file including its name (and the .vbs extension). So, mine is currently "C:\Confirm.vbs" (with no quotes). Put a space between that and the path for the program in question.
- Click OK
Now, when you click that pinned item, you should see something like this:

Yep. Crysis. lol
C:\Confirm.vbs "C:\Program Files (x86)\Electronic Arts\Crytek\Crysis\Bin32\Crysis.exe"
Anyway, here are some variables in the script that are good to change as you see fit:
Do you REALLY want to open this?
vbYesNoCancel
Are you sure?
For the "vbYesNoCancel" I strongly recommend looking up MsgBox commands because you can't just have it say anything you want (here's a guide I found a few minutes ago - look for the section called "Second Group"). Like, you can't put "vbSureNahGoAway". Note: if you change vbYesNoCancel" to something else, like say "vbOKCancel", then you must also change the following part:
If result = vbYes
to this:
If result = vbOK
That's why I put "OK" in bold.
If you have any questions though, then just post them and I know someone here will be able to answer them!