forked from alvonellos/AutoIt_Code-Snippets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDB_CHAT.au3
executable file
·60 lines (52 loc) · 1.63 KB
/
DB_CHAT.au3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Change2CUI=y
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#AutoIt3Wrapper_Add_Constants=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.8.1
Author: Alexander Alvonellos
Script Function:
A chat client over DB
#ce ----------------------------------------------------------------------------
#include "..\Include\__DROPBOX.au3"
HotKeySet("^s", "input")
HotKeySet("{ESC}", "abort")
main()
Func abort()
__DROPBOX__COMM__REMOVE_CHANNEL("comm", @ScriptDir)
Exit
EndFunc
Func main()
__DROPBOX__COMM__CREATE_CHANNEL("comm", @ScriptDir, "dumb")
__DROPBOX__COMM__SUBSCRIBE("comm", @ScriptDir, "DGparser", "dumb")
While True
Sleep(10)
WEnd
EndFunc
Func dumb($msg)
EndFunc
Func DGparser($hFile)
Local $szDatum = FileRead($hFile, -1)
Local $aszSplitDG = StringSplit($szDatum, @LF)
; _ArrayDisplay($aszSplitDG)
Local $display = $aszSplitDG[2] & "@" & $aszSplitDG[1] & ": "
If( $aszSplitDG[0] > 4 ) Then
For $i = 4 To $aszSplitDG[0]-1 Step 1
ConsoleWrite($display & $aszSplitDG[$i] & @LF)
Next
Else
ConsoleWrite($display & $aszSplitDG[4] & @LF)
EndIf
EndFunc
Func input()
Local $input = InputBox("", "enter message", "none", "", 100, 100)
If($input = "purge") Then
__DROPBOX__COMM__PURGE("comm", @ScriptDir, "dumb")
ElseIf( $input <> "none" ) Then
; do nothing
Else
__DROPBOX__COMM__WRITE("comm", @ScriptDir, $input, "dumb")
EndIf
EndFunc