Das habe ich schon bemerkt ist aber für grössere Datenmengen wohl weniger geeignet oder?
Beiträge von iwasready
-
-
Hallo Schnitzel
Danke für die Inputs, habe das Forum schon durchforstet und zwei der drei von dir genannten threads schon gelesen.
Nun ich denke die Kommunikation lässt sich am genialsten über Pipes bewerkstelligen.
Die nächste Frage lautet nun, wenn ich eine NamedPipe (_NamedPipes_CreateNamedPipe ) einrichte, wie kann ich anschliessend Daten da reinschreiben respektive wieder rausholen. Auf dem Gebiet Pipes bin ich definitiv ein Anfänger und auf eure Inputs angewiesen. Im Forum gibt es kein wirklich klares "wie geht das" mit Pipes.
Danke bereits für eure Hilfe und Inputs
Gruss
Iwasready -
Oops stimmt, Danke habe ich so angepasst!
-
Hehe das Problem ist gelöst
Wie Xenobiologist sagte, es war ein Problem der Reihenfolge
-
Danke für die schnelle Antwort! Obwohl mein Tool kein Chat Programm wird schaue ich mir dein Script an! Vielleicht finde ich ja den Fehler
-
Hallöchen zusammen.
Anhanden der Wiki Artikel versuche ich einen Client/Server zu schreiben.
Leider habe ich das Problem, dass der Server die Daten nicht wirklich empfängt oder teilweise funktioniert es einmalig.
Habe ich mich "verschrieben"?
Spoiler anzeigen
[autoit];Check startup parameters (exit when no parameters are set!)
[/autoit] [autoit][/autoit] [autoit]
if $CmdLine[0] = 0 Then
exit
EndIf;Server or Client
[/autoit] [autoit][/autoit] [autoit]
Switch $CmdLine[1]
case 1 ;Server;Start TCP service
[/autoit] [autoit][/autoit] [autoit]
TCPStartup();Create listening socket
[/autoit] [autoit][/autoit] [autoit]
$MainSocket = TCPListen(@IPAddress1,555);Exit if socket could not be created!
[/autoit] [autoit][/autoit] [autoit]
If $MainSocket = -1 then
exit
EndIf
while 1
;Initialize a variable to represent a connection
$ConnectedSocket = -1;Wait for and accept a connection
[/autoit] [autoit][/autoit] [autoit]
Do
$ConnectedSocket = TCPAccept($MainSocket)
Until $ConnectedSocket <> -1While 1
[/autoit] [autoit][/autoit] [autoit]
$Recv = TCPRecv($ConnectedSocket,4096)
if $Recv <> "" then TrayTip("SERVER","Received " & $Recv,1000)
if @error then
ExitLoop
EndIf
WEnd;If existing, close open socket
[/autoit] [autoit][/autoit] [autoit]
If $ConnectedSocket <> -1 then
TCPCloseSocket($ConnectedSocket)
TrayTip("SERVER","Closed a ConnectedSocket",1000)
EndIfWEnd
[/autoit] [autoit][/autoit] [autoit]
;Shutdown TCP service
TCPShutdown()case 2 ;Client
[/autoit] [autoit][/autoit] [autoit]
;Start TCP service
TCPStartup();Initialize a variable to represent a connection
[/autoit] [autoit][/autoit] [autoit]
$ConnectedSocket = -1;Attemp to connect to the server
[/autoit] [autoit][/autoit] [autoit]
$ConnectedSocket = TCPConnect(@IPAddress1,555);Exit on error
[/autoit] [autoit][/autoit] [autoit]
If @error then
exit
EndIfTCPSend($ConnectedSocket,"TEST")
[/autoit] [autoit][/autoit] [autoit];Shutdown TCP service
[/autoit]
TCPShutdown()
EndSwitch -
Hallo Zusammen
Ich möchte aus meinem Hauptpogramm heraus einen zweites AutoIT compiled Script starten. Soweit geht das ja mit Run() oder RunWait() etc. Nun möchte ich aber, dass diese zwei Prozesse miteinander kommunizieren können. wie kann ich das anstellen? Gibt es dafür eine Möglichkeit?
Besten Dank für eure Inputs.
iwasready -
Danke für die Rückmeldung!
Dass die Überprüfung so oft durchgeführt wird ist nur zu Testzwecken.
Ich werde deine Änderung übernehmen, habe gar nicht soweit gedacht.
Gruss
iwasready -
Hallo (auto)Bert
Ich denke am einfachsten ist es, wenn ich gleich das komplette als ZIP einstelle
Da die Datei zu gross ist für das Forum habe ich sie auf meinem Server bereitgestellt.
Gruss
Iwasready -
Hallo (auto)Bert
Natürlich, ist im obigen Post angepasst!
-
Natürlich Sorry wenn die Formatierung nicht gepasst hat, habe vergesen auf "Quellcode" umzuschalten.
Script 1: HauptscriptSpoiler anzeigen
[autoit]#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
[/autoit] [autoit][/autoit] [autoit]
#AutoIt3Wrapper_icon=Ressources\icoSysMan.ico
#AutoIt3Wrapper_outfile=SysMan_Client.exe
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Comment=System Manager based on AutoIt 3.x
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;System Maintenance Client
;*************************
; Developed for the Salvation Army Switzerland;Includes
[/autoit] [autoit][/autoit] [autoit]
#include "UDF_SysMan.au3"
#include
#include
#include
#include
#include
#include
#include
#include 'Ribbonsbar.au3'
#Include
#include
#include;Global variables
[/autoit] [autoit][/autoit] [autoit]
Global $InternetConnection=0 ;0 = no Internet, 1 = Internet connection is available
Global $SQLiteDB;SQLite db handle
Global $ApplVersion = "1.0.0";Version of Application (used for identification);------------------------------------------------------------------------------------------------------ START STARTUP SCRIPTS
[/autoit] [autoit][/autoit] [autoit]
if FileExists(@ScriptDir & "\Startup") Then
$StartupScriptFiles = _FileListToArray(@ScriptDir & "\Startup","*.au3")
$i=0
while $i<$StartupScriptFiles[0]
$i=$i+1
RunWait(@AutoItExe & " " & @ScriptDir & "\Startup\" & $StartupScriptFiles[$i],"",@SW_HIDE)
WEnd
$i=0
EndIf
;------------------------------------------------------------------------------------------------------ END STARTUP SCRIPTS;------------------------------------------------------------------------------------------------------ START DATABASE
[/autoit] [autoit][/autoit] [autoit]
_SQLite_Startup ()
If @error Then
MsgBox(16, "SQLite Error", "SQLite.dll Can't be Loaded!")
Exit - 1
EndIf
ConsoleWrite("_SQLite_LibVersion=" &_SQLite_LibVersion() & @CRLF)
$SQLiteDB = _SQLite_Open(IniRead("sysmandata.ini","SysMan","Database","sysmandata.sqlite"))
If @error Then
MsgBox(16, "SQLite Error", "Can't Load Database!")
Exit - 1
EndIf
;------------------------------------------------------------------------------------------------------ END DATABASE
;############################################################################
_Log("SysMan","Application started!")
;Check Running Permission (has to be Administrator)
;_RunningAsAdmin("","","");------------------------------------------------------------------------------------------------------ START GUI INITIALISATION
[/autoit] [autoit][/autoit] [autoit]
$hGUI = GUICreate ( "System Manager - v." & $ApplVersion , 900, 500, -1, -1)
Opt("GUIOnEventMode",1)GUISetOnEvent($GUI_EVENT_CLOSE, "_GuiEvent_CLOSE")
[/autoit] [autoit][/autoit] [autoit]
GUISetOnEvent($GUI_EVENT_MINIMIZE, "_GuiEvent_MINIMIZE")GUISetBkColor( 0x99B9E3 );Gui BG Blue
[/autoit] [autoit][/autoit] [autoit]
;~ GUISetBkColor( 0x4C4C4C );Gui BG Black
;~ GUISetBkColor( 0xC9CCD5 );Gui BG Silver
$hBar = _RibbonsBar_Create( $hGUI, 0, 0, 900, 0, 'blue');Create statusbar in GUI
[/autoit] [autoit][/autoit] [autoit]
Local $StatusBarParts[3] = [300, 600, -1]
$hStatus = _GUICtrlStatusBar_Create ($hGUI,$StatusBarParts)
_GUICtrlStatusBar_SetText($hStatus,"System Manager started!",1)
_GUICtrlStatusBar_SetText($hStatus,"Internet connection not yet tested!",0)
;------------------------------------------------------------------------------------------------------ END GUI INITIALISATION;------------------------------------------------------------------------------------------------------ BEGIN TAB System Manager
[/autoit] [autoit][/autoit] [autoit]
$hTab_SysMan = _RibbonsBar_Create_Tab( $hBar, 'System Manager' )
$hItem_File = _RibbonsBar_Create_TabItem ( $hTab_SysMan, 'File' , 160 )
$hButton_File_Close = _RibbonsBar_Create_SmallButton($hItem_File,'',132,1 ,'Close',80)
$hButton_File_Hide = _RibbonsBar_Create_SmallButton($hItem_File,'',270,2 ,'Hide',80);------------------------------------------------------------------------------------------------------ END TAB System Manager
[/autoit] [autoit][/autoit] [autoit]
_RibbonsBar_Tab_SetState($hTab_SysMan);set active tab!
GUISetState()
;------------------------------------------------------------------------------------------------------ START TRAY ICON
Opt("TrayAutoPause",0)
Opt("TrayMenuMode",1)
$TrayIcon_Close = TrayCreateItem("Close")
$TrayIcon_Show= TrayCreateItem("Show")
;------------------------------------------------------------------------------------------------------ START TRAY ICON;Register interval tasks
[/autoit] [autoit][/autoit] [autoit]
AdlibRegister("_hStatus_SystemTime",1000)
AdlibRegister("_CheckForInternetConnection",10000);------------------------------------------------------------------------------------------------------ START GUI INPUT
[/autoit] [autoit][/autoit] [autoit]
While 1
;Input from RibbonsBar
Switch _RibbonsBar_GetMsg()
Case -3
;Close
Exit
Case $hButton_File_Close
if msgbox(4,"Close?","Would you realy like to close this application?") = 6 Then
Exit
EndIf
Case $hButton_File_Hide
GuiSetState(@SW_HIDE,$hGUI)
EndSwitch;Input from GUI
[/autoit] [autoit][/autoit] [autoit]
;Switch GUIGetMsg()
;EndSwitch;Input from TryIcon
[/autoit] [autoit][/autoit] [autoit]
Switch TrayGetMsg()
case $TrayIcon_Show
GUISetState(@SW_SHOW,$hGUI)
case $TrayIcon_Close
Exit
EndSwitchWEnd
[/autoit] [autoit][/autoit] [autoit]
;------------------------------------------------------------------------------------------------------ END GUI INPUT;------------------------------------------------------------------------------------------------------ START INTERVAL FUNCTIONS
[/autoit] [autoit][/autoit] [autoit]; #FUNCTION# ====================================================================================================================
[/autoit] [autoit][/autoit] [autoit]
; Name...........: _hStatus_SystemTime()
; Description ...: Display the current system time inside the application
; Syntax.........: _hStatus_SystemTime()
; Author ........: Y. Menge ([email='yves_menge@swi.salvationarmy.org'][/email])
; ===============================================================================================================================
Func _hStatus_SystemTime()
$SystemTime=_Date_Time_GetSystemTime()
_GUICtrlStatusBar_SetText($hStatus,_Date_Time_SystemTimeToDateStr($SystemTime) & " - " & _Date_Time_SystemTimeToTimeStr($SystemTime),2)
EndFunc; #FUNCTION# ====================================================================================================================
[/autoit] [autoit][/autoit] [autoit]
; Name...........: _CheckForInternetConnection()
; Description ...: Check if the needed host is available on the network
; Syntax.........: _CheckForInternetConnection()
; Author ........: Y. Menge ([email='yves_menge@swi.salvationarmy.org'][/email])
; ===============================================================================================================================
Func _CheckForInternetConnection()
$Result=_CheckInternet(_DBSettings_GET("ConnectionCheckURL","http://update.salvationarmy.ch/sysman/connectiontest.html"),_DBSettings_GET("ConnectionCheckValue","142199AB5289B0EA68E697DD4C0E6E7081ECBF385501722D60D7233FD984"))
if $Result=0 then
$InternetConnection=0
_GUICtrlStatusBar_SetText($hStatus,"Internet connection unavailable! ={",0)
ConsoleWrite("No Internet :(")
Else
$InternetConnection=1
_GUICtrlStatusBar_SetText($hStatus,"Internet connection available! =}",0)
ConsoleWrite("Working :)")
EndIf
EndFunc;------------------------------------------------------------------------------------------------------ END INTERVAL FUNCTIONS
[/autoit] [autoit][/autoit] [autoit];------------------------------------------------------------------------------------------------------ START INTERNAL FUNCTIONS
[/autoit] [autoit][/autoit] [autoit]; #FUNCTION# ====================================================================================================================
[/autoit] [autoit][/autoit] [autoit]
; Name...........: _GuiEvent_MINIMIZE
; Description ...: Hide the GUI!
; Syntax.........: _GuiEvent_CLOSE()
; Author ........: Y. Menge ([email='yves_menge@swi.salvationarmy.org'][/email])
; ===============================================================================================================================
Func _GuiEvent_MINIMIZE()
GUISetState(@SW_HIDE)
EndFunc; #FUNCTION# ====================================================================================================================
[/autoit] [autoit][/autoit] [autoit]
; Name...........: _GuiEvent_CLOSE
; Description ...: Close open databases and exit the application
; Syntax.........: _GuiEvent_CLOSE()
; Author ........: Y. Menge ([email='yves_menge@swi.salvationarmy.org'][/email])
; ===============================================================================================================================
Func _GuiEvent_CLOSE()
;Close database
_SQLite_Close()
_SQLite_Shutdown ()_Log("SysMan","Application cloesd!")
[/autoit] [autoit][/autoit] [autoit];exit application
[/autoit] [autoit][/autoit] [autoit]
Exit
EndFunc;------------------------------------------------------------------------------------------------------ END INTERVAL FUNCTIONS
[/autoit]Script 2:
Spoiler anzeigen
[autoit]
[/autoit] [autoit][/autoit] [autoit]
;Include needed Files
#include; #FUNCTION# ====================================================================================================================
[/autoit] [autoit][/autoit] [autoit]
; Name...........: _Log
; Description ...: Creat a log entry in the database
; Syntax.........: _FileListToArrayEx($sPath, $sFilter = '*.*', $iFlag = 0, $sExclude = '')
; Parameters ....: $strType - Type of log entry
; $sArcName - Value of log entry
; Return values .: Success - Returns 1
; Failure - Returns 0
; Author ........: Y. Menge ([email='yves_menge@swi.salvationarmy.org'][/email])
; ===============================================================================================================================
Func _Log($strType, $strValue)
_SQLite_Exec(-1,"INSERT INTO Log (""Type"",""Value"") VALUES("""& $strType &""","""& $strValue & """)")
EndFunc; #FUNCTION# ====================================================================================================================
[/autoit] [autoit][/autoit] [autoit]
; Name...........: _ArraySize
; Description ...: Get the lenght of a array! Works with empty arrays too (returns 0)
; Syntax.........: _ArraySize($aArray)
; Parameters ....: $aArray - Array name
; Return values .: Success - Lenght of the given array
; Author ........: Y. Menge ([email='yves_menge@swi.salvationarmy.org'][/email])
; ===============================================================================================================================
Func _ArraySize( $aArray )
SetError( 0 )
$index = 0
Do
$pop = _ArrayPop( $aArray )
$index = $index + 1
Until @error = 1
Return $index - 1
EndFunc; #FUNCTION# ====================================================================================================================
[/autoit] [autoit][/autoit] [autoit]
; Name...........: _RunningAsAdmin()
; Description ...: Check admin priviledges. If scripts is running without admin priviledges, restart the script as admin!
; Syntax.........: _RunningAsAdmin($strAdminUser,$strAdminPassword,$strAdminDomain)
; Parameters ....: $strAdminUser- Admin Account
;$strAdminPassword- Account Password
;$strAdminDomain- Account Domain to log on
; Author ........: Y. Menge ([email='yves_menge@swi.salvationarmy.org'][/email])
; ===============================================================================================================================
Func _RunningAsAdmin($strAdminUser, $strAdminPassword, $strAdminDomain)
If IsAdmin() = 0 Then
if RunAs($strAdminUser,$strAdminDomain,$strAdminPassword,0,FileGetShortName(@ScriptFullPath)) = 0 Then
_Log("SysMan","Could not start as Admin! AminUser, AdminPassword and LogonDomain correct?")
Exit
EndIf
Exit
EndIf
EndFunc; #FUNCTION# ====================================================================================================================
[/autoit] [autoit][/autoit] [autoit]
; Name...........: _DBSettings_GET()
; Description ...: Get a setting out of database
; Syntax.........: _DBSettings_GET($strName, $strDefaultValue)
; Parameters ....: $strName- Settingname to get
;$strDefaultValue- Defaultvalue if setting ist not in database
; Author ........: Y. Menge ([email='yves_menge@swi.salvationarmy.org'][/email])
; ===============================================================================================================================
Func _DBSettings_GET($strName, $strDefaultValue)
local $aResult, $hQuery
_SQLite_Query(-1,"SELECT value FROM settings WHERE name='" & $strName & "'",$hQuery)
_SQLite_FetchData($hQuery,$aResult)
_SQLite_QueryFinalize($hQuery)
;return default value if none is saved inside db
if $aResult[0]="" Then
return $strDefaultValue
EndIf
;return db value
return $aResult[0]
EndFunc; #FUNCTION# ====================================================================================================================
[/autoit] [autoit][/autoit] [autoit]
; Name...........: _DBSettings_SET()
; Description ...: Set or modifie a setting to a new value
; Syntax.........: _DBSettings_SET($strName, $strValue)
; Parameters ....: $strName- Settingname
;$strValue- Value to set
; Author ........: Y. Menge ([email='yves_menge@swi.salvationarmy.org'][/email])
; ===============================================================================================================================
Func _DBSettings_SET($strName, $strValue)
local $aResult, $hQuery
;Check if value allready exists!
_SQLite_Query(-1,"SELECT name FROM settings WHERE name='" & $strName & "'",$hQuery)
_SQLite_FetchData($hQuery,$aResult)
_SQLite_QueryFinalize($hQuery)
if $aResult[0]="" Then
;Create a new setting in db
_SQLite_Exec(-1,"INSERT INTO settings (name,value) VALUES ('" & $strName & "','" & $strValue & "')")
Else
;Modify a existing setting in db
_SQLite_Exec(-1,"UPDATE settings SET value='" & $strValue & "' WHERE name='" & $strName & "'")
EndIf
_SQLite_QueryFinalize($hQuery)
EndFunc; #FUNCTION# ====================================================================================================================
[/autoit] [autoit][/autoit] [autoit]
; Name...........: _DBSettings_DEL()
; Description ...: Remove a setting from the table
; Syntax.........: _DBSettings_DEL($strName)
; Parameters ....: $strName- Settingname
; Author ........: Y. Menge ([email='yves_menge@swi.salvationarmy.org'][/email])
; ===============================================================================================================================
Func _DBSettings_DEL($strName)
_SQLite_Exec(-1,"DELETE FROM settings WHERE name='" & $strName & "'")
EndFunc; #FUNCTION# ====================================================================================================================
[/autoit] [autoit][/autoit] [autoit]
; Name...........: _CheckPing()
; Description ...: Check the availability of a internet connection to a specific host!
; Syntax.........: _CheckPing($strHost)
; Parameters ....: $strHost- Host to check
; Return values .: Success - Returns >0
; Failure - Returns 0
; Author ........: Y. Menge ([email='yves_menge@swi.salvationarmy.org'][/email])
; ===============================================================================================================================
Func _CheckPing($strHost)
$Result = Ping($strHost)
if $Result > 0 Then
return $Result
Else
return 0
EndIf
EndFunc; #FUNCTION# ====================================================================================================================
[/autoit]
; Name...........: _CheckInternet()
; Description ...: Check the availability of a internet connection to a specific host!
; Syntax.........: _CheckInternet($strURL, $strCheckValue)
; Parameters ....: $strURL- URL to read in!
;$strCheckValue- A string to compare with
; Return values .: Success - Returns 1
; Failure - Returns 0
; Author ........: Y. Menge ([email='yves_menge@swi.salvationarmy.org'][/email])
; ===============================================================================================================================
Func _CheckInternet($strURL, $strCheckValue)
$Result=BinaryToString(InetRead($strURL),16)
if $Result=$strCheckValue Then
return 1
Else
return 0
EndIf
EndFunc//Edit: Für die GUI Ribbonbar Oberfläche verwende ich die folgende UDF --> RibbonsBar (Office 2007 Bar) UDF
Gruss
Iwasready -
Guten Morgen
Ich arbeite gerade an einem Script welches die Verfügbarkeit einer URL testen soll. Nun solange die URL verfügbar ist läuft alles einwandfrei. Ist die Seite zwar im DNS auflösbar aber nicht erreichbar, schmiert das komplette Script ab.
Ich verwende AdLib für die wiederkehrende Aktion.
Mein Script ist wie folgt aufgebaut:
[autoit];Register interval tasksAdlibRegister("_hStatus_SystemTime",1000)AdlibRegister("_CheckForInternetConnection",10000)
[/autoit]
Func _CheckForInternetConnection()$Result=_CheckInternet(_DBSettings_GET("ConnectionCheckURL","http://update.salvationarmy.ch/sysman/connectiontest.html"),_DBSettings_GET("ConnectionCheckValue","142199AB5289B0EA68E697DD4C0E6E7081ECBF385501722D60D7233FD984"))if $Result=0 then$InternetConnection=0_GUICtrlStatusBar_SetText($hStatus,"Internet connection unavailable! ={",0)ConsoleWrite("No Internet :(")Else$InternetConnection=1_GUICtrlStatusBar_SetText($hStatus,"Internet connection available! =}",0)ConsoleWrite("Working :)")EndIfEndFunc
Func _hStatus_SystemTime()$SystemTime=_Date_Time_GetSystemTime()_GUICtrlStatusBar_SetText($hStatus,_Date_Time_SystemTimeToDateStr($SystemTime) & " - " & _Date_Time_SystemTimeToTimeStr($SystemTime),2)EndFunc
Func _CheckInternet($strURL, $strCheckValue)$Result=BinaryToString(InetRead($strURL),16)if $Result=$strCheckValue Thenreturn 1Elsereturn 0EndIfEndFuncGibt es eine Möglichkeit wie eine Art TimeOut einzubauen? Sprich wenn die Seite nicht inerhalb von z.B. 1 Sekunde geladen wird, fehler ausgeben?
Besten Dank für eure Unterstützung.
Gruss
Iwasready