Here is the txt file accompagning the dll version 0.07 (by mark307):
FIXME: Broken English
Macro Utilities Plugin
Version 0.0.7
* Summary
This plugin contains some commands to use in macros.cfg.
* Install
Just copy "utils.dll" to kplugins folder.
* Uninstall
Delete "utils.dll".
* How to use
** file IO
# check whether file is exist
# returns "true" or "false"
$result = pluginmsgex(utils, "exist", $file, STRING);
# copy file
pluginmsg(utils, "copyfile", $from, $to);
# rename file
pluginmsg(utils, "rename", $from, $to);
# delete file
pluginmsg(utils, "unlink", $file);
# read text from file and return them.
# if file isn't exist, this returns "".
$text = pluginmsgex(utils, "read", $file, STRING);
# write text to file
# if file is exist, file will be replaced.
pluginmsg(utils, "write", $file, $text);
# append text to file
# if file isn't exist, file will be created.
pluginmsg(utils, "append", $file, $text);
# make directory
# returns "true" or "false"
$result = pluginmsgex(utils, "mkdir", $path, STRING);
** Dialog
# show the file open dialog by GetOpenFileName Win32 API.
$name = pluginmsgex(utils, "GetOpenFileName", $default, STRING);
# show the file save dialog by GetSaveFileName Win32 API.
$name = pluginmsgex(utils, "GetSaveFileName", $default, STRING);
# show the folder select dialog by SHBrowseForFolder Win32 API.
$name = pluginmsgex(utils, "SelectDirectory", $default, STRING);
** OS
# read registory
# key is like "HKCU\\Software\\K-Meleon\\K-Meleon\\General\\InstallDir"
$value = pluginmsgex(utils, "RegRead", $key, STRING);
# get environment variable
$value = pluginmsgex(utils, "getenv", $name, STRING);
# execute program and wait for process termination
# unit of timeout is millisecond.
# timeout must be greater than -1 and less than 10000 (10sec)
# if timeout is -1, it waits 10000 (10sec).
pluginmsg(utils, "exec", $command, $timeout);
# wait
# timeout must be greater than zero and less than 10000 (10sec)
pluginmsg(utils, "sleep", $timeout);
# Get OS Version
# Gets os version by GetVersionEx Win32API
# Field is "Major", "Minor", "Build", "Platform", "CSD", or "".
# These are associated with dwMajorVersion, dwMinorVersion,
# dwBuildNumber, dwPlatformId, szCSDVersion, or all.
$value = pluginmsgex(utils, "GetOSVer", $field, STRING);
# useful idiom: 9X or NT
$os = pluginmsgex(utils, "GetOSVer", "Platform") == 2 ? "NT" : "9X";
# Get current time
# format is same as strftime C function
# see
http://msdn2.microsoft.com/en-us/library/fe06s4ak.aspx
$result = pluginmsgex(utils, "strftime", $format);
** string
# convert Windows charset to UTF8
$utf8 = pluginmsgex(utils, "EncodeUTF8", $text, STRING);
# convert UTF8 to Windows charset
$text = pluginmsgex(utils, "DecodeUTF8", $utf8, STRING);
# URL escaping
$escaped = pluginmsgex(utils, "urlescape", $text, STRING);
* How to add command
1. Select command type
- pluginmsg
two arguments, no return value
- pluginmsgex
one argument, one return value
Arguments are always pointer of char (or NULL).
If you choose pluginmsg, jump to 3.
If you choose pluginmsgex, continue.
2. Select type of return value.
- BOOL
same as int
- INT
same as int
- STRING
same as pointer of char
If you choice STRING, you have to assign a return value by malloc.
3. Write a function.
4. Add your function to struct funcs in utils.cpp.
First member is command name.
Second member is command type.
If command type is pluginmsg, this member must be TYPE_MSG.
If command type is pluginmsgex, this member must be TYPE_MSGEX.
Third member is the function you write.
5. Build and test.
* License
This software is distributed under GPL (see COPYING).
A+