By using a batch hybrid with .net or something else like js I would like to create a small pop up that looks similar to the context (right click) menu. The menu should be clickable and have a few basic functions like creating a new batch file, opening dostips.com or opening a specific folder. Does anyone have any ideas about how to do this I'm not very good at understanding the hybrids I've seen on other posts. (If anyone can explain how they work it would be nice.)
Thanks ~batchcc
Context menu like pop-up with hybrid
Moderator: DosItHelp
Re: Context menu like pop-up with hybrid
An HTA hybrid should do what you're after. Aacini already wrote some examples.
viewtopic.php?t=6581
Well, I added some comments but if you're not familiar with HTML, CSS, JavaScript I'm not sure they would be even helpful for you.
Regards
aGerman
viewtopic.php?t=6581
Code: Select all
<!-- :: Batch section
@echo off &setlocal
:: Open this code as HTA and catch the outputted value
for /F "delims=" %%a in ('mshta.exe "%~fs0"') do set "HTAreply=%%a"
:: call the subroutine related to the catched value (1, 2, or 3 in this case)
call :opt%HTAreply%
:: exit the batch process
exit /b
:: sub routines ...
:opt1
start "" "calc.exe"
exit /b
:opt2
start "" "explorer.exe" /n,/e,"%programfiles%"
exit /b
:opt3
start "" "http://www.dostips.com/"
exit /b
:: HTA section -->
<HTML>
<HEAD>
<TITLE>HTA_menu</TITLE>
<!-- properties of the HTA process/window -->
<HTA:APPLICATION
ID="HTA_menu"
APPLICATIONNAME="HTA_menu"
BORDER="none"
CAPTION="no"
SCROLL="no"
SHOWINTASKBAR="no"
SINGLEINSTANCE="yes"
SYSMENU="no"
VERSION="1.0"
WINDOWSTATE="normal" />
<!-- style properties of the HTA window elements -->
<STYLE type="text/css">
body {background-color: #ffffff; margin: 0px; padding: 10px;}
div {background-color: #ffffff; cursor: default; font-family: Helvetica; font-size: 10pt; margin: 2px; padding: 0px 0px 0px 10px; width: 100%}
</STYLE>
<!-- JavaScript functions -->
<SCRIPT type="text/javascript">
// Resize the the Window to a width of 300px and a hight of 100px
window.resizeTo(300,100);
// write the reply value to the stdout stream of the cmd process
function closeHTA(reply){
try{
var fso = new ActiveXObject("Scripting.FileSystemObject");
fso.GetStandardStream(1).WriteLine(reply);
}
catch(e){}
window.close();
}
// set the backgroud color to gray at mouse-over
function setcol(elem){
elem.style.backgroundColor = "#d0d0d0";
}
// set the backgroud color back to white at mouse-out
function resetcol(elem){
elem.style.backgroundColor = "#ffffff";
}
</SCRIPT>
</HEAD>
<!-- HTA window -->
<BODY>
<!-- menu items; the passed value for closeHTA() will be written to the cmd process -->
<DIV onclick="closeHTA(1)" onmouseover="setcol(this)" onmouseout="resetcol(this)">Calculator</DIV>
<DIV onclick="closeHTA(2)" onmouseover="setcol(this)" onmouseout="resetcol(this)">Program Files</DIV>
<DIV onclick="closeHTA(3)" onmouseover="setcol(this)" onmouseout="resetcol(this)">DosTips</DIV>
</BODY>
</HTML>
If anyone can explain how they work it would be nice.
Well, I added some comments but if you're not familiar with HTML, CSS, JavaScript I'm not sure they would be even helpful for you.
Regards
aGerman
Re: Context menu like pop-up with hybrid
Thank you aGerman I haven't tried it yet but I'll tell you if it works.
batchcc
![Smile :)](./images/smilies/icon_smile.gif)