The MIRC Workshop
Tutorials, Scripts and Help Files for mIRC

MIRC Workshop mIRC Help Files Scripts & Scripting mIRC Downloads mirc script writer
  File Popups  

On to the Control Popups Examples

Return to the Main MIRC Popups Page

MIRC Popups that relate to files are a fast and easy way to send files or play sounds. Popups to send or play files to a specified person are best placed on the nicklist or query popups. Popups that play a file to a channel are best placed in the channel popups.

The examples given here for mIRC popups has paths and filenames that are only for example purposes. You will need to change the paths and files to match the locations of files in your own system.

Nicklist Popups

DCC Link:
.Chat:/dcc chat $$1
.Send:/dcc send $$1
.-
.Files:
..Picture 1:/dcc send $$1 c:\mirc\files\pic1.jpg
..Picture 2:/dcc send $$1 $mircdir $+ files\pic2.jpg

In the above mIRC popups script example a menu item called 'DCC Link' is added to the nicklist popups. This opens a sub-menu. The Chat option on the sub-menu will request a dcc chat with the nick you selected. The Send option will open a file selection dialog and then offer the file you chose to the person you clicked on.

The File option opens another sub-menu, containing in this example a choice of two named pictures, (pic1.jpg and pic2.jpg). In this example these images are in a subfolder of the mirc folder. The important thing to note is that both files are in the same subfolder despite the two different methods used to give mIRC their location.

The $mircdir identifier used is the location of mIRC on your computer. The code used to send picture 1 would only work for the given path and filename. The script line used for picture 2 would work on any system where a file called pic2.jpg was in a 'Files' subfolder of the mirc folder - no matter where the mirc folder was located.

As a small note, don't name your picture me.jpg or similar. I have been sent dozens of pictures called 'me' and can't remember who any of them are unless I rename them. The best thing is to use a version of your nickname.

The following script is not perfect but may help with the problem of making sure that the picture you send of yourself is well named. Add this to your nicklist popups:

Send My Pic:{
set %receiver $$1
set %pic $dir="Select the pic to send" $mircdir $+ files\*.jpg
if ( %pic == $null ) /halt
set %rename $mircdir $+ files\ $+ $me $+ .jpg
echo -s Selected %pic to send at $time
if ( %pic != %rename ) /copy -o %pic %rename
dcc send %receiver %rename
unset %pic
}

And now I think we should examine what that popup does. Firstly it sets a variable called %receiver with the value of the nickname you selected. Second it asks the user to select a file (with a .JPG extension) and calls the file selected %pic.

Next mIRC checks that the user did select a valid file (%pic) and if not halts all further processing of this script for the moment. Providing a JPEG file was selected mIRC now sets a variable called %rename which is a .JPG file called <your nick>.jpg and is located in the 'files' subfolder of mIRC.

At this point mIRC echoes (displays) a message to your status window that states the filename you selected to send. MIRC now checks that the file selected is not already named <your nick>.jpg and provided it is not copies your selected file to the files subfolder of mIRC as <your nick>.jpg - over-writing any existing file of that name that is there.

Finally, mIRC send this new copy of the picture (<your nick>.jpg) to the person you selected, and then 'forgets' the original name so that the %pic variable is cleared for next time.

The result is that no matter what the original name of the picture you send using this popup, it will be renamed to match your current nick.

Its not a very 'clean' script since if the user changes nicks quite regularly, dozens of variously named copies of a single file could gather. Providing that the 'files' folder specified was never used to hold original files however a simple event script could delete all the .jpg files when you close mIRC each time.

Alternately the renamed files could be created in a temporary folder which an event script could 'housekeep' regularly. In the Events scripts tutorial you can learn how to delete the copy once the file transfer was complete.

Channel Popups

Playing sounds and text files to channel is generally acceptable, provided you do not 'flood' the channel with your input. Keep text files small or at a very slow play rate to avoid flooding.

Play A Text:
.As Echo:/play -e # $dir="select a txt file" $mircdir $+ *.txt 1000
.As Text:/play # $dir="select a txt file" $mircdir $+ *.txt 6000
.As ASCII:/play # $dir="select a txt file" $mircdir $+ *.txt 1000
.-
.Commands:/play -c # $dir="select a txt file" $mircdir $+ *.txt 1000
.-
.Stop It:/play stop

The above script will 'play' text files in various ways.

The 'As Echo' option plays a text file (feeds the text file line by line) as an echo on the status window. There will be a delay of 1000 miliseconds (one second) between the playing of each line of the original text file. This option could be an interesting way to remind the user of information or to display a helpful text.

The 'As Text' option plays the text file that the user selects into the channel for all to see. The delay between lines this time is 6000 miliseconds (6 seconds) to allow some reading time for each line. Text control codes for colour etc. can be used in the text.

The 'As ASCII' is suitable for ASCII Art - pictures made up of characters. This is very similar to the 'As Text' option but the delay rate is lower, only 1 second pause between each line of the text file. This helps keep the picture together but large files will cause flooding.

The 'Commands' option is the most powerful since it will execute the text as if each line were being entered into the editbox of the window. Thus any line beginning with a '/' prefixed command will be executed as a command, not just played as text.

Having made popups for transfering files by dcc link and playing text files it is now time to work with sounds. The following popup script will play sound files to channel.

Play Sounds:
.To self:
..wave:/splay $dir="Pick a wave file" $wavedir $+ *.wav
..midi:/splay $dir="Pick a midi file" $mididir $+ *.mid
..-
..stop:/splay stop
.To chan:
..wave:/sound # $dir="Pick a wave file" $wavedir $+ *.wav
..midi:/sound # $dir="Pick a midi file" $mididir $+ *.mid

The /splay command only plays the file locally (on your computer only). The /sound command plays the file locally and sends a ctcp message to the whole channel that will cause others to hear any file of the same name on their own machine.

MIRC can do a lot with files and directories (folders) aside from the few examples here. It is certainly easy to write text into most files, even INI files, with total control.

One other mIRC command that can be used to good effect in mIRC popups is the /run command. The /run command will run any program you specify, or can even be used to open any file type that has an association with a particular application, such as .txt, .doc, .jpg, .wav files etc.

A mIRC popup that runs your favourite e-mail application is an obvious choice. You could even write a mIRC popups script that acts as a version of the Windows Explorer
Example:
Open File:/run $dir="Choose a file to open" c:\*.*


Back to Main MIRC Popups Page

On to the Control Popups Examples

Back to Top of Page




©1999 The Black Knight
MIRC Workshop
What's New
Site Map
MIRC Links
Link to Us
The Author
IRC chat basics
IRC Chat Use
IRC Warfare
No-Tech Attacks
Floods / Flooding
Nukes / Nuking
Trojans / Trojan
Hacks / Hacking
What's mIRC?
mIRC Set-up
Connect Options
IRC Options
DCC Options
Display Options
General Options
mIRC Basics
Beginner Guide
MIRC Colours
MIRC Commands
MIRC Identifiers
MIRC Variables
MIRC If-Then-Else
Alias Scripts
Popups Scripts
- Text Popups
- Popup Controls
- Files Popups
- Info Popups
Events Scripts
Remotes Scripts
Scripting Applet
Downloads Area

Rate This Site.
 

Copyright ©2001 MIRC Workshop
All rights reserved

Search engine optimisation positioning tutorials| Internet Marketing Consultant

Back To Top