Non-IM Contact

From Miranda NG
Plugin:NimContact/pl
Jump to navigation Jump to search
This page is a translated version of the page Non-IM Contact and the translation is 2% complete.
Non-IM Contact
Brak zdjęcia
Nazwa pliku NimContact.dll
Autor Jonathan Gordon
Pobierz
Wersja stabilna: 32-bit, 64-bit
Wersja rozwojowa: 32-bit, 64-bit

Pozwala dodać "kontakty", które mogą działać jako skróty do innych programów lub linki do stron internetowych. Nazwy kontaktów można odczytywać z pliku tekstowego (w tym dowolnego pliku ASCII).

Example

Lets say you are lazy and want to be able to load up the c:\ drive by double clicking a contact in your contact list. So what you do to set this up is create a new contact (from the main menu), give the contact a name, then in the "Link and contact list settings" tab, type c:\ into the link field.

This is the very simplest way of using Non-IM Contact.

Now lets take this contact 1 step further. Lets say you have a script that you have scheduled to run every 30 minutes or so that prints the available disk space into a text file. This script prints something like this:

Last Updated: 5/17/2004 7:04:13 PM

C:
Fixed : NTFS
25.35gb
6.13gb
19.5%
80.5%
[++========]
Non-IM contact example.jpg

into a txt file. So, what can we do with information?

Lets set our contact to display as its nick the available disk space on the drive (i.e it would look like "C:\ 25.35gb free"). All we need to do is load the file in the "files" tab then type something like this into the "display Name" field "file(0)wholeline(line(2))\ file(0)wholeline(line(4)) free".

This may look cryptic but it really is very simple (see Explanation of variables below).

Detailed explanation of Non-IM Contact settings

"Contacts display info" tab

  • "Contacts display name" — this is the only compulsary field. This is what the contact will display as their nick.
  • "Contacts tooltip" — this isn't really their tooltip, the info you type here after being replaced with info from the files gets copied into the user "notes" field in their "user info" display, so you can use this is mtooltip with the %notes variable.

"Link and contact list settings" tab

  • "Link" — the file to load/ program to run/ web page to open etc, when you double click the contact.
  • "program parameters" — any parameters for the program.
  • "status icon" — the contacts status icon.

"Timer settings"

  • "use timer" — if this is set then the contact can be updated using the timer.
  • the blank text field... the number of intervals between checking... the intervals are set in the options... (default of 1 second).

"Copy contact"

This dialog is explained below.

"Files"

Here is a list of all the available files (and eventually web pages) that you can use in all the contacts. the %fn ID box shows the text to type to use the file. The big text box shows the contents and line numbers of the file, and the drop list has a list of availablew files.

"Options" window

  • "ignore global status change" — with this set, nimc will only change status if manually set (using the status bar icon, or status menu).
  • "aways as another status" — changes the way away status works. if set then only contacts with away set as their icon will be displayed when the protocol chnages to away, and timer wont be turned off otherwise away acts the same as online but with the timer off).
  • "disable timer" — disables the timer, no web pages or contacts will be updated if this is checked.
  • "timer interval" — this is the global timer interval. the individual contact timers are a multiple of this timer. so if this is set to 15 and a contacts individual timer is set to 3, then that contact will be updated every 45 seconds. (same for web pages).

"String maker" window

  • "string to test" — you can type anything here, when you press Test String this string will get parsed and the result will be displayed in the other edit box.
  • the row of varables is used to tell you which variable you are in.

Explanation of variables

lastchecked(file(X)) — displays the time and date the file was last modified (DD/MM/YY HH:MM) (X is the file number).

Ważne
For the next variables the "" marks are compulsary. If they are not there it won't work as expected.

The following are all done after the string has been complety replaced, and compare(..) is done the very last.

compare("A","B","X","Y") — what this does is after all the strings have been replaced it compares A and B, if they are the same then X will get inserted into the final string, otherwise Y will be inserted (this is the last variable that is checked so u can put file(x)start(.....)...) inside it and it will work the way you want it to).

save("A","B") — this saves whatever B is to a db variable named A in the contact's "NIM_Contact" module.

load("A") — this loads the setting A from the contact and inserts it into the string.

saveN("A","B","C","D") — this is the same as save(...) except it lets you save to the setting contact in the database. A is module, B is setting, C is value, D is type (0 or b = byte, 1 or w = word, 2 or d = dword, 3 or s = string). An examlpe use of this might be to wright a quick script that spits out the name of a picture (from a defined list) and it will set your contact list background picture to it.

loadN("A","B") — same as load(...) except it loads from the settings contact from the module A and setting B.

filename(X) — displays the filename of the Xth file in the files tab.

file(X)start(line(...)...)end(line(...)...) or file(X)wholeline(line(...)) — each string replace thingy.

file(X) — choose which file to read from. start(...) and/or end(...) must follow. You can use both, or only 1 of them. If you use both start MUST be before end. Or you can follow file() with wholeline(line(...)), which as you can guess will display the entire line.

start(line(...)X) where X is either a number, or s string in "" marks, or the csv() variable (we will get to the line() part in a minute)

  • If X a number then it will start or finish copying from the Xth character in the line (remember, 0 is the frst char).
  • If X is a string inside "" marks, then the line will be searched for the string and either start or stop copying depening if you are in start() or end().
  • If X is csv(seperatorY) then the line is expected a comma seperated variable list (or similar). The seperator must either be "tab" (for tab seperated list), "space" (for space seperated list), or any SINGLE character (e.g , or ;). And Y is which variable to start or finish copying from.

line(...) — very similar to start() and end() with some slight changes. line(X) where X is a number, string in "" marks, or lastline(...)

  • If X is a number then the rest of the start() or end() or wholeline() will use the Xth line of the file (remember 0 is the first line).
  • If X is a string it will search through the file (starting from the first line if in start() or wholeline() OR the line used by start() if in end() and will use the first line with the string if it is found.
  • You can add a +Y or -Y after the closing ) to go Y lines up (- sign) or down (+ sign) from the line found (e.g. ...line("hello")+5... will find the word hello and use the 5th line after it).
  • If X is lastline(Y) then it will use the line Y lines up from the last line of the file. (e.g 0 or blank is the very last line of the file, 1 is the 2nd last line)

Examples

  • filename(0) — will display the filename of the 0th file.
  • file(0)wholeline(line(0)) — will display the whole first line of the 0th file.
  • file(0)wholeline(line("hello")-1)) — the wholeline above the first occurance of \"hello\" in the file.
  • file(0)start(line(lastline(1))csv(tab2))end(line(lastline())csv(tab4)) — starts at the 2nd last line of the file, from the 2nd tab variable, untill the 4th tab variable in the last line (in the 0th file).
  • file(0)start(line("hello")+1"zzzz")end(line(6)17)) — starts from the first occurance of zzzz in the line after the first occurance of hello, untill the 17th character in the 6th line (starting from line 0) of the 0th file.
Wskazówka
Every editable text field (except "Group" field) can use these strings.

The "Copy contact" dialog

The Edit box in this window lets you automatically change any string in the new contact. i.e this lets you change all occurances of %fn2 to %fn3 in the contacts settings (i.e their name, tooltip, etc). The way you do is like this. If you want to change fn2 to fn3 you type fn2,fn3 in the box. ONE PER LINE. And make sure you dont forget the , or Miranda may crash, and WILL KILL YOUR DB IF IT DOES. You can do a maximum of 15 of the replaces.

Press Copy Non-IM contact to copy with the replaced strings.

To export the single contact to a txt file press export contact.

Tooltip stuff

If you want to actually use the "Tooltip" field then you'll need tooltip plugin.

Non-IM Contact copies the string (after having all the variables replaced) from the "Tooltip" field into the "Notes" field in the contacts "User details" window. You can use the variable %notes to display this.

Non-IM Contact also copies the program (or link) that the contact points to when you double click it as the contacts "First Name" field in the contacts "User details" window. You can use the variable %first to display this.

Contact status icon

You can separate contacts by thier status icons, and you can quickly differentiate between different "types" of contacts (you can set all web links to one icon, and all local folders to another, etc.)

  • ONLINE icon — this contact will always be displayed as online unless the plugin's status is set to offline.
  • AWAY icon — same as online (unless you choose to use away as any other status, i.e contacts won't be online if not set to away).
  • all other icons means only display this contact if the plugins' status is set to that status or set to away or online.

Plugin status's

If the plugins' status is:

  • ONLINE — all contacts are displayed and the timer is ON (so names get updates).
  • AWAY — all contacts are displayed and the timer is OFF (so names don't get updates unless you choose to use away as any other status).
  • OFFLINE — all contacts are displayed as offline and the timer is OFF (so names don't get updates).
  • other — only contacts set to online, away or the set status are shown as not offline and the timer is ON (so names get updates).

Last minute stuff to remember

  • If you hold Ctrl+ when you double click a contact it will open the contacts settings (this also happens if no link is set).
  • the file(X) variable is "global" in that all contacts with file(X) will be reading the same file. This also means that if you remove the file(X) file from the list, then all other files will get pushed up and any contact with file(X) set will be reading the new file, not the one you were expecting.

Important notes on web pages

  • in the files tab you can enter urls into the URL box, it must be the full url. i.e https://www.miranda-ng.org (nothing happens if the url doesnt work).
  • web pages can then be used as any of file.
  • the files are downloaded into the \plugins dir with the filename fnX.html where X is the %fn number in the plugin. Files aren't deleted when you remove the link.