Creating Your Own Plugins
You can create your own plugins to be used with CodeGenie! If you want your plugins released to the public, send them to bofen@bofen.com.
You can make your plugins in Notepad, it doesnt really matter with what, any text editor will do. But after your done making the plugin, you must rename the file to a *.cpi file. All of the different Leading characters are (!, @, or #)... What I mean by Leading characters are the first letter in the code line... If the code line's first character isn't (!, @, or #) then it will be considered a comment. !'s are only used in the first two lines of code. The first line is ! and the name of the plugin, and the second tells CodeGenie if your plugin wants the user to start a new project or append the old one. So the first two lines of code will always look like this:
!Plugin Name Here
!Append
or
!Plugin Name Here
!New
Now the following lines are the actual coding of your plugin... You use "@" as your leading character if you want CodeGenie to prompt the user for information or tell the user information... So lets say you want to ask the user for their name, your code line would look like this:
@InputBox {UserName} "What is your name?", "Enter your name:", "John"
Now lets break that code line down into parts. The first segement @InputBox is telling CodeGenie to prompt the user with an InputBox. {UserName} is the "variable" you want to put the InputBox's data into. So later in your code, you can refer to the user's response. "What is yourname?" is what the InputBox will ask the user. "Enter your name:" is what the caption of the InputBox will be. "John" is the default value. You can also have CodeGenie popup a message to the user by using the @MsgBox command. The following plugin will prompt the user for a message, then it will popup a message right back to the user saying exactly what they inputed...
!Popup Message
!Append
@InputBox {Msg} "Type anything you want below...", "Type
something:", "blah"
@MsgBox "{Msg}"
That plugin won't insert any code into the user's project, all it does is ask for some input, and then popup a message saying exactly what they typed, it's just showing you how you can use InputBox variables in your code and how to popup message box's. Where-ever in your code you enter {Msg} it will replace that with whatever the user inputed. Another command you can use with the Leading character "@" is @ChooseVar which will bring up the Choose Window/Variable prompt asking for the user to select a variable from their code... The following example prompts the user to choose a variable from their code, and then generates the code to put a value of 10 into that variable...
!Add 10
!Append
@ChooseVar {Variable}
#{Variable} = 10
As you can see, I put "{Variable}" after the @ChooseVar command, but what that does is put the variable name that the user chose from the Choose Window/Variable prompt into {Variable}. So where-ever in your code you would use "{Variable}" it would replace that with the variable that the user chose from the Choose Window/Variable prompt. You can also use @Dec or @Const if you want CodeGenie to add needed declarations or constants to the user's Declaration/Constant window... Here's an example how you would use the @Dec and @Const...
@Dec "Public Declare Function SendMessageByString Lib
"user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long,
ByVal wParam As Long, ByVal lParam As String) As Long"
@Const "Public Const WM_SETTEXT = &HC"
You use "#" as your leading character if you want CodeGenie to insert that line of code into the user's code window on CodeGenie. So the following line would add "Kill File$" to the user's code:
#Kill File$
Lets go into more depth, and use the "@" & "#" leading characters to make a plugin that will prompt the user for the filename and then generate code to delete a file:
!Delete a File
!Append
@InputBox {FileName} "What file do you want to delete?", "Enter
file path:", ""
#Kill "{FileName}"
So lets say the user used that plugin and entered "C:\Temp\Temp.txt" for the inputbox, then the plugin would add the following line of code to the user's code window: Kill "C:\Temp\Temp.txt"
In the previous plugin, we used {FileName} as the variable name for the InputBox which means you can use {FileName} anywhere else in your code and it will be replaced with the user's input.
This is an example of a plugin that will convert a list into a string. First it will prompt the user for the name of the list, and then prompt them again for the name of the string they want to put the text into...
!List-To-Text Conversion
!Append
@InputBox {ListBoxName} "What is the name of the listbox you want to convert to a
string?", "Enter name:", "List1"
@InputBox {StringName} "What do you want the name of the string to be that will
contain the listbox's text?", "Enter name:", "MyString$"
#For i = 0 To {ListBoxName}.ListCount - 1
# If i = {ListBoxName}.ListCount - 1 Then
# {StringName} = {StringName} &
{ListBoxName}.List(i)
# Else
# {StringName} = {StringName} &
{ListBoxName}.List(i) & Chr(13) & Chr(10)
# End If
#Next i
So lets say the user ran this plugin, and for the listbox name they entered "List1" and for the string name they entered "MyString$", the plugin would add the following code to their code window...
For i = 0 To List1.ListCount - 1
If i = List1.ListCount - 1 Then
MyString$ = MyString$ & List1.List(i)
Else
MyString$ = MyString$ & List1.List(i) &
Chr(13) & Chr(10)
End If
Next i
This is an example of a plugin that will ask for the user to enter a message to send to an imaginary text field. First it will prompt the user to select the text field's variable name, then it will prompt the user for the text, then it will generate the code, then it will add the decs/consts to the Declaration/Constants window, and then it will bring up a message saying that the code was generated successfully...
!Send Text To a Field
!Append
@ChooseVar {VarName}
@InputBox {TheMsg} "What message do you want to send to the text field?",
"Enter a message:", ""
#Call SendMessageByString({VarName}, WM_SETTEXT, 0&, "{TheMsg}")
@Dec "Public Declare Function SendMessageByString Lib "user32" Alias
"SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long,
ByVal lParam As String) As Long"
@Const "Public Const WM_SETTEXT = &HC"
@MsgBox "The message "{TheMsg}" will be sent to the text field:
{VarName}, when code is executed."
So lets say the user ran this plugin, and for the Variable they chose "TxtField&" and for the message they entered "Hello". The following code would be entered into the user's code window...
Call SendMessageByString(TxtField&, WM_SETTEXT, 0&, "Hello")
So try being imaginative when creating your plugins... Make them do whatever you want!... And if you want them released to the public and available for download from my website, send the plugins to bofen@bofen.com!