Search the Community
Showing results for tags 'openfile'.
-
Hi guys, you can know the @namecomputer or ip address of the client who opened a notepad file? I created a chat through a shared notepad .. and I thought of adding an edit "who is online" .. here it is the code: #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ComboConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <IE.au3> #include <GuiButton.au3> #include <TrayConstants.au3> #include <Color.au3> #include <ColorConstants.au3> #include <ButtonConstants.au3> #include <GUIComboBox.au3> #Include <GuiComboBoxEx.au3> #include <GuiConstantsEx.au3> #include <TreeViewConstants.au3> #include <GuiTreeView.au3> #include <Array.au3> #include <Excel.au3> #include <MsgBoxConstants.au3> #include <GuiEdit.au3> #include <Array.au3> #include <Misc.au3> #include <ColorConstantS.au3> Local $hDLL = DllOpen("user32.dll") FileInstall("C:\birra.ico",@TempDir & "\birra.ico") GUISetIcon(@TempDir & "\birra.ico", -1) Global $sFileToCheck = "\\192.168.1.155\cond\chat.txt" Global $bFileChanged = False Global $sFileDateTime = _ArrayToString(FileGetTime($sFileToCheck)) AdlibRegister("_CheckFile", 250) $FormComunicazioni = GUICreate("NAME CHAT", 450, 500, -1, -1) GUISetBkColor($COLOR_BLACK) GUISetFont(11, 400, 0, "Calibri") $EditComunicazioni = GUICtrlCreateEdit("",20, 20, 410, 350, BitOR($ES_READONLY, $CBS_AUTOHSCROLL, $WS_VSCROLL)) GUICtrlSetData(-1, "- Chat" & " " & @MDAY & "\" & @MON & "\" & @YEAR) $AggiornaComunicazioni = GUICtrlCreateButton("recupera conversazione iniziale", 20, 385, 200, 30) $edit = GUICtrlCreateEdit("", 20, 430, 340, 55, BitOR($CBS_AUTOHSCROLL, $WS_VSCROLL)) $invia = GUICtrlCreateButton("Invia", 365, 428, 67, 58) GUISetState(@SW_SHOW) While 1 Sleep(10) If $bFileChanged Then $file= FileOpen ("\\192.168.1.155\cond\chat.txt",0) $last_line = FileReadLine ($file, -1) _GUICtrlEdit_AppendText($EditComunicazioni, @CRLF & $last_line) FileClose($file) $sFileDateTime = _ArrayToString(FileGetTime($sFileToCheck)) $bFileChanged = False TrayTip("Stranguglie e previdi", "è presente un nuovo messaggio", 0, $TIP_ICONASTERISK) GUISetState(@SW_RESTORE) EndIf $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $invia ClipPut(GUICtrlRead($edit)) FileWrite("\\192.168.1.155\cond\chat.txt", @CRLF & "[" & @UserName & "]" & " scrive: " & ClipGet()) Sleep(100) Guictrlsetdata($edit,"") Case $AggiornaComunicazioni $file = FileOpen("\\192.168.1.155\cond\chat.txt", 0) $FileContent = FileRead($file) _GUICtrlEdit_AppendText($EditComunicazioni, @CRLF & @CRLF & $FileContent) FileClose($file) GUICtrlSetState($AggiornaComunicazioni, $GUI_DISABLE) EndSwitch WEnd DllClose($hDLL) Func _CheckFile() If $sFileDateTime <> _ArrayToString(FileGetTime($sFileToCheck)) Then $bFileChanged = True EndFunc