Hi folks,
thanks to Eros and his super duper fast development I asked for a feature today at work and now, well see yourself.
Btw. Eros, I need a new Ferrari. Any chance to have it delivered by the weekend? ;D
You need the latest release to run this. It's about how to realize script plugins. Here is some sample code (which is attached too):
[code=thinbasic]
' Script plugin sample by Michael Hartlef
uses "Console"
uses "File"
'include %app_sourcepath%+"\plugins\*.tbasicc" <= this does not work,
#include ".\plugins\*.tbasicc" ' this works
Dim MyList() As String
Dim nFiles As Long
dim i,c as long
dim funcname as string
Dim Result As Long
'Get the list of files inside the plugins folder
nFiles = DIR_ListArray(MyList, app_scriptpath+"plugins\", "*.tbasicc", %FILE_ADDPATH)
console_writeline("The plugin directory contains "+nfiles+" files.")
'Now loop through all the files and call a certain function
for i = 1 to nFiles
'Get the function name
funcname = FILE_PATHSPLIT(mylist(i), %Path_File)+"_Func"
'Call the function if it does exist
if function_exists(funcname) then
console_writeline(crlf+"calling "+funcname+"..."+crlf)
call funcname to result
endif
next
console_writeline(CRLF+"Press any key...")
console_waitkey
[/code]
Here is now the code for plugin1 inside the plugins folder
[code=thinbasic]
' Plugin1
function plugin1_Func()
console_writeline("Hello from plugin 1")
end function
[/code]
And of course, plugin number 2
[code=thinbasic]
' Plugin2
function plugin2_Func()
console_writeline("Hello from plugin 2")
console_writeline("Isn't that great? YES!!!!")
end function
[/code]
It is damn easy. Or?
Cu
Michael
Bookmarks