Jump to content

How to create an Autorun.inf with yes/no question


rodommoc

Recommended Posts

I want to create an autorun.inf that pops up a box with 2 buttons and asks if I want to run a file when I insert a CD. I made a hardware CD and when I insert it I have to browse to the directory and run the hardware 0.86 executable. I don’t want it to run the executable automatically I want it to ask me if I want to run the file. If I click yes it runs, If I click no it closes the window. Any ideas would be much appreciated.

Thanks

Link to comment
Share on other sites


Well the way most companies do it is by writing a tiny problem, but that's probably beyond your scope. Instead you could create a web page (.html) and use Javascript to fire off a yes/no via the Confirm function, then make a decision.

Although it will fire off a web browser window first that won't close by itself. Also IE6 XP SP2 and IE7 will display warnings because you're trying to run an EXE from a web browser, and FireFox will refuse to execute it if that's your default browser. So it's not the most elegant solution, but it is easy. I'll come back later and post some HTML/Javascript

Edited by travisowens
Link to comment
Share on other sites

You could use a hta to do the same thing to avoid any security warning.

Example Yes No Hta

<HTML><HEAD>
<TITLE>Confirm This</TITLE>
<HTA:APPLICATION ID='Search_Audio'
SingleInstance='Yes' SysMenu='Yes'
MaximizeButton='No' MinimizeButton='Yes'
SCROLLFLAT ='No' Border='Thin'
BORDERSTYLE ='complex' INNERBORDER ='Yes'
Caption='Yes' WindowState='Normal'
APPLICATIONNAME='SearchAudio'
Icon='%Windir%\explorer.exe'>
<STYLE type="text/css">
Body
{
Font-Size:9.05pt;Font-Weight:Bold;
Font-Family:segoeui,helvetica,verdana,arial,Palatino Linotype,Poor Richard;
Color:#008040;BackGround-Color:Transparent;
filter:progid:DXImageTransform.Microsoft.Gradient(StartColorStr='#C7C7C7',EndColorStr='#6b6b6b');
Margin-Top:5;Margin-Bottom:5;Margin-Left:2;Margin-Right:2;
Padding-Top:5;Padding-Bottom:5;Padding-Left:2;Padding-Right:2;
Text-Align:Left;Vertical-Align:Top;
Border-Top:2px Solid #cbc7c3;Border-Bottom:3px Solid #a6a29e;
Border-Left:2px Solid #bcb8b4;Border-Right:3px Solid #b2aeaa;
}
.B1
{
Cursor:Hand;Height:17px;width:32px;
Font-Size:8.05pt;Font-Weight:Bold;Color:#005a00;BackGround-Color:Transparent;
Filter:progid:DXImageTransform.Microsoft.Gradient(StartColorStr='#ece6e0',endColorStr='#c0bab4');
Margin-Top:1;Margin-Bottom:1;Margin-Left:1;Margin-Right:1;
Padding-Top:1;Padding-Bottom:1;Padding-Left:1;Padding-Right:1;
Text-Align:Center;Vertical-Align:Middle;
Border-Top:0px Transparent;Border-Bottom:0px Transparent;
Border-Left:0px Transparent;Border-Right:0px Transparent;
}
.B2
{
Cursor:Hand;Height:17px;width:32px;
Font-Size:8.05pt;Font-Weight:Bold;Color:#005a00;BackGround-Color:Transparent;
Filter:progid:DXImageTransform.Microsoft.Gradient(StartColorStr='#388085',endColorStr='#40c0d4');
Margin-Top:1;Margin-Bottom:1;Margin-Left:1;Margin-Right:1;
Padding-Top:1;Padding-Bottom:1;Padding-Left:1;Padding-Right:1;
Text-Align:Center;Vertical-Align:Middle;
Border-Top:0px Transparent;Border-Bottom:0px Transparent;
Border-Left:0px Transparent;Border-Right:0px Transparent;
}
.TdText
{
Font-Size:9.05pt;Font-Weight:Bold;
Font-Family:segoeui,helvetica,verdana,arial,Palatino Linotype,Poor Richard;
Color:#008040;BackGround-Color:Transparent;
Margin-Top:1;Margin-Bottom:1;Margin-Left:4;Margin-Right:4;
Padding-Top:1;Padding-Bottom:1;Padding-Left:4;Padding-Right:4;
{
</STYLE>
<script LANGUAGE='JScript'>
window.resizeTo (275,125), window.moveTo (190,175);
function Button01Click()
{
// PLACE YOUR CODE IN HERE THAT YOU WANT TO RUN
alert('You pressed the yes button');
;}
function Button02Click()
{
// PLACE YOUR CODE IN HERE THAT YOU WANT TO RUN
alert('You pressed the no button, press to close the hta');
window.close();
;}
</SCRIPT></HEAD>
<BODY Scroll='No'><CENTER><TD Class='TdText'>Would You Like To Run This?</TD><BR>
<INPUT Type='Button' Class='B1' ID='Bttn01' Value='Yes' OnMouseOver='this.className="B2"'
OnMouseOut='this.className="B1"' OnClick='Button01Click()'>
<TD> </TD>
<INPUT Type='Button' Class='B1' ID='Bttn02' Value='No' OnMouseOver='this.className="B2"'
OnMouseOut='this.className="B1"' OnClick='Button02Click()'>
</CENTER>

Link to comment
Share on other sites

  • 2 months later...
I tried this script and it did not work. I tried it as an HTML, asp, aspx. I'm just looking for a simple dialouge box asking if I want to run "hardware.exe"? YES or NO.

The script failed because of this appead in the post do not know why it happen

<script LANGUAGE='JScript'>

This is how it should be

"Remove The Quotes Here only To Post<"script LANGUAGE='JScript'>

To run the app you need to fill in this area to have the app run

  function Button01Click()
{
// PLACE YOUR CODE IN HERE THAT YOU WANT TO RUN
alert('You pressed the yes button');
;}

Edited by gunsmokingman
Link to comment
Share on other sites

  • 2 weeks later...

you could try Autoit..

the source for what you want to do is


Opt("TrayIconHide", 0) ;0=show, 1=hide tray icon

$answer=msgbox(4,"Question"," Do you want to install hardware ?")

if $answer = 6 Then ; value of 6 means yes pressed
run("hardware.exe",@TempDir,@SW_SHOW)
EndIf

Exit

and autoit can compile this to an .exe for you.

autoit avaiable at http://www.autoitscript.com/autoit3/

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...