hallo ich hab mal wieder eine frage ob etwas möglich ist
Ich möchte in eine Edit Feld eine bild einfügen anstelle von einem Text ,im genauen handelt es sich um eine Chat in den ich zusätzlich zum Namen ein Avatar möchte .
Online habe ich nix gefunden deshalb frage ich mal direkt ob jemand sowas schon versucht hat
Bild in ein EDIT einfügen Topic is solved
Moderator: jNizM
Bild in ein EDIT einfügen
verwende AutoHotkey104805 ------------------------UPDATE auf ..1.1.33.02 erfolgreich , jetzt kommen neue Probleme
Re: Bild in ein EDIT einfügen
Moin,
wenn Du das Edit auch interaktiv für die Texteingabe nutzen willst, ist es vielleicht möglich, aber sehr aufwändig. Warum muss es innerhalb des Edits sein?
wenn Du das Edit auch interaktiv für die Texteingabe nutzen willst, ist es vielleicht möglich, aber sehr aufwändig. Warum muss es innerhalb des Edits sein?
Re: Bild in ein EDIT einfügen
moin , naja es handelt sich ja um einen Chat und da sollte der Avatar schon neben oder über dem Namen stehen , es ist das irc script von bentschie https://github.com/G33kDude/Socket.ahk/blob/master/Examples/IRC.ahk
Code: Select all
#NoEnv
SetBatchLines, -1
#Include ..\Socket.ahk
Random, Rand, 1000, 9999
Serv := ["chat.freenode.net", 6667]
Chan := "#ahk"
Nick := "Socket" Rand
; Create the Gui
Gui, Margin, 5, 5
Gui, Add, Edit, w640 h240 ReadOnly hWndhLog
Gui, Add, Edit, w640 h240 ReadOnly hWndhChat
Gui, Add, Edit, w580 h20 vMessage
Gui, Add, Button, x+m yp-1 w55 h22 gSubmit Default, Submit
GuiControl, Focus, Message
Gui, Show
; Create the IRC client class instance
Client := new IRC()
Client.hLog := hLog
Client.hChat := hChat
Client.Connect(Serv, Nick)
Client.SendText("JOIN " Chan)
return
GuiClose()
{
ExitApp
}
Submit()
{
global Client, Chan, hChat
; Get the message box contents and empty the message box
GuiControlGet, Message
GuiControl,, Message
Client.SendText("PRIVMSG " Chan " :" Message)
EditAppend(hChat, Chan " <" Client.Nick "> " Message)
}
; Use the windows API to append text to an edit control quickly and efficiently
EditAppend(hEdit, Text)
{
Text .= "`r`n"
GuiControl, -Redraw, %hEdit%
SendMessage, 0x00E, 0, 0,, ahk_id %hEdit% ; WM_GETTEXTLENGTH
SendMessage, 0x0B1, ErrorLevel, ErrorLevel,, ahk_id %hEdit% ; EM_SETSEL
SendMessage, 0x0C2, False, &Text,, ahk_id %hEdit% ; EM_REPLACESEL
SendMessage, 0x115, 7, 0,, ahk_id %hEdit% ; WM_VSCROLL SB_BOTTOM
GuiControl, +Redraw, %hEdit%
}
class IRC extends SocketTCP
{
static Blocking := False
static Buffer, hLog, hChat
Connect(Address, Nick, User:="", Name:="", Pass:="")
{
this.Nick := Nick
this.User := (User == "") ? Nick : User
this.Name := (Name == "") ? Nick : Name
Socket.Connect.Call(this, Address)
if (Pass != "")
this.SendText("PASS " Pass)
this.SendText("NICK " this.Nick)
this.SendText("USER " this.User " 0 * :" this.Name)
}
SendText(Text, Encoding:="UTF-8")
{
EditAppend(this.hLog, ">" Text)
; Because we're overriding SendText, we have
; to use the SendText from the base class.
SocketTCP.SendText.Call(this, Text "`r`n",, Encoding)
}
OnRecv()
{
; Read the incoming bytes as ANSI (single byte encoding)
; so we won't accidentally destroy partial UTF-8 multi-byte sequences.
this.Buffer .= this.RecvText(,, "CP0")
; Split the buffer into one or more lines, putting
; any remaining text back into the buffer.
Lines := StrSplit(this.Buffer, "`n", "`r")
this.Buffer := Lines.Pop()
for Index, Line in Lines
{
; Convert to UTF-8 now that we have a full line.
; Because we read until the end of the line,
; we know there won't be any partially read sequences.
VarSetCapacity(ConvBuf, StrPut(Line, "CP0"))
StrPut(Line, &ConvBuf, "CP0")
Line := StrGet(&ConvBuf, "UTF-8")
EditAppend(this.hLog, "<" Line)
this.ParseLine(Line)
}
}
ParseLine(Line)
{
IRCRE := "O)^(?::(\S+?)(?:!(\S+?))?(?:@(\S+?))? )?" ; Nick!User@Host
. "(\S+)(?: (?!:)(.+?))?(?: :(.+))?$" ; CMD Params Params :Message
if !RegExMatch(Line, IRCRE, Match)
EditAppend(this.hLog, "PARSING ERROR")
; Call the class method by the name OnCMD
this["On" Match[4]](Match)
}
OnNICK(Match)
{
if (Match[1] == this.Nick)
this.Nick := Match[6]
}
OnPING(Match)
{
this.SendText("PONG :" Match[6])
}
OnPRIVMSG(Match)
{
EditAppend(this.hChat, Match[5] " <" Match[1] "> " Match[6])
}
}
verwende AutoHotkey104805 ------------------------UPDATE auf ..1.1.33.02 erfolgreich , jetzt kommen neue Probleme
Re: Bild in ein EDIT einfügen
Naja, und woher bekommt Dein Chatskript das Bild?
Re: Bild in ein EDIT einfügen
z.b aus einem Verzeichnis auf der platte oder erst herunterladen und dann ist es ja auf der Festplatte
verwende AutoHotkey104805 ------------------------UPDATE auf ..1.1.33.02 erfolgreich , jetzt kommen neue Probleme
Re: Bild in ein EDIT einfügen
niemand eine Idee ?
verwende AutoHotkey104805 ------------------------UPDATE auf ..1.1.33.02 erfolgreich , jetzt kommen neue Probleme
Re: Bild in ein EDIT einfügen
Ich habe leider keine Idee für dich, wenn du an dem Script aber etwas änderst, wäre es toll wenn du es hier teilst, ich habe das Script hier seit 10 Tagen ohne Probleme wie Logoffs am laufen
Re: Bild in ein EDIT einfügen
AFAIK, lassen Controls sich überlappend anlegen, insofern sollte sich doch ein Avatar mittels eines vorangestellten Picture-Control anzeigen lassen? Ähnlich wie Browser Zusatzinformationen (in) der Adresszeile voranstellen.
Re: Bild in ein EDIT einfügen
oder das Edit zum ListView umcoden, dann sind nicht nur Bilder möglich, habe es schon versucht, aber da geht mit meinen begrenzten Fähigkeiten garnichts
Re: Bild in ein EDIT einfügen Topic is solved
Hallo , da mit hier schon so viele geholfen haben wollte ich auch mal was posten was eventuell jemand verwenden kann .
ich habe dem Skript von Bertschi ein ListView und Bilder hinzugefügt so das jeder Chat Teilnehmer auch einen Avatar haben kann .
Die beiden Edit felder habe ich nur Deaktiviert sie können jederzeit wieder Aktiviert werden .
in zeile 62 und zeile 155 werden die daten an das ListView übergeben .
würde man nun das Skript mit 10 festen Avataren ausstatten könnte man beim senden seine Avatar Nummer mit senden
und der Empfänger würde diesen mit StrSplit aus der Nachricht raus holen und als richtigen Avatar einfügen .(nur eine Idee)
Hoffe konnte jemanden mit dem Skript helfen
ich habe dem Skript von Bertschi ein ListView und Bilder hinzugefügt so das jeder Chat Teilnehmer auch einen Avatar haben kann .
Die beiden Edit felder habe ich nur Deaktiviert sie können jederzeit wieder Aktiviert werden .
in zeile 62 und zeile 155 werden die daten an das ListView übergeben .
würde man nun das Skript mit 10 festen Avataren ausstatten könnte man beim senden seine Avatar Nummer mit senden
und der Empfänger würde diesen mit StrSplit aus der Nachricht raus holen und als richtigen Avatar einfügen .(nur eine Idee)
Hoffe konnte jemanden mit dem Skript helfen
Code: Select all
#NoEnv
SetBatchLines, -1
#Include Socket.ahk
Img := "C:\Windows\Web\Wallpaper\Windows\img0.jpg"
Img1 := "C:\Windows\System32\ApproveChildRequest.exe"
ImgW := 30 ; Breite der Bilder
ImgH := 30 ; Höhe der Bilder
HIL := IL_Create()
IL_SetSize(HIL, ImgW, ImgH)
IL_Add(HIL, Img, 0xFFFFFF, 1)
IL_Add(HIL, Img1, 0xFFFFFF, 2)
Gui, Add, ListView,Background2d3237 ca3aab9 -Hdr -Multi w640 h240 ReadOnly hWndhLog vLV, Bild|Text
LV_SetImageList(HIL, 1)
LV_ModifyCol(1, ImgW + 4)
IL_SetSize(ILID, W, H) {
Return DllCall("ComCtl32.dll\ImageList_SetIconSize", "Ptr", ILID, "Int", W, "Int", H, "Int")
}
;########################################################################
Random, Rand, 1000, 9999
Serv := ["chat.freenode.net", 6667]
Chan := "#meintestkanal"
Nick := "Socket" Rand
; Create the Gui
Gui, Margin, 5, 5
;Gui, Add, Edit, w640 h240 ReadOnly hWndhLog
;Gui, Add, Edit, w640 h240 ReadOnly hWndhChat
Gui, Add, Edit, w500 h20 vMessage
Gui, Add, Button, x+m yp-1 w55 h22 gSubmit Default, Submit
GuiControl, Focus, Message
Gui, Show
LV_Add("Icon0", "", "ONLINE") ;STATUS
; Create the IRC client class instance
Client := new IRC()
Client.hLog := hLog
Client.hChat := hChat
Client.Connect(Serv, Nick)
Client.SendText("JOIN " Chan)
return
GuiClose()
{
ExitApp
}
Submit()
{
global Client, Chan, hChat
; Get the message box contents and empty the message box
GuiControlGet, Message
GuiControl,, Message
Client.SendText("PRIVMSG " Chan " :" Message)
EditAppend(hChat, Chan " <" Client.Nick "> " Message)
LV_Add("Icon2", "",Client.Nick ":`n" Message) ; ############################### Das was man sendet
;msgbox, % Message
}
; Use the windows API to append text to an edit control quickly and efficiently
EditAppend(hEdit, Text)
{
Text .= "`r`n"
GuiControl, -Redraw, %hEdit%
SendMessage, 0x00E, 0, 0,, ahk_id %hEdit% ; WM_GETTEXTLENGTH
SendMessage, 0x0B1, ErrorLevel, ErrorLevel,, ahk_id %hEdit% ; EM_SETSEL
SendMessage, 0x0C2, False, &Text,, ahk_id %hEdit% ; EM_REPLACESEL
SendMessage, 0x115, 7, 0,, ahk_id %hEdit% ; WM_VSCROLL SB_BOTTOM
GuiControl, +Redraw, %hEdit%
}
class IRC extends SocketTCP
{
static Blocking := False
static Buffer, hLog, hChat
Connect(Address, Nick, User:="", Name:="", Pass:="")
{
this.Nick := Nick
this.User := (User == "") ? Nick : User
this.Name := (Name == "") ? Nick : Name
Socket.Connect.Call(this, Address)
if (Pass != "")
this.SendText("PASS " Pass)
this.SendText("NICK " this.Nick)
this.SendText("USER " this.User " 0 * :" this.Name)
}
SendText(Text, Encoding:="UTF-8")
{
EditAppend(this.hLog, ">" Text)
; Because we're overriding SendText, we have
; to use the SendText from the base class.
SocketTCP.SendText.Call(this, Text "`r`n",, Encoding)
}
OnRecv()
{
; Read the incoming bytes as ANSI (single byte encoding)
; so we won't accidentally destroy partial UTF-8 multi-byte sequences.
this.Buffer .= this.RecvText(,, "CP0")
; Split the buffer into one or more lines, putting
; any remaining text back into the buffer.
Lines := StrSplit(this.Buffer, "`n", "`r")
this.Buffer := Lines.Pop()
for Index, Line in Lines
{
; Convert to UTF-8 now that we have a full line.
; Because we read until the end of the line,
; we know there won't be any partially read sequences.
VarSetCapacity(ConvBuf, StrPut(Line, "CP0"))
StrPut(Line, &ConvBuf, "CP0")
Line := StrGet(&ConvBuf, "UTF-8")
EditAppend(this.hLog, "<" Line)
this.ParseLine(Line)
}
}
ParseLine(Line)
{
IRCRE := "O)^(?::(\S+?)(?:!(\S+?))?(?:@(\S+?))? )?" ; Nick!User@Host
. "(\S+)(?: (?!:)(.+?))?(?: :(.+))?$" ; CMD Params Params :Message
if !RegExMatch(Line, IRCRE, Match)
EditAppend(this.hLog, "PARSING ERROR")
; Call the class method by the name OnCMD
this["On" Match[4]](Match)
}
OnNICK(Match)
{
if (Match[1] == this.Nick)
this.Nick := Match[6]
}
OnPING(Match)
{
this.SendText("PONG :" Match[6])
}
OnPRIVMSG(Match)
{
EditAppend(this.hChat, Match[5] " <" Match[1] "> " Match[6])
LV_Add("Icon1", "", Match[1]":`n" Match[6]) ; ############################### Das was man sendet
}
}
- Attachments
-
- chat.jpg (19.5 KiB) Viewed 605 times
verwende AutoHotkey104805 ------------------------UPDATE auf ..1.1.33.02 erfolgreich , jetzt kommen neue Probleme
Who is online
Users browsing this forum: No registered users and 91 guests