Popups.dll Tutorial — File Browser

Popups.dllTutorialv1.0 / Popups.dllTutorialv1.0 / popups.htm

popups.htm — 20.06 KB — Download this file

<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Popups</title>
</head>

<body>

<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="5"><b><u>Popups.dll
Tutorial</u></b></font></p>
<p style="margin-top: 0; margin-bottom: 0"><b><font face="Tahoma" size="2">Written
by [AFX]</font></b></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2"><b><u>Introduction:</u></b>&nbsp;</font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;&nbsp;&nbsp;&nbsp; <font face="Tahoma" size="2">Hello
readers, and welcome to my small tutorial. In this tutorial, I will be covering
the aspects of <b>Popups.dll</b>, which was created by DragonZap.&nbsp;</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2">Incase
you didn't know, <b>Popups.dll </b>allows the user to create popup menus with
style. The DLL shouldn't be too hard for you to use.</font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2"><b><u>Chapter
1: Setting up</u></b></font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;&nbsp;&nbsp;&nbsp; <font face="Tahoma" size="2">In
this chapter, we will go over the stuff we will need in order to create our
popup menu. First, make sure Popups.dll is in your mIRC directory&nbsp;</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2">(or
wherever you want to put it). Let's assume that it is located as
C:\mIRC\System\Dll\popups.dll. Also, we will need icons for this demonstration.</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2">Make
sure all icons are stored in C:\mIRC\icons (this is just for the example, you
can put your icons anywhere, but make sure you correct your&nbsp;</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2">aliases
to match with the appropriate directories). </font><font face="Tahoma" size="2">So,
we are now going to create a few aliases.</font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2">Here are
the aliases provided. Type these in your remotes:</font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Fixedsys">;this alias is for calling the DLL. It basically means: dll popups.dll command1 command2...<br>
alias popdll { dll system\dll\popups.dll $$1- }&nbsp;<br>
<br>
;this alias adds information to the popup we are going to create<br>
alias additem_ { dll system\dll\popups.dll AddItem $1- }<br>
<br>
;this alias returns us our icons directory<br>
;usage: $ico(filename) DO NOT PUT THE ICON EXTENSION<br>
;alias ico { return icons\ $+ $1- $+ .ico }<br>
<br>
;this alias adds an icon to the popups' internal image list. just like setting icons with mdx controls.<br>
alias loadimg_ { dll system\dll\popups.dll LoadImg $1- }<br>
<br>
;this alias returns our directory where we are going to store our text files<br>
alias txt { return $mircdir $+ \ $+ $1- $+ .txt }<br>
<br>
;this alias displays the popup menu<br>
alias pop1 tokenize 32 $dll(system\dll\popups.dll,Popup,$1-) | if ($isid) return $1- | $iif($4- != did not select a menu item,$4-)</font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Tahoma">Now that
we got our aliases, we can proceed to the next step.</font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2"><b><u>Chapter
2: Beginning our popup demonstration</u></b></font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2">&nbsp;&nbsp;&nbsp;
In this section, we are going to start our demonstration popup. Before anything
though, we need to create the &quot;base&quot; of our popup. We are going</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2">to
create our popup menu inside a new alias, so you can just type /popexample, and
the popup will display:</font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Fixedsys">alias
popexample {</font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Fixedsys">;creating
our new popup menu. it is called &quot;example&quot;, and has an icon size of 16
pixels by 16 pixels</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Fixedsys">popdll
New example 16 16&nbsp;</font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Tahoma">Any
popup we create using <b>Popups.dll</b> can have its' own style. Here are the available
styles that <b>Popups.dll</b> has to offer (taken from <b>Popups.dll</b>
readme):</font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<table border="1" width="75%" cellspacing="1">
  <tr>
    <td width="13%"><font face="Tahoma" size="2">bordericon</font></td>
    <td width="87%"><font face="Tahoma" size="2">Icons in menus are given 3D borders instead of
      being highlighted. Alone, this makes the menu look like a Microsoft Office menu.</font></td>
  </tr>
  <tr>
    <td width="13%"><font face="Tahoma" size="2">bordertext</font></td>
    <td width="87%"><font face="Tahoma" size="2">The text (or bitmap) of the menu items is given
      a border. Combined with "bordericon", this makes the menu look like an XFree86 menu.</font></td>
  </tr>
  <tr>
    <td width="13%"><font face="Tahoma" size="2">emboss</font></td>
    <td width="87%"><font face="Tahoma" size="2">The icons (and bitmaps) of disabled menu items
      are automatically drawn in an embossed style. You would avoid using this if you wanted to make<br>
      disabled items show up your own way.</font></td>
  </tr>
  <tr>
    <td width="13%"><font face="Tahoma" size="2">reverse</font></td>
    <td width="87%"><font face="Tahoma" size="2">Menu items with bitmaps are reversed when they
      are highlighted.</font></td>
  </tr>
</table>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Tahoma">&nbsp;&nbsp;</font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2">For the
demonstration, we are going to use the bordericon style. The output would end up
like this:</font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Fixedsys">;setting
our popup to have a bordericon style</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Fixedsys">popdll
SetStyle example bordericon</font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2">After
this has been achieve, we can move on to the next step.</font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2"><b><u>Chapter
3: Loading and adding information</u></b></font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2"><b>&nbsp;&nbsp;&nbsp;
</b>We just finished setting up a new popup menu, with a bordericon style to it.
Now, we need to start adding information to our popup. First, we are</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2">going to
load icons to our popup. Make sure all of the icons you wish to use for this
popup are in the appropriate directory for the $ico alias, or else, this</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2">will not
work.</font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Fixedsys">;loading
the &quot;query.ico&quot; icon to our image list</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Fixedsys">loadimg_
example icon small $ico(query)</font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Fixedsys">;loading
the &quot;server.ico&quot; icon to our image list</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Fixedsys">loadimg_
example icon small $ico(server)</font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2">We now
have the 2 icons &quot;basic.ico&quot; and &quot;server.ico&quot; loaded into
our image list. Now, we want to display these icons in our popup menu. For our demonstration,&nbsp;</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2">we are
going to make a small server menu, so when you click on the servers available,
you will connect to the server specified. Onwards:</font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Fixedsys">;adding
the icon &quot;query.ico&quot; to the popup menu</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Fixedsys">additem_
example end +CDd 1 1 Quick Servers</font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Tahoma">A
breakdown on what we just did:</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Tahoma">&nbsp;&nbsp;</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Tahoma">&nbsp;&nbsp;
additem_ example: adding something to our menu (which is called example)</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Tahoma">&nbsp;&nbsp;
end: adds the item to the end of the list</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Tahoma">&nbsp;&nbsp;
+CDd: these are flags you can set when you add the popup item. This is taken
from the Popups.dll readme:</font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Tahoma">&nbsp;Format:
&lt;menu> &lt;pos> [+flags] [unsel#] [sel#] [trans] [text]{cr}[info]</font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<table border="1" width="75%" cellspacing="1">
  <tr>
    <td width="13%"><font face="Tahoma" size="2">&gt;</font></td>
    <td width="87%"><font face="Tahoma" size="2">Item has a submenu. [info] should be the name of the
      submenu.</font></td>
  </tr>
  <tr>
    <td width="13%"><font face="Tahoma" size="2">c</font></td>
    <td width="87%"><font face="Tahoma" size="2">Item starts a new menu column, with no vertical separator</font></td>
  </tr>
  <tr>
    <td width="13%"><font face="Tahoma" size="2">C</font></td>
    <td width="87%"><font face="Tahoma" size="2">Item starts a new menu column, with a vertical separator</font></td>
  </tr>
  <tr>
    <td width="13%"><font face="Tahoma" size="2">d</font></td>
    <td width="87%"><font face="Tahoma" size="2">Item is disabled</font></td>
  </tr>
  <tr>
    <td width="13%"><font face="Tahoma" size="2">D</font></td>
    <td width="87%"><font face="Tahoma" size="2">Item is the default selection (as a result, the text is
      made bold)</font></td>
  </tr>
  <tr>
    <td width="13%"><font face="Tahoma" size="2">x</font></td>
    <td width="87%"><font face="Tahoma" size="2">The item is checked</font></td>
  </tr>
  <tr>
    <td width="13%"><font face="Tahoma" size="2">h</font></td>
    <td width="87%"><font face="Tahoma" size="2">The item is highlighted (this is generally not set)</font></td>
  </tr>
  <tr>
    <td width="13%"><font face="Tahoma" size="2">r</font></td>
    <td width="87%"><font face="Tahoma" size="2">The item is a radio item (the default checkmark is
      displayed as a dot instead of a check)</font></td>
  </tr>
  <tr>
    <td width="13%"><font face="Tahoma" size="2">b</font></td>
    <td width="87%"><font face="Tahoma" size="2">The item does not have text, but instead has a bitmap.
      [text] is the filename of that bitmap.</font></td>
  </tr>
  <tr>
    <td width="13%"><font face="Tahoma" size="2">3</font></td>
    <td width="87%"><font face="Tahoma" size="2">If the 'b' flag is specified, these colors are mapped
      to the 3D system colors:<br>
      &nbsp; R&nbsp;&nbsp;&nbsp;&nbsp; G&nbsp;&nbsp;&nbsp; B<br>
                        128 128 128&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3D shadow color<br>
                        192 192 192&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3D face color<br>
                        223 223 223&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3D light color</font></td>
  </tr>
</table>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Tahoma">&nbsp;&nbsp;</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Tahoma">Now, my
method of storing commands for a custom popup, is to store the information in a
.txt file. How do we load all the information? Simple. We</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Tahoma">are
going to use a while loop.</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Tahoma">&nbsp;&nbsp;&nbsp;</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Fixedsys">;adding the icon "server.ico" to the popup menu and all servers listed in popservers.txt<br>
  var %l = 1&nbsp;<br>
  while (%l &lt;= $lines($txt(popservers))) {&nbsp;<br>
&nbsp; AddItem_ example end + 2 2 $gettok($read($txt(popservers),%l),1,%l) $cr $gettok($txt(popservers),3-,%l)&nbsp;<br>
&nbsp; inc %l&nbsp;<br>
  }<br>
</font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2">Congratulations,
you just added all the information to our popup, with the &quot;server.ico&quot;
icon beside each server name. To add a server, open the&nbsp;</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2">&quot;popservers.txt&quot;
file. The format to add a server is:</font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Fixedsys">Network_Name
$cr server server_address</font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2"><i>Example:</i></font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Fixedsys">DALnet
$cr server misc-e.dal.net</font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2"><b><u>Chapter
4: A few more things, and conclusion</u></b></font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2">&nbsp;&nbsp;&nbsp;
Well, we have loaded information, and added it to our popup. Now where is it?
This is what the pop1 alias is for. It loads the menu at the $mouse.dx&nbsp;</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2">$mouse.dy
co-ordinates.</font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Fixedsys">;displaying
our popup menu</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Fixedsys">pop1
example $mouse.dx $mouse.dy</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Fixedsys">}</font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2">End
Result:&nbsp;&nbsp;&nbsp; </font><img border="0" src="popexample.JPG" width="153" height="93"></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2">Where
can you call a popup? Most scripters that I know that use <b>Popups.dll</b>
often place popups in drop-down menus in their Toolbar. To do this, type
the&nbsp;</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2">following:</font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Fixedsys">on
*:dialog:dialog_name:dclick:id {</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Fixedsys">&nbsp;
if ($did($dname,id).sel == id) { popexample }</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Fixedsys">}</font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2">In
conclusion, <b>Popups.dll</b> isn't a very hard DLL to learn at all. A lot of
people ask me for help with it, so I decided to write this tutorial about it. I
hope that&nbsp;</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2">you
learned a little something from this, instead of just copying the code, and not
reading the rest (yes, these people do exist, my control panel code got&nbsp;</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2">ripped
from a lot of users). If you are a new user to DLL's, ALWAYS consult it's help file
first (I cannot stress this enough). All the answers to your questions&nbsp;</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2">are in
there. And as with this</font> <font face="Tahoma" size="2">tutorial, also refer
back to the readme that came with <b>Popups.dll</b>.</font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2"><b><u>Information:</u></b></font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2"><b>Nickname:</b>
[AFX], SoMeBoDy^SoMeOnE</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2"><b>Channels:</b>
#clan-x-scripterz</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2"><b>Networks:</b>
DALnet</font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2"><b>Script:</b>
AFX v0.1b</font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2"><a href="http://www.ircnick.com/?somebody^someon" target="_blank">Check
out my ircnick.com profile</a></font></p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2"><a href="http://www.mircscripts.org/users/[AFX]/" target="_blank">Check
out my user info on mircscripts.org</a></font></p>
<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="2"><a href="http://www.mircscripts.org/download.php?id=1762&amp;type=1" target="_blank">Need
help with Control Panels? Get my tutorial here!</a></font></p>

</body>

</html>