Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have some software that's licensed to be used on one computer at a time. It connects to a service and retrieves data from that service. If I start the application on a second computer then the first computer's data connection is terminated.

There are times when I'll be running the software on Computer1 and it's doing some vital work with its data collection etc. and I'll forget that it's running there and start it on Computer2 causing Computer1's data connection to terminate etc.

What I want to do is configure a warning on Computer2 so that each time I start this application it pops up a dialog box and says "Hey, this software might be running on another computer, are you sure you want to start it here?"

I'm using Windows 7 on Computer2. Is there anyway for me to accomplish this task?

share|improve this question
1  
Just my two cents: I tested skub's answer, and it worked perfectly. I think that is your answer. –  KCotreau Aug 1 '11 at 1:04
add comment

2 Answers

up vote 4 down vote accepted

You could use a vbs script. This will launch notepad if you say yes and notify you that you have hit cancel (if you hit cancel).

Set WshShell = CreateObject("WScript.Shell")

intButton = WshShell.Popup ("Hey, this software might be running on another computer, are you sure you want to start it here?", , , 1 + 48)

select case intButton

  case 1
    strMessage = ""
        sub shell(cmd)
            WshShell.Run(cmd)
            Set WshShell = Nothing
        end sub
    shell """C:\Program Files (x86)\UltraISO\UltraISO.exe"""

  case 2
    strMessage = "You clicked the Cancel button."
    WshShell.Popup strMessage, , , 32 

end select

Just copy/paste it into a text file and change the txt to a vbs.

share|improve this answer
1  
+1 Very nice indeed. MUCH better than mine. –  KCotreau Jul 31 '11 at 23:14
    
You have an WshShell object already. Just reuse that one for the Run() function and I think the sub can be promoted to top-level as it's only called once. –  billc.cn Aug 1 '11 at 0:14
    
I modified the code to make it a bit cleaner. Sorry, this is like my second vbs script ever. –  skub Aug 1 '11 at 0:44
add comment

This is not perfect, but it is simple, and it does what you want. I set this up to open Word 2010 as an example, but you would add your program. Create a .bat batch file to open your program with the following code in it, and use it to launch your program:

@echo Are you sure you want to continue?
Pause
start "C:\Program Files\Microsoft Office\Office14\winword.exe"
exit
share|improve this answer
    
It is not perfect in that if you do proceed to open, you will have to click to close the DOS box. –  KCotreau Jul 31 '11 at 22:50
    
Try using vbs script. –  skub Jul 31 '11 at 23:06
    
@skub I would have...if I were competent at it. :) –  KCotreau Jul 31 '11 at 23:18
    
Aww, don't say that, I just googled around to find examples of the different techniques and put them together. Anyone could do that! –  skub Jul 31 '11 at 23:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.