; PicChat Emulator
; script best view with Notepad++ and SyntaxHighlighting=Autoit
;
; AHK 1.1.09.00 L
ScriptVersionString = 1.0.0.2
ScriptVersionDateString = 23.11.2012
; By fump2000
; Danke an SAPlayer, nnnik, Babba und QaMarath
;============================================================================
; Setzen der Globalen Variablen:
;============================================================================
#SingleInstance, Force
#NoEnv
SetBatchLines, -1
CoordMode, Mouse, Screen
;============================================================================
; Includes
;============================================================================
#Include, Gdip.ahk
;============================================================================
; Einlesen der INI-Werte & Autoexecute
;============================================================================
IniRead,PicChatStoragePfad, %A_ScriptDir%\funktionen.ini, PicChat, PicChatStoragePfad
ListViewSearchPfad:=PicChatStoragePfad "\*.*"
UserINI:=PicChatStoragePfad "\user.ini"
settimer, Refresh, 300000
GoSub ShowGui
Return
;============================================================================
; Start, setzen des Dateinamens & Hotkeys
;============================================================================
StartPicToUser: ; Dieses Label wird angesprungen wenn die Aktiv-Prüfung nach Doppelklick auf einem Namen in der PicChat-Gui posiv war.
file:= PicChatStoragePfad "\" PicToUser "\" "PicChatEmulator-" PicToUser "-screenshot-" A_Now ".png"
Settimer, InfoBox, 100
Hotkey, Numpad0, ScreenArea
Hotkey, Numpad1, WindowOnly
Hotkey, Numpad2, ScreenOne
Hotkey, Numpad3, ScreenComplete
Hotkey, ESC, ToolEnd
Hotkey, Numpad0, ScreenArea, on
Hotkey, Numpad1, WindowOnly, on
Hotkey, Numpad2, ScreenOne, on
Hotkey, Numpad3, ScreenComplete, on
Hotkey, ESC, ToolEnd, on
Return
;============================================================================
WindowOnly: ; Nur Fenster Cpature
GoSub InfoBoxOff
WinGetPos,x,y,w,h,A
MakeCapture(x,y,w,h,file)
GoSub HotkeyOff ; Hotkeys abschalten
GuiControl,PicEmu:Enabled, UserList
Return
ScreenComplete: ; Kompletter Screen
GoSub InfoBoxOff
pToken:=Gdip_Startup()
pBitmap:=Gdip_BitmapFromScreen(Screen=0)
Gdip_SaveBitmapToFile(pBitmap, file, 100)
Gdip_Shutdown(pToken)
GoSub HotkeyOff ; Hotkeys abschalten
GuiControl,PicEmu:Enabled, UserList
Return
ScreenOne: ; Nur Monitor 1
GoSub InfoBoxOff
SysGet, Mon1, Monitor, 1
x:= Mon1Left
y:= Mon1Top
w:= Mon1Right
h:= Mon1Bottom
MakeCapture(x,y,w,h,file)
GoSub HotkeyOff ; Hotkeys abschalten
GuiControl,PicEmu:Enabled, UserList
Return
ScreenArea: ; Bereich mit zwei Klicks bestimmen
GoSub InfoBoxOff
SysGet, Bildschirmanzahl, MonitorCount
Loop, %Bildschirmanzahl%
{
SysGet, Size%A_Index%, Monitor, %A_Index%
}
; GUI's vorbereiten
Loop, %Bildschirmanzahl%
{
Gui, Screen%A_Index%:New, +ToolWindow +LastFound +AlwaysOnTop, Screen%A_Index%
Gui, Screen%A_Index%:Color, 0x3366CC
WinSet, Transparent, 100,
Gui, Screen%A_Index%:-caption
}
ShowGUI()
Koords = A
SetTimer, ToolTipAnzeigen, 100
KeyWait, LButton, D
if(GetKeyState("esc","P")) ; 1. Möglichkeit abzubrechen
{
GoSub HotkeyOff
HideGUI()
SetTimer, ToolTipAnzeigen, Off
ToolTip
Return
}
MouseGetPos,MouseX ,MouseY
ToolTip
sleep, 200
SetTimer, ToolTipAnzeigen, Off
Koords = B
SetTimer, ToolTipAnzeigen, 100
KeyWait, LButton, D
if(GetKeyState("esc","P")) ; 2. Möglichkeit abzubrechen
{
GoSub HotkeyOff
HideGUI()
SetTimer, ToolTipAnzeigen, Off
ToolTip
Return
}
MouseGetPos,MouseW ,MouseH
sleep, 200
SetTimer, ToolTipAnzeigen, Off
ToolTip
HideGUI()
x:= MouseX
y:= MouseY
w:= MouseW-MouseX
h:= MouseH-MouseY
MakeCapture(x,y,w,h,file)
GoSub HotkeyOff ; Hotkeys abschalten
GuiControl,PicEmu:Enabled, UserList
Return
;============================================================================
; GUI zum anzeigen erhaltener Screenshots
;============================================================================
ZeigePic:
; Berechnungen am Bild zur verkleinerten Darstellung
Loop,
{
if (sh > 399)
{
sh:=sh/100*95
sw:=sw/100*95
}
else
{
if (sw > 399)
{
sh:=sh/100*95
sw:=sw/100*95
}
else
{
sh:=Round(sh)
sw:=Round(sw)
break
}
}
}
; Minimierte GUI zum anzeigen des erstellten Bildes
Gui, Pic:New, +LastFound, Pic
Gui, Pic:Color, 8dadef
Gui, Pic:-Caption
Gui, Pic:Add, GroupBox, x12 y0 w130 h30 ,
Gui, Pic:Add, GroupBox, x142 y0 w130 h30 ,
Gui, Pic:Add, GroupBox, x272 y0 w130 h30 ,
Gui, Pic:Add, Text, x52 y11 w50 h17 gSpeicherPic, Speichern
Gui, Pic:Add, Text, x162 y11 w90 h17 gPicToClip, In Zwischenablage
Gui, Pic:Add, Text, x289 y11 w100 h17 gDelete, Löschen + schließen
sx1:=sw//2
sy1:=sh//2
sx:=205-sx1
sy:=235-sy1
Gui, Pic:Add, Picture, x%sx% y%sy% w%sw% h%sh%, %file%
SysGet, PicMon, MonitorWorkArea, 1
PicX:=PicMonRight-420
PicY:=PicMonBottom-450
PicW:=410
PicH:=440
Gui, Pic:Show, % "Minimize" "x" PicX "y" PicY "w" PicW "h" PicH
Loop 6
{
Gui Flash
Sleep, 500
}
Return
SpeicherPic: ; Bild Speichern
SplitPath, file, Name, Verz, Erw, NameOhneErw, Laufwerk
UserPfad:=UserPfad "\" Name
FileSelectFile, Pfad, S16, %UserPfad%, Wähle einen Pfad (*.*)
SplitPath, Pfad, Name, Verz, Erw, NameOhneErw, Laufwerk
Filecopy, %file%, %Pfad%
Return
PicToClip: ; Bild in die Zwischenablage
filetemp:= A_ScriptDir "\" "tempfile" "-" A_Now ".bmp"
Source:=file
pToken:=Gdip_Startup()
pBitmap2 := Gdip_CreateBitmapFromFile(Source)
Gdip_SaveBitmapToFile(pBitmap2, filetemp, 100)
Gdip_Shutdown(pToken)
ImageToClipboard(filetemp)
Filedelete %filetemp%
t=1
Settimer, ToolTipClip, 100
Return
Delete: ; Bild löschen und GUI killen
Filedelete %file%
Gui, Pic:Destroy
Return
;============================================================================
; Tooltips
;============================================================================
InfoBox:
Tooltip Bild an %PicToUser% übermitteln!`n`nFunktionen:`nNumPad 0 = Bildbereich ausschneiden`nNumPad 1 = Nur aktives Fenster`nNumPad 2 = Nur erster Monitor`nNumPad 3 = Kompletter Sichtbereich`n`nEscape = Abbruch
Return
InfoBoxOff:
Settimer, InfoBox, Off
Tooltip
Return
ToolTipAnzeigen:
MouseGetPos, AusgabeX, AusgabeY
Tooltip, Koordinaten %Koords% anklicken!`n`nPosition: X = %AusgabeX% | Y = %AusgabeY%`nESC drücken + klicken =Abbruch!
Return
ToolTipClip:
t++
Tooltip Das Bild ist über die Zwischenablage verfügbar!
if t > 25
{
ToolTip
Settimer, ToolTipClip, Off
}
Return
;============================================================================
; Funktionen
;============================================================================
; GUIs für den Bildausschnitt anzeigen
ShowGUI()
{
global
Loop, %Bildschirmanzahl%
{
local width:=Size%A_Index%Right-Size%A_Index%Left
local height:=Size%A_Index%Bottom-Size%A_Index%Top
Gui, Screen%A_Index%:Show, % "x" Size%A_Index%Left "y" Size%A_Index%Top "w" width "h" height,
}
}
Return
; GUIs für den Bildausschnitt ausblenden
HideGUI()
{
global
Loop, %Bildschirmanzahl%
{
Gui, Screen%A_Index%:Hide
}
}
Return
MakeCapture(x,y,w,h,file) ; veranlasst ueber GDI+ das erstellen eines Bildes
{
nl:= x
nt:= y
nw:= w
nh:= h
pToken:=Gdip_Startup()
pBitmap:=Gdip_BitmapFromScreen(nl "|" nt "|" nw "|" nh)
Gdip_SaveBitmapToFile(pBitmap, file, 100)
Gdip_Shutdown(pToken)
}
;Gdip_GetImageDimensions(pBitmap, sw, sh)
ImageToClipboard(Filename) ; laedt ein BMP in die Zwischenablage
{
hbm := DllCall("LoadImage","uint",0,"str",Filename,"uint",0,"int",0,"int",0,"uint",0x10)
if !hbm
return
DllCall("OpenClipboard","uint",0)
DllCall("EmptyClipboard")
; Place the data on the clipboard. CF_BITMAP=0x2
if ! DllCall("SetClipboardData","uint",0x2,"uint",hbm)
DllCall("DeleteObject","uint",hbm)
DllCall("CloseClipboard")
}
;============================================================================
; Tool beenden & Hotkeys abschalten
;============================================================================
HotkeyOff: ; Label zum Hotkeys abschalten
Hotkey, Numpad0, ScreenArea, Off
Hotkey, Numpad1, WindowOnly, Off
Hotkey, Numpad2, ScreenOne, Off
Hotkey, Numpad3, ScreenComplete, Off
Hotkey, ESC, ToolEnd, Off
Return
ToolEnd: ; Hotkeys und InfoToolTip abschalten
GoSub HotkeyOff
GoSub InfoBoxOff
Return
;============================================================================
; PicChat Emu Funktionen, Timer und GUI
;============================================================================
; TestUser 1
;============================================================================
TestUser1: ; Erstellt den Ordner im Netzwerkpfad und startet die Timer
PicChatStoragePfadUser1:=PicChatStoragePfad "\TestUser_1"
FileCreateDir, %PicChatStoragePfadUser1%
count1:=0
settimer, ExistPfad1, 1000
settimer, LivingCheck1, 1500
CountFive++
If (CountFive=5)
{
GuiControl,PicEmu:Disabled,UserEAll
GuiControl,PicEmu:Enabled,UserAAll
}
Return
ExistPfad1: ; Hiermit wird geprueft ob der Ordner im Netzlaufwerk erstellt wurde.
if (count1>=10)
{
Msgbox,16,Connection Error,TestUser_1 konnte nicht erstellt werden.
settimer, ExistPfad1, Off
Return
}
IfNotExist %PicChatStoragePfadUser1%
count1++
else
settimer, ExistPfad1, Off
Return
LivingCheck1: ; Diese Funktion prueft ob im Ordner eine living.txt auftaucht, wenn sie gefunden wird dann loescht das Script diese sofort.
CheckFile1:=PicChatStoragePfadUser1 "\*living.txt"
IfExist %CheckFile1%
Filedelete, %CheckFile1%
Return
;============================================================================
; TestUser 2
;============================================================================
TestUser2: ; Erstellt den Ordner im Netzwerkpfad und startet die Timer
PicChatStoragePfadUser2:=PicChatStoragePfad "\TestUser_2"
FileCreateDir, %PicChatStoragePfadUser2%
count2:=0
settimer, ExistPfad2, 1000
settimer, LivingCheck2, 1500
CountFive++
If (CountFive=5)
{
GuiControl,PicEmu:Disabled,UserEAll
GuiControl,PicEmu:Enabled,UserAAll
}
Return
ExistPfad2: ; Hiermit wird geprueft ob der Ordner im Netzlaufwerk erstellt wurde.
if (count2>=10)
{
Msgbox,16,Connection Error,TestUser_2 konnte nicht erstellt werden.
settimer, ExistPfad2, Off
Return
}
IfNotExist %PicChatStoragePfadUser2%
count2++
else
settimer, ExistPfad2, Off
Return
LivingCheck2: ; Diese Funktion prueft ob im A_UserName Ordner eine living.txt auftaucht, wenn sie gefunden wird dann loescht das Script diese sofort.
CheckFile2:=PicChatStoragePfadUser2 "\*living.txt"
IfExist %CheckFile2%
Filedelete, %CheckFile2%
Return
;============================================================================
; TestUser 3
;============================================================================
TestUser3: ; Erstellt den Ordner im Netzwerkpfad und startet die Timer
PicChatStoragePfadUser3:=PicChatStoragePfad "\TestUser_3"
FileCreateDir, %PicChatStoragePfadUser3%
count3:=0
settimer, ExistPfad3, 1000
settimer, LivingCheck3, 1500
CountFive++
If (CountFive=5)
{
GuiControl,PicEmu:Disabled,UserEAll
GuiControl,PicEmu:Enabled,UserAAll
}
Return
ExistPfad3: ; Hiermit wird geprueft ob der Ordner im Netzlaufwerk erstellt wurde.
if (count3>=10)
{
Msgbox,16,Connection Error,TestUser_3 konnte nicht erstellt werden.
settimer, ExistPfad3, Off
Return
}
IfNotExist %PicChatStoragePfadUser3%
count3++
else
settimer, ExistPfad3, Off
Return
LivingCheck3: ; Diese Funktion prueft ob im A_UserName Ordner eine living.txt auftaucht, wenn sie gefunden wird dann loescht das Script diese sofort.
CheckFile3:=PicChatStoragePfadUser3 "\*living.txt"
IfExist %CheckFile3%
Filedelete, %CheckFile3%
Return
;============================================================================
; TestUser 4
;============================================================================
TestUser4: ; Erstellt den Ordner im Netzwerkpfad und startet die Timer
PicChatStoragePfadUser4:=PicChatStoragePfad "\TestUser_4"
FileCreateDir, %PicChatStoragePfadUser4%
count4:=0
settimer, ExistPfad4, 1000
settimer, LivingCheck4, 1500
CountFive++
If (CountFive=5)
{
GuiControl,PicEmu:Disabled,UserEAll
GuiControl,PicEmu:Enabled,UserAAll
}
Return
ExistPfad4: ; Hiermit wird geprueft ob der Ordner im Netzlaufwerk erstellt wurde.
if (count4>=10)
{
Msgbox,16,Connection Error,TestUser_4 konnte nicht erstellt werden.
settimer, ExistPfad4, Off
Return
}
IfNotExist %PicChatStoragePfadUser4%
count4++
else
settimer, ExistPfad4, Off
Return
LivingCheck4: ; Diese Funktion prueft ob im A_UserName Ordner eine living.txt auftaucht, wenn sie gefunden wird dann loescht das Script diese sofort.
CheckFile4:=PicChatStoragePfadUser4 "\*living.txt"
IfExist %CheckFile4%
Filedelete, %CheckFile4%
Return
;============================================================================
; TestUser 5
;============================================================================
TestUser5: ; Erstellt den Ordner im Netzwerkpfad und startet die Timer
PicChatStoragePfadUser5:=PicChatStoragePfad "\TestUser_5"
FileCreateDir, %PicChatStoragePfadUser5%
count5:=0
settimer, ExistPfad5, 1000
settimer, LivingCheck5, 1500
CountFive++
If (CountFive=5)
{
GuiControl,PicEmu:Disabled,UserEAll
GuiControl,PicEmu:Enabled,UserAAll
}
Return
ExistPfad5: ; Hiermit wird geprueft ob der Ordner im Netzlaufwerk erstellt wurde.
if (count5>=10)
{
Msgbox,16,Connection Error,TestUser_5 konnte nicht erstellt werden.
settimer, ExistPfad5, Off
Return
}
IfNotExist %PicChatStoragePfadUser5%
count5++
else
settimer, ExistPfad5, Off
Return
LivingCheck5: ; Diese Funktion prueft ob im A_UserName Ordner eine living.txt auftaucht, wenn sie gefunden wird dann loescht das Script diese sofort.
CheckFile5:=PicChatStoragePfadUser5 "\*living.txt"
IfExist %CheckFile5%
Filedelete, %CheckFile5%
Return
;============================================================================
;
;============================================================================
ShowGui:
Gui, PicEmu:New, -MinimizeBox +LastFound, PicChat Emulator
Gui, PicEmu:Color, FFFFFF
Gui, PicEmu:Default
Gui, PicEmu:Add, Text, x2 y0 w170 h60 +Center, Diese User sind aktuell Online. Testbild per Doppelklick an ausgewählten User versenden.
Gui, PicEmu:Add, CheckBox, x2 y60 w80 h30 vAutoRefresh gAutoRefreshClick cBlack, Autorefresh
Gui, PicEmu:Add, Button, x82 y62 w90 h26 gClickRefresh, Refresh
Gui, PicEmu:Add, ListView, x2 y90 w170 h520 NoSortHdr Sort vUserList gUserList BackgroundA6D2FF, Name|Kurzname
Gui, PicEmu:Add, Text, x182 y0 w260 h20 +Center, 5 Testuser, einzeln aktivierbar
Gui, PicEmu:Add, GroupBox, x182 y20 w260 h80 , Testuser 1
Gui, PicEmu:Add, Button, x192 y40 w110 h50 vUser1E gUser1E, Einbuchen
Gui, PicEmu:Add, Button, x322 y40 w110 h50 vUser1A gUser1A, Ausbuchen
Gui, PicEmu:Add, GroupBox, x182 y100 w260 h80 , Testuser 2
Gui, PicEmu:Add, Button, x192 y120 w110 h50 vUser2E gUser2E, Einbuchen
Gui, PicEmu:Add, Button, x322 y120 w110 h50 vUser2A gUser2A, Ausbuchen
Gui, PicEmu:Add, GroupBox, x182 y180 w260 h80 , Testuser 3
Gui, PicEmu:Add, Button, x192 y200 w110 h50 vUser3E gUser3E, Einbuchen
Gui, PicEmu:Add, Button, x322 y200 w110 h50 vUser3A gUser3A, Ausbuchen
Gui, PicEmu:Add, GroupBox, x182 y260 w260 h80 , Testuser 4
Gui, PicEmu:Add, Button, x192 y280 w110 h50 vUser4E gUser4E, Einbuchen
Gui, PicEmu:Add, Button, x322 y280 w110 h50 vUser4A gUser4A, Ausbuchen
Gui, PicEmu:Add, GroupBox, x182 y340 w260 h80 , Testuser 5
Gui, PicEmu:Add, Button, x192 y360 w110 h50 vUser5E gUser5E, Einbuchen
Gui, PicEmu:Add, Button, x322 y360 w110 h50 vUser5A gUser5A, Ausbuchen
Loop, 5
{
GuiControl,PicEmu:Disabled,User%A_Index%A
}
Gui, PicEmu:Add, Button, x192 y430 w110 h80 vUserEAll gUserEAll, Alle einbuchen`n`nDauert jeweils 1,5 Sekunden
Gui, PicEmu:Add, Button, x322 y430 w110 h80 vUserAAll gUserAAll, Alle ausbuchen`n`nDauert jeweils 1,5 Sekunden
Gui, PicEmu:Add, Button, x192 y530 w110 h80 vLivinAllOn gLivinAllOn, LivingCheck @All simulieren`n`nAktivieren
Gui, PicEmu:Add, Button, x322 y530 w110 h80 vLivinAllOff gLivinAllOff, LivingCheck @All simulieren`n`nDeaktivieren
GuiControl,PicEmu:Disabled,UserAAll
GuiControl,PicEmu:Disabled,LivinAllOff
Gui, PicEmu:Add, GroupBox, x452 y0 w440 h400 , Bildanzeige für Empfange Bilder der Testuser
Gui, PicEmu:Add, Text, x462 y20 w420 h370 , Bilddummy
Gui, PicEmu:Add, Text, x452 y410 w70 h20 , TestUser_1:
Gui, PicEmu:Add, Text, x452 y440 w70 h20 , TestUser_2:
Gui, PicEmu:Add, Text, x452 y470 w70 h20 , TestUser_3:
Gui, PicEmu:Add, Text, x452 y500 w70 h20 , TestUser_4:
Gui, PicEmu:Add, Text, x452 y530 w70 h20 , TestUser_5:
Gui, PicEmu:Add, Text, x522 y410 w280 h20 , Bild erhalten?
Gui, PicEmu:Add, Text, x522 y440 w280 h20 , Bild erhalten?
Gui, PicEmu:Add, Text, x522 y470 w280 h20 , Bild erhalten?
Gui, PicEmu:Add, Text, x522 y500 w280 h20 , Bild erhalten?
Gui, PicEmu:Add, Text, x522 y530 w280 h20 , Bild erhalten?
Gui, PicEmu:Add, Button, x802 y410 w90 h20 , Bild Anzeigen
Gui, PicEmu:Add, Button, x802 y440 w90 h20 , Bild Anzeigen
Gui, PicEmu:Add, Button, x802 y470 w90 h20 , Bild Anzeigen
Gui, PicEmu:Add, Button, x802 y500 w90 h20 , Bild Anzeigen
Gui, PicEmu:Add, Button, x802 y530 w90 h20 , Bild Anzeigen
Gui, PicEmu:Add, Button, x442 y580 w450 h30 gEndAll, MIT DIESEM BUTTON DEN EMULATOR BEENDEN!!!
Gui, PicEmu:Show, h620 w900, PicChat Emulator
GoSub Refresh
Return
User1E:
GuiControl,PicEmu:Enable,User1A
GuiControl,PicEmu:Disabled,User1E
GoSub TestUser1
GoSub Refresh
Return
User2E:
GuiControl,PicEmu:Enable,User2A
GuiControl,PicEmu:Disabled,User2E
GoSub TestUser2
GoSub Refresh
Return
User3E:
GuiControl,PicEmu:Enable,User3A
GuiControl,PicEmu:Disabled,User3E
GoSub TestUser3
GoSub Refresh
Return
User4E:
GuiControl,PicEmu:Enable,User4A
GuiControl,PicEmu:Disabled,User4E
GoSub TestUser4
GoSub Refresh
Return
User5E:
GuiControl,PicEmu:Enable,User5A
GuiControl,PicEmu:Disabled,User5E
GoSub TestUser5
GoSub Refresh
Return
User1A:
GuiControl,PicEmu:Disabled,User1A
GuiControl,PicEmu:Enable,User1E
FileRemoveDir,%PicChatStoragePfadUser1%,1
CountFiveLogoff++
If (CountFiveLogoff=5)
{
GuiControl,PicEmu:Enabled,UserEAll
GuiControl,PicEmu:Disabled,UserAAll
}
GoSub Refresh
Return
User2A:
GuiControl,PicEmu:Disabled,User2A
GuiControl,PicEmu:Enable,User2E
FileRemoveDir,%PicChatStoragePfadUser2%,1
CountFiveLogoff++
If (CountFiveLogoff=5)
{
GuiControl,PicEmu:Enabled,UserEAll
GuiControl,PicEmu:Disabled,UserAAll
}
GoSub Refresh
Return
User3A:
GuiControl,PicEmu:Disabled,User3A
GuiControl,PicEmu:Enable,User3E
FileRemoveDir,%PicChatStoragePfadUser3%,1
CountFiveLogoff++
If (CountFiveLogoff=5)
{
GuiControl,PicEmu:Enabled,UserEAll
GuiControl,PicEmu:Disabled,UserAAll
}
GoSub Refresh
Return
User4A:
GuiControl,PicEmu:Disabled,User4A
GuiControl,PicEmu:Enable,User4E
FileRemoveDir,%PicChatStoragePfadUser4%,1
CountFiveLogoff++
If (CountFiveLogoff=5)
{
GuiControl,PicEmu:Enabled,UserEAll
GuiControl,PicEmu:Disabled,UserAAll
}
GoSub Refresh
Return
User5A:
GuiControl,PicEmu:Disabled,User5A
GuiControl,PicEmu:Enable,User5E
FileRemoveDir,%PicChatStoragePfadUser5%,1
CountFiveLogoff++
If (CountFiveLogoff=5)
{
GuiControl,PicEmu:Enabled,UserEAll
GuiControl,PicEmu:Disabled,UserAAll
}
GoSub Refresh
Return
LivinAllOn:
GuiControl,PicEmu:Enabled,LivinAllOff
GuiControl,PicEmu:Disabled,LivinAllOn
settimer, DeleteTXT, 1000
Gosub DeleteTXT
Return
DeleteTXT:
SearchPfad:=PicChatStoragePfad "\*.*"
CollectListe:=
Loop, %SearchPfad%, 2, 1
CollectListe = %CollectListe%%A_LoopFileName%`n
Loop, parse, CollectListe, % "`n"
{
If A_LoopField =
break
txtSearchPfad:=PicChatStoragePfad "\" A_LoopField
txtSearchFile:=PicChatStoragePfad "\" A_LoopField "\*.txt"
CollectListeTXT =
Loop, %txtSearchFile%, 0, 1
CollectListeTXT = %CollectListeTXT%%A_LoopFileName%`n
Loop, parse, CollectListeTXT, % "`n"
{
If A_LoopField =
break
FileToDel:=txtSearchPfad "\" A_LoopField
Filedelete, %FileToDel%
}
}
Return
LivinAllOff:
GuiControl,PicEmu:Disabled,LivinAllOff
GuiControl,PicEmu:Enabled,LivinAllOn
settimer, DeleteTXT, Off
Return
UserEAll:
GuiControl,PicEmu:Disabled,UserEAll
Loop, 5
{
GuiControlGet, User%A_Index%E, Enabled
if User%A_Index%E=1
{
GuiControl,PicEmu:Enable,User%A_Index%A
GuiControl,PicEmu:Disabled,User%A_Index%E
GoSub TestUser%A_Index%
GoSub Refresh
sleep,1500
}
}
GuiControl,PicEmu:Enable,UserAAll
Return
UserAAll:
GuiControl,PicEmu:Disabled,UserAAll
Loop, 5
{
GuiControlGet, User%A_Index%A, Enabled
if User%A_Index%E=1
{
GuiControl,PicEmu:Disabled,User%A_Index%A
GuiControl,PicEmu:Enable,User%A_Index%E
FileRemoveDir,% PicChatStoragePfadUser%A_Index%,1
GoSub Refresh
sleep,1500
}
}
GuiControl,PicEmu:Enable,UserEAll
Return
PicEmuGuiClose:
EndAll:
GuiControl,PicEmu:Disabled,UserAAll
Loop, 5
{
GuiControlGet, User%A_Index%A, Enabled
if User%A_Index%E=1
{
GuiControl,PicEmu:Disabled,User%A_Index%A
GuiControl,PicEmu:Enable,User%A_Index%E
FileRemoveDir,% PicChatStoragePfadUser%A_Index%,1
GoSub Refresh
sleep, 250
}
}
ExitApp
Return
LivingCheckRequest: ; Diese Funktion erstellt nach einem Doppelklick auf einen der Namen in der PicChat GUI eine living.txt im UserOrdner des Empfaengers. Das Script welches beim Empfaenger laeuft loescht die living.txt ueber die "LivingCheck"-Funktion. Nur dann wenn die living.txt nach 2 Sekunden wieder geloescht ist wird das erstellen eines Screenshots ermoeglicht. Falls sie immer noch vorhanden ist konnte das Empfaengerscript sie nicht loeschen wohl weil es nicht mehr aktiv ist. Wenn dies erkannt wird dann wird der Vorgang abgebrochen und der entsprechende UserOrdner aus dem Netzwerkpfad entfernt.
file =
(
Check ob Empfänger noch aktiv ist.
Bei Erfolg wird diese Datei automatisch gelöscht!
)
LivingCheckFile:=PicChatStoragePfad "\" PicToUser "\" A_UserName "living.txt"
LivingCheckPfad:=PicChatStoragePfad "\" PicToUser
FileAppend, %file%, %LivingCheckFile%
settimer, UserActiveCheck, 100
sleep, 2000
settimer, UserActiveCheck, Off
Tooltip
IfExist %LivingCheckFile%
{
settimer, UserIsOffline, 100
sleep, 3500
settimer, UserIsOffline, Off
Tooltip
FileRemoveDir,%LivingCheckPfad%,1
GoSub Refresh
Return
}
else
{
GuiControl,PicEmu:Disabled, UserList
GoSub StartPicToUser
Return
}
Return
UserActiveCheck: ; ToolTip LivingCheckRequest
Tooltip,Check ob User noch aktiv ist.`nMoment bitte...
Return
UserIsOffline: ; ToolTip LivingCheckRequest - User offline
Tooltip,User %PicToUser% ist nicht mehr aktiv.`nRefresh wird durchgeführt.`nMoment bitte...
Return
UserList: ; Einsprungspunkt fuer das g-Label des ListView
If A_GuiEvent = Doubleclick
{
If Not RowNumber := LV_GetNext("Selected")
{
MsgBox,16,Fehler!,Bitte einen User auswählen!,2
Return
}
else
{
LV_GetText(PicToUser, A_EventInfo, 2)
GoSub LivingCheckRequest
Return
}
}
Return
ClickRefresh: ; Einspungslabel fuer den Refresh-Button aus der PicChat-GUI
GoSub Refresh
Return
AutoRefreshClick: ; Einspungslabel fuer die AutoRefresh-Checkbox aus der PicChat-GUI
GuiControlGet, AutoRefresh
if AutoRefresh = 1
{
Inputbox,time,Intervall,Gebe einen Zeitintervall von 1-240 Sekunden an.,,145,160,,,,,60
If ErrorLevel
GuiControl, PicChat:, AutoRefresh, 0
else
{
if time < 1
time = 60
if time > 240
time = 240
time := time*1000
time := Round(time)
settimer, RefreshAuto, %time%
}
}
else
{
settimer, RefreshAuto, Off
}
Return
RefreshAuto: ; Einsprungslabel ersetzt den direkten Timer auf die Refresh-Funktion, ist noetig um einen weiteren Timer unabhaengig von den Userwuenschen laufen zu lassen (siehe PicChatLogin)
GoSub Refresh
Return
Refresh: ; Refresh der ListView
Gui, PicEmu:Default
GuiControl, -Redraw, UserList
Dateiliste:=
Loop, %ListViewSearchPfad%, 2, 1
Dateiliste = %Dateiliste%%A_LoopFileName%`n
LV_Delete()
Loop, parse, Dateiliste, % "`n"
{
If A_LoopField = ; Ignoriert das leere Element am Ende der Liste.
break
IniRead, name, %UserINI%, user, % A_LoopField, % A_LoopField
LV_Add("", name, A_LoopField)
}
LV_ModifyCol()
LV_ModifyCol(2, 0)
GuiControl, +Redraw, UserList
Return