Ah, ok. Bin erst das 2. Jahr in der Telefonie unterwegs und auch nicht sehr oft hier drin.Klar, warum auch nicht. Schau an, was ich so manchmal weit abseits von weiß und auch von grau hier an Code und Möglichkeiten schreibe. Es steht noch da und wird gefunden![]()
Ich habe jetzt noch positives Feedback bekommen wo es getestet wurde.
Daher stelle ich es jetzt hier als .ahk Datei zur Verfügung.
Jeder kann so mit einem Editor prüfen oder prüfen lassen dass da kein unerlaubtes Zeug drin ist und es ggf. noch verbessern bzw anpassen.
Um es zu nutzen braucht ihr von https://www.autohotkey.com/ die Version 1.1, könnte aber auch 2.0 installieren und der stellt fest dass es Syntax von 1.1 ist. Wenn auf einem Rechner AHK installiert ist könnte ihr damit dann auch in eine .exe umwandeln und dann das Script ohne AHK Installation auf anderen Rechnern nutzen. Weil die EXE unbekannt ist wird der Virenscanner dann meckern und prüfen. Bei mir ist die Prüfung dann ok und wird ohne Ausnahme zu erstellen akzeptiert.
Ich habe es mir in die Autostart gelegt.
Warum AHK? - Weil ich damit privat mal angefangen hatte programmieren zu lernen und fast alle meine Helfer damit kreiere. Daher wirkt das Script vielleicht auch nicht sonderlich professionell aber es tut seinen Dienst.
Sehe gerade als .ahk lässt es sich nicht anfügen. Den Code unten in Notepad speichern und dann Endung von .txt in .ahk ändern.
Code:
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#persistent
#notrayicon
coordmode, mouse, screen
coordmode, tooltip, screen
;WinMove, ahk_exe 3CXSoftphone.exe, , 0, 0, 600, 800
;WinMove, ahk_exe 3CXSoftphone.exe, , , , 600, 800
WinWait, ahk_exe 3CXSoftphone.exe
wingetpos, 3CXSoftphone_X, 3CXSoftphone_Y, 3CXSoftphone_Width, 3CXSoftphone_Height, ahk_exe 3CXSoftphone.exe
if (3CXSoftphone_X <= 0)
winmove, ahk_exe 3CXSoftphone.exe, , 0
if (3CXSoftphone_Y <= 0)
winmove, ahk_exe 3CXSoftphone.exe, , , 0
Loop
{
WinWaitActive, ahk_exe 3CXSoftphone.exe
settimer, Mouse_Control,50
;msgbox, Timer an
WinWaitNotActive, ahk_exe 3CXSoftphone.exe
settimer, Mouse_Control, off
;msgbox, Timer aus
tooltip,
}
Mouse_Control:
Mouse_Left_old := Mouse_Left
GetKeyState, Mouse_Left, lbutton
if (Mouse_Left = "D")
{
mousegetpos, Mouse_x, Mouse_y, Mouse_win, Mouse_control
tooltip_x := Mouse_x + 5
tooltip_y := Mouse_y + 5
;tooltip, % "Coord: " Mouse_x "/" Mouse_y "`nLButton: " Mouse_Left "`nWin: " Mouse_win "`nControl: " Mouse_control, % tooltip_x, % tooltip_y
wingetpos, 3CXSoftphone_X, 3CXSoftphone_Y, 3CXSoftphone_Width, 3CXSoftphone_Height, ahk_exe 3CXSoftphone.exe
;rechter und unterer Rand
3CXSoftphone_XX := 3CXSoftphone_X + 3CXSoftphone_Width
3CXSoftphone_YY := 3CXSoftphone_Y + 3CXSoftphone_Height
;Bereich für Drag festlegen Rand + bzw - x Pixel
3CXSoftphone_X_2 := 3CXSoftphone_X + 20
3CXSoftphone_Y_2 := 3CXSoftphone_Y + 3
3CXSoftphone_XX_2 := 3CXSoftphone_XX - 20
3CXSoftphone_YY_2 := 3CXSoftphone_YY - 20
;tooltip, % mouse_x " / " mouse_y, % tooltip_x, % tooltip_y
;ist ein Rand geklickt?
if (Mouse_x >= 3CXSoftphone_X and Mouse_x <= 3CXSoftphone_X_2)
Edge_left_clicked = 1
else
Edge_left_clicked = 0
if (Mouse_x <= 3CXSoftphone_XX and Mouse_x >= 3CXSoftphone_XX_2)
Edge_right_clicked = 1
else
Edge_right_clicked = 0
if (Mouse_y >= 3CXSoftphone_Y and Mouse_y <= 3CXSoftphone_Y_2)
Edge_top_clicked = 1
else
Edge_top_clicked = 0
if (Mouse_y <= 3CXSoftphone_YY and Mouse_y >= 3CXSoftphone_YY_2)
Edge_bottom_clicked = 1
else
Edge_bottom_clicked = 0
;tooltip, % "Edge_left_clicked: " Edge_left_clicked "`nEdge_right_clicked: " Edge_right_clicked "`nEdge_top_clicked: " Edge_top_clicked "`nEdge_bottom_clicked: " Edge_bottom_clicked, % tooltip_x, % tooltip_y
;ist eine Ecke geklickt?
if (Edge_left_clicked = 1 and Edge_top_clicked = 1)
Corner_top_left = 1
else
Corner_top_left = 0
if (Edge_right_clicked = 1 and Edge_top_clicked = 1)
Corner_top_right = 1
else
Corner_top_right = 0
if (Edge_left_clicked = 1 and Edge_bottom_clicked = 1)
Corner_bottom_left = 1
else
Corner_bottom_left = 0
if (Edge_right_clicked = 1 and Edge_bottom_clicked = 1)
Corner_bottom_right = 1
else
Corner_bottom_right = 0
Mouse_Drag_Objects := "Corner_top_left|Corner_top_right|Corner_bottom_left|Corner_bottom_right|Edge_left_clicked|Edge_right_clicked|Edge_top_clicked|Edge_bottom_clicked"
if (Mouse_Left_old = "U")
Mouse_Drag_Object =
Loop, parse, Mouse_Drag_Objects, |
{
if (%a_loopfield% = 1)
{
if (Mouse_Left_old = "U") ;;soll nur erkannt werden wenn bei 1. L-button down ein Objekt geclickt ist
{
Mouse_Drag_Object := a_loopfield
Mouse_x_start := Mouse_x
Mouse_y_start := Mouse_y
Mouse_last_x := Mouse_x
Mouse_last_y := Mouse_y
Limit = 0
}
break
}
}
;tooltip, % Mouse_Drag_Object, % tooltip_x, % tooltip_y
;jetzt je nach Bewegung das Fenster anpassen
if (Mouse_Drag_Object != "")
{
if Limit = 0
{
Mouse_move_x := Mouse_x - Mouse_last_x ; ergibt + wenn nach rechts
Mouse_move_y := Mouse_y - Mouse_last_y ; ergibt + wenn nach unten
Mouse_last_x := Mouse_x
Mouse_last_y := Mouse_y
}
;tooltip, % "Mouse_move: " Mouse_move_x " / " Mouse_move_y, % tooltip_x, % tooltip_y
if (Mouse_Drag_Object = "Edge_right_clicked")
{
3CXSoftphone_Width_new := 3CXSoftphone_Width + Mouse_move_x
}
else if (Mouse_Drag_Object = "Edge_bottom_clicked")
{
3CXSoftphone_Height_new := 3CXSoftphone_Height + Mouse_move_y
}
else if (Mouse_Drag_Object = "Corner_bottom_right")
{
3CXSoftphone_Width_new := 3CXSoftphone_Width + Mouse_move_x
3CXSoftphone_Height_new := 3CXSoftphone_Height + Mouse_move_y
}
else if (Mouse_Drag_Object = "Edge_left_clicked")
{
3CXSoftphone_Width_new := 3CXSoftphone_Width - Mouse_move_x
3CXSoftphone_X_new := 3CXSoftphone_x + Mouse_move_x
}
else if (Mouse_Drag_Object = "Corner_bottom_left")
{
3CXSoftphone_Width_new := 3CXSoftphone_Width - Mouse_move_x
3CXSoftphone_X_new := 3CXSoftphone_x + Mouse_move_x
3CXSoftphone_Height_new := 3CXSoftphone_Height + Mouse_move_y
}
else if (Mouse_Drag_Object = "Edge_top_clicked")
{
3CXSoftphone_Height_new := 3CXSoftphone_Height - Mouse_move_y
3CXSoftphone_Y_new := 3CXSoftphone_y + Mouse_move_y
}
else if (Mouse_Drag_Object = "Corner_top_left")
{
3CXSoftphone_Width_new := 3CXSoftphone_Width - Mouse_move_x
3CXSoftphone_X_new := 3CXSoftphone_x + Mouse_move_x
3CXSoftphone_Height_new := 3CXSoftphone_Height - Mouse_move_y
3CXSoftphone_Y_new := 3CXSoftphone_y + Mouse_move_y
}
else if (Mouse_Drag_Object = "Corner_top_right")
{
3CXSoftphone_Height_new := 3CXSoftphone_Height - Mouse_move_y
3CXSoftphone_Y_new := 3CXSoftphone_y + Mouse_move_y
3CXSoftphone_Width_new := 3CXSoftphone_Width + Mouse_move_x
}
;Limits
Limit = 0
if (3CXSoftphone_X_new != "" and 3CXSoftphone_X_new < 0)
{
3CXSoftphone_X_new = 0
Limit = L
}
if (3CXSoftphone_Y_new != "" and 3CXSoftphone_y_new < 0)
{
3CXSoftphone_y_new = 0
Limit = T
}
if (3CXSoftphone_Width_new != "" and 3CXSoftphone_Width_new > 850)
{
3CXSoftphone_Width_new = 850
ifinstring, Mouse_Drag_Object, left
Limit = L
else
Limit = R
}
if (3CXSoftphone_Width_new != "" and 3CXSoftphone_Width_new < 400)
{
3CXSoftphone_Width_new = 400
ifinstring, Mouse_Drag_Object, left
Limit = L
else
Limit = R
}
;if (3CXSoftphone_Height_new != "" and 3CXSoftphone_Height_new > 1050)
; {
; 3CXSoftphone_Height_new = 1050
; Limit = 1
; }
if (3CXSoftphone_Height_new != "" and 3CXSoftphone_Height_new < 500)
{
3CXSoftphone_Height_new = 500
ifinstring, Mouse_Drag_Object, top
Limit = T
else
Limit = B
}
if Limit = 0
winmove, ahk_exe 3CXSoftphone.exe, , % 3CXSoftphone_X_new, % 3CXSoftphone_Y_new, % 3CXSoftphone_Width_new, % 3CXSoftphone_Height_new
}
}
else
{
;tooltip,
if (Mouse_Left_old = "D" and Mouse_Drag_Object != "")
{
Mouse_Drag_Object =
Mouse_Left_old =
3CXSoftphone_Width_new =
3CXSoftphone_Height_new =
3CXSoftphone_X_new =
3CXSoftphone_y_new =
}
}
return
Zuletzt bearbeitet: