Image Uploader Scripting API
|
Namespace containing functions and classes available in squirrel scripts. More...
Classes | |
class | CWebBrowser |
class | Document |
class | FileUploadTaskWrapper |
class | HtmlDocument |
class | HtmlElement |
class | Process |
The Process class is used to start external programs and to communicate with them. More... | |
class | CRegExp |
class | UploadTaskUnion |
class | UploadTaskWrapper |
class | UrlShorteningTaskWrapper |
class | WebServer |
Start a web server listening a port on 127.0.0.1. More... | |
Functions | |
string | AnsiToUtf8 (string str, int codepage) |
string | AskUserCaptcha (NetworkClient *nm, string url) |
Shows the captcha input dialog. More... | |
string | Base64Decode (string data) |
string | Base64Encode (string data) |
bool | CopyFile (string source, string destination, bool overwrite) |
bool | CreateDirectory (string path_, unsigned int mode) |
void | DebugMessage (string msg, bool isResponseBody) |
Shows a dialog box with a diagnostic message. | |
bool | DeleteFile (string utf8Filename) |
string | ExtractFileName (string path) |
string | ExtractFileNameNoExt (string fileName) |
string | ExtractFilePath (string fileName) |
bool | FileExists (string fileName) |
string | GetAppLanguage () |
string | GetAppLanguageFile () |
string | GetAppLocale () |
table | GetAppVersion () |
string | GetCurrentThreadId () |
string | GetDeviceId () |
string | GetDeviceName () |
string | GetFileContents (string filename) |
string | GetFileExtension (string path) |
string | GetFileMimeType (string filename) |
int | GetFileSize (string filename) |
double | GetFileSizeDouble (string filename) |
table | GetImageInfo (string fileName) |
string | GetScriptsDirectory () |
string | GetTempDirectory () |
string | hmac_sha1 (string key, string data, bool base64) |
string | HmacSha1 (string key, string data, bool base64) |
string | HtmlEntitiesDecode (string src) |
object | include (string filename) |
string | InputDialog (string text, string defaultValue) |
string | JsonEscapeString (string src) |
string | Md5 (string data) |
Calculates the md5 hash of a string. More... | |
string | md5 (string data) |
Calculates the md5 hash of a string. More... | |
string | md5_file (string filename) |
Calculates the md5 hash of a given file. More... | |
string | Md5FromFile (string filename) |
Calculates the md5 hash of a given file. More... | |
string | MessageBox (string message, string title, string buttons, string type) |
bool | MoveFileOrFolder (string from, string to) |
object | ParseJSON (string json) |
bool | PutFileContents (string utf8Filename, string content) |
int | Random () |
int | random () |
string | Sha1 (string data) |
string | sha1 (string data) |
string | sha1_file (string filename) |
string | sha1_file_prefix (string filename, string prefix, string postfix) |
string | Sha1FromFile (string filename) |
string | Sha1FromFileWithPrefix (string filename, string prefix, string postfix) |
string | Sha256 (string data) |
string | Sha256FromFile (string filename, int offset, size_t chunkSize) |
bool | ShellOpenUrl (string url) |
void | Sleep (int msec) |
void | sleep (int msec) |
string | ToJSON (object obj) |
string | Translate (string key, string originalText) |
string | url_encode (string value) |
string | UrlEncode (string value) |
string | Utf8ToAnsi (string str, int codepage) |
void | WriteLog (string type, string message) |
Namespace containing functions and classes available in squirrel scripts.
string ScriptAPI::AnsiToUtf8 | ( | string | str, |
int | codepage | ||
) |
Converts a string from ANSI encoding to UTF-8.
You can find the codepage number you need here:
https://raw.githubusercontent.com/zenden2k/image-uploader/master/Source/Core/3rdpart/CodePages.cpp
Available only in Windows.
string ScriptAPI::AskUserCaptcha | ( | NetworkClient * | nm, |
string | url | ||
) |
Shows the captcha input dialog.
nm - network manager, url - address of the image with captcha. The return value is the text entered by the user.
bool ScriptAPI::CreateDirectory | ( | string | path_, |
unsigned int | mode | ||
) |
Creates a directory (recursively). The mode parameter is ignored in Windows.
string ScriptAPI::ExtractFileNameNoExt | ( | string | fileName | ) |
Extract the file name without extension from the path.
string ScriptAPI::ExtractFilePath | ( | string | fileName | ) |
Extract directory name from path.
bool ScriptAPI::FileExists | ( | string | fileName | ) |
Checks if a file exists.
string ScriptAPI::GetAppLanguage | ( | ) |
Returns application's current language. For example : "en", "ru".
string ScriptAPI::GetAppLanguageFile | ( | ) |
Returns name of the application's current language file (without .lng extension). For example: "English", "Russian".
string ScriptAPI::GetAppLocale | ( | ) |
Returns application's current locale. For example : "en_US", "ru_RU".
table ScriptAPI::GetAppVersion | ( | ) |
Returns a table containing information about application's version. For example:
string ScriptAPI::GetCurrentThreadId | ( | ) |
Retrieves the thread identifier of the calling thread.
string ScriptAPI::GetFileContents | ( | string | filename | ) |
string ScriptAPI::GetFileMimeType | ( | string | filename | ) |
Returns the MIME file type (for example, "text / html"), analyzing the contents of the file. File must exist. (in Windows, the FindMimeFromData function is used. In unix, the command 'file -b –mime-type' is used.).
int ScriptAPI::GetFileSize | ( | string | filename | ) |
Returns the size of the file in bytes.
double ScriptAPI::GetFileSizeDouble | ( | string | filename | ) |
table ScriptAPI::GetImageInfo | ( | string | fileName | ) |
Returns a table containing information about image. For example:
string ScriptAPI::GetScriptsDirectory | ( | ) |
Returns path to squirrel scripts directory.
string ScriptAPI::GetTempDirectory | ( | ) |
Returns the directory for temporary files
string ScriptAPI::hmac_sha1 | ( | string | key, |
string | data, | ||
bool | base64 | ||
) |
Generate a keyed hash value using the HMAC method and sha1 hashing algorythm
data | Message to be hashed. |
key | Shared secret key used for generating the HMAC variant of the message digest. |
base64 | Generate in base64 format |
string ScriptAPI::HmacSha1 | ( | string | key, |
string | data, | ||
bool | base64 | ||
) |
Generate a keyed hash value using the HMAC method and sha1 hashing algorythm
data | Message to be hashed. |
key | Shared secret key used for generating the HMAC variant of the message digest. |
base64 | Generate in base64 format |
object ScriptAPI::include | ( | string | filename | ) |
Includes and runs the script from file. filename should be relative to the scripts root directory.
string ScriptAPI::InputDialog | ( | string | text, |
string | defaultValue | ||
) |
Displays a prompt in a dialog box, waits for the user to input text or click a button, and returns a String containing the contents of the text box.
defaultValue | Default text displayed in text box |
string ScriptAPI::JsonEscapeString | ( | string | src | ) |
Escapes a string for use in JSON. Returns a string with quotes.
string ScriptAPI::Md5 | ( | string | data | ) |
Calculates the md5 hash of a string.
string ScriptAPI::md5 | ( | string | data | ) |
Calculates the md5 hash of a string.
string ScriptAPI::md5_file | ( | string | filename | ) |
string ScriptAPI::Md5FromFile | ( | string | filename | ) |
Calculates the md5 hash of a given file.
string ScriptAPI::MessageBox | ( | string | message, |
string | title, | ||
string | buttons, | ||
string | type | ||
) |
Shows a dialog box with a message
buttons possible values: OK, YES_NO, YES_NO_CANCEL, ABORT_RETRY_IGNORE,CANCEL_TRY_CONTINUE, OK_CANCEL, RETRY_CANCEL
type possible values: EXCLAMATION, WARNING, INFORMATION, QUESTION, ERROR
bool ScriptAPI::MoveFileOrFolder | ( | string | from, |
string | to | ||
) |
Renames/moves a file or folder.
object ScriptAPI::ParseJSON | ( | string | json | ) |
Converts text containing a JSON document, into a table (associative container made in the form of key / value pairs) or an array. For example, the original JSON document:
Squirrel script:
bool ScriptAPI::PutFileContents | ( | string | utf8Filename, |
string | content | ||
) |
Write data to a file
int ScriptAPI::Random | ( | ) |
Returns a random number.
int ScriptAPI::random | ( | ) |
string ScriptAPI::Sha1 | ( | string | data | ) |
Calculates the sha1-hash of a given string
string ScriptAPI::sha1 | ( | string | data | ) |
string ScriptAPI::sha1_file | ( | string | filename | ) |
Calculates the sha1-hash of a given file
string ScriptAPI::sha1_file_prefix | ( | string | filename, |
string | prefix, | ||
string | postfix | ||
) |
Calculates the sha1-hash of a given file, prepeding file with prefix and adding postfix at the end while calculating hash
string ScriptAPI::Sha1FromFile | ( | string | filename | ) |
Calculates the sha1-hash of a given file
string ScriptAPI::Sha1FromFileWithPrefix | ( | string | filename, |
string | prefix, | ||
string | postfix | ||
) |
Calculates the sha1-hash of a given file, prepeding file with prefix and adding postfix at the end while calculating hash
string ScriptAPI::Sha256 | ( | string | data | ) |
Calculates the sha256-hash of a given string
string ScriptAPI::Sha256FromFile | ( | string | filename, |
int | offset, | ||
size_t | chunkSize | ||
) |
Calculates the sha256-hash of a given file
bool ScriptAPI::ShellOpenUrl | ( | string | url | ) |
Opens a URL/file in a standard browser/associated application.
void ScriptAPI::Sleep | ( | int | msec | ) |
The script falls asleep for the specified number of milliseconds.
void ScriptAPI::sleep | ( | int | msec | ) |
The script falls asleep for the specified number of milliseconds.
string ScriptAPI::Translate | ( | string | key, |
string | originalText | ||
) |
Returns text translated into the currently selected language. Every user-visible string in the script must be wrapped into this function. Translating scripts into different languages
string ScriptAPI::url_encode | ( | string | value | ) |
URL-encodes string. This function is convenient when encoding a string to be used in a query part of a URL.
Use NetworkClient's nm.urlEncode() when possible instead.
string ScriptAPI::UrlEncode | ( | string | value | ) |
URL-encodes string. This function is convenient when encoding a string to be used in a query part of a URL.
Use NetworkClient's nm.urlEncode() when possible instead.
string ScriptAPI::Utf8ToAnsi | ( | string | str, |
int | codepage | ||
) |
Converts a string from ANSI encoding to UTF-8.
You can find the codepage number you need here:
https://raw.githubusercontent.com/zenden2k/image-uploader/master/Source/Core/3rdpart/CodePages.cpp
Available only in Windows.
void ScriptAPI::WriteLog | ( | string | type, |
string | message | ||
) |
type | message severity (possible values: "error", "warning", "info") |