wxBasicscript-Help

noframes
basefunctions.inc
This page describes helpfull functions.
They are written in wxBasicScript, and must be included with the line

    include "/usr/lib/wxbasicscript/basefunctions.inc"

Most functions return a value (string or list ), you can get it like this:

    returnvalue = theFunctionname ( Parameter 1, Parameter2 )

STARTDIR
GetWinIDbyName( name )
cleanup()
xmessage( themessage )
xdialog( xdmsg )
gtkdialog( gtkwindowstring )
writestringtofile( thefile , thestring )
appendstringtofile( thefile , thestring )
writelisttofile( thefile , thelist )
appendlisttofile( thefile , thelist )
readfile( thefile )
readtemplate( thefile )
readfiletolist( thefile )
readfiletail( thefile )
getstartpath()
cutright( thestring , splitter )
cutrightfromleft( thestring , splitter )
cutleft( thestring , splitter )
explode(wholestr,splitter)
removefile( thefile )
removehtml( thestring )
rewritelinks( thestring )
bubblesort( thelist )
Details:
//////////////////////////////////////
// Get the Working Directory (the folder of the wxbs-script)
// This happens automatically at startup.
sets the variable STARTDIR
/////////////////////////////////////////////////////////////////////////
// determines the Window-ID (without leading "0x")
// from the first Window found, that has name as title
function GetWinIDbyName( name )
return winid or 0
//////////////////////////////////////////////////////////////////////
// remove temporary files
sub cleanup()
deletes
/tmp/wxbxdmenu.tmp
/tmp/gtkwindow.script
//////////////////////////////////////////////////////////////////////
// make it easier to run Xmessage
function xmessage( themessage )
return string
//////////////////////////////////////////////////////////////////////
// make it easier to run Xdialog
function xdialog( xdmsg )
return string , string
//////////////////////////////////////////////////////////////////////
// make it easier to run Gtkdialog
function gtkdialog( gtkwindowstring )
return string
//////////////////////////////////////////////////////////////////////
// save string to a file
function writestringtofile( thefile , thestring )
//////////////////////////////////////////////////////////////////////
// append string to a file
function appendstringtofile( thefile , thestring )
//////////////////////////////////////////////////////////////////////
// save list to a file
function writelisttofile( thefile , thelist )
//////////////////////////////////////////////////////////////////////
// append list to a file
function appendlisttofile( thefile , thelist )
//////////////////////////////////////////////////////////////////////
// read in a file to a string
function readfile( thefile )
return string
//////////////////////////////////////////////////////////////////////
// read in a templatefile to a string
// same as readfile() , but adds "\n" (Linefeed) after each line.
function readtemplate( thefile )
return string
//////////////////////////////////////////////////////////////////////
// read in a file to a list
function readfiletolist( thefile )
return list
//////////////////////////////////////////////////////////////////////
// read in last line of a file
function readfiletail( thefile )
return string
////////////////////////////////////////////////////////////////////////////////////
// get the path of this script, so that it will find its resources
// (e.g. Icons)
function getstartpath()
return string
////////////////////////////////////////////////////////////////////////////////////
// return left part of a string, counting the seperator from right
function cutright( thestring , splitter )
return string
////////////////////////////////////////////////////////////////////////////////////
// return left part of a string, counting the seperator from left
function cutrightfromleft( thestring , splitter )
return string
////////////////////////////////////////////////////////////////////////////////////
// return right part of a string, counting the seperator from left
function cutleft( thestring , splitter )
return string
//////////////////////////////////////////////////////////////////////
// explode separates a string using splitter
// and returns the substrings in a list
//
// EXAMPLE:
//
// mystring = "dogs,puppys,cats"
// words = {}
// words = explode( mystring , ",")
// print words[2] // lists start count at 0
function explode(wholestr,splitter)
return list
//////////////////////////////////////////////////////////////////////
// remove/delete a file
function removefile( thefile )
return 1 (if file exists)
return 0
//////////////////////////////////////////////////////////////////////
// delete all HTML-TAGS from a string
function removehtml( thestring )
return string
//////////////////////////////////////////////////////////////////////
// rewrite HTML-TAGS to a shorter style
function rewritelinks( thestring )
return string
//////////////////////////////////////////////////////////////////////
// sort a list alphabetically
function bubblesort( thelist )
return list