Tried to create this function, but it doesn't work. Tried different approcaches and it doesn't work. *grrr*

What am I doing wrong?
Code:
...
BtnBold:
PasteBBCode := SetBBCodeTags([b],[/b], BoldPressed)
Control, EditPaste, %PasteBBCode%, Edit1, %ScriptName%
Return
...
SetBBCodeTags(In_StartTag, In_EndTag, In_BtnVariable)
{
; In_StartTag : Opening bbcode tag (e.g. [url])
; In_EndTag : Closing bbcode tag (e.g. [/url])
; In_BtnVariable : Associated button variable (e.g. URLPressed)
local Ret_Val
;Check whether some text was highlighted
GuiControl, 1:Focus, EdtComment
Send, ^c
; No Text was highlighted
If Clipboard is Space
{
If In_BtnVariable = 0
{
In_BtnVariable++
Return, %In_StartTag%
}
If In_BtnVariable = 1
{
In_BtnVariable--
Return, %In_EndTag%
}
}
; Some text was highlighted
Else
{
Ret_Val = %In_StartTag%%Clipboard%%In_EndTag%
Clipboard =
Return, %Ret_Val%
}
}
btw. I discovered a small bug in BBCodeWriter in combination with the new "AlwaysOnTop" button. Preferences GUI, Help GUI and About GUI are not set "AlwaysOnTop".
When you call one of this gui's it gets behind the main gui but this one is disabled. I'll correct it with the next version.
Cheers
AGU a.k.a. AGermanUser