Man könnte den String ja auch Base 64 verschlüsseln wie UEZ das in AutoIt macht: File to Base64 String Code Generator v1.12 Build 2013-03-25
Beiträge von funkey
-
-
Die Funktion wurde doch schon für AutoIt gewrappt und ist in der WinAPI-UDF: _WinAPI_GlobalMemoryStatus ()
-
Danke für die nette Funktion. Werde ich vielleicht mal einsetzen.
Dein letztes Update habe ich zufällig heute schon gemacht, da es anders bei mir sowieso nicht funktionierte und auch nicht funktionieren kann. Hab auch noch das Löschen der Console nach jedem Befehlsaufruf engebaut.
Auf alle Fälle eine nützliche Funktion um kleinen Programmen schnell ein nettes Menü zu verpassen!
-
-
So ein Skript für die Logo hab ich auch mal gemacht, allerdings nur für serielle Kommunikation über RS232 mit älteren Logo-Modellen. Weiß nur nicht mehr wo ich das habe.
Also ich hatte eigentlich nie Probleme, mich mehrmals mit einer SPS zu verbinden, da stürzt bei mir nchts ab. Aber ich habe da ein paar Kleinigkeiten in deinem Skript gesehen, die vielleicht ncht ganz optimal sind._DaveInit() solltest du nur einmal aufrufen, vor der Hauptschleife.
_daveReadBytes() solltest du nicht nach _daveTCPDisconnect() verwenden, um zu überprüfen, ob die Verbindung abgebaut wurde. Das klappt auch so!
_DaveDeinit() wird automatisch beim beenden des Skriptes aufgerufen, das brauchst du nicht expizit zu machen.
Ich würde das ganze Skript auf den Event-Modus umbauen, da es damit übersichtlicher wird.
Vielleicht kann die Logo nur eine Verbindung über TCP aufbauen, und da du nicht abfragst ob die Verbindung überhaupt aufgebaut werden konnte, wird das Skript wahrscheinlich crashen.Genauer habe ich nicht geschaut und testen kann ich auch nicht.
mfg
funkey -
Hier die Lösung mit ObjCreateInterface (abgeändertes Beispiel aus der Hilfe)
Spoiler anzeigen
[autoit]#include <WinAPI.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <WindowsConstants.au3>Opt('WinTitleMatchMode', 2)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]Global Const $sCLSID_TaskbarList = "{56FDF344-FD6D-11D0-958A-006097C9A090}"
[/autoit] [autoit][/autoit] [autoit]
Global Const $sIID_ITaskbarList = "{56FDF342-FD6D-11D0-958A-006097C9A090}"
Global Const $sTagITaskbarList = "HrInit hresult(); AddTab hresult(hwnd); DeleteTab hresult(hwnd); ActivateTab hresult(hwnd); SetActiveAlt hresult(hwnd);"Global $oTaskbarList = ObjCreateInterface($sCLSID_TaskbarList, $sIID_ITaskbarList, $sTagITaskbarList)
[/autoit] [autoit][/autoit] [autoit]$oTaskbarList.HrInit()
[/autoit] [autoit][/autoit] [autoit]Run('Au3Info.exe')
[/autoit]
Global $hAutoItInfo = WinWait('AutoIt v3 Window Info')
ConsoleWrite("Hide Taskbar" & @LF)
$oTaskbarList.DeleteTab($hAutoItInfo)
Sleep(3000)
ConsoleWrite("Show Taskbar" & @LF)
$oTaskbarList.AddTab($hAutoItInfo) -
Ich schaue es mir mal an wenn ich mal mehr Zeit hab, versprechen kann ich nichts.
-
Hallo,
hab das mal für das englische Forum gebastelt, wollte es aber euch hier auch nicht vorenthalten. Falls jemand mit TGA-Bildern und AutoIt arbeiten will, kann er diese UDF verwenden. Es gibt eine AutoIt-Version und eine 32Bit-Dll-Version wegen der Geschwindigkeit.
Vielleicht kann es ja mal jemand brauchen.Schöne Grüße
funkey -
-
Hier ein Beispiel zum Finden von Bluetooh Geräten von MKISH aus dem engl. Forum: http://www.autoitscript.com/forum/topic/14…u/#entry1004593
-
Oscar
1. das passwort ist doch verschlüsselt in der .ini, oder hab ich was überlesen?
2. welchen Sinn hat es, Programm und ini zu trennen? wenn er die Makros verwendet und die relativen Pfade stimmen, ist es doch egal, wo das Programm und die ini liegen
Ich bin zwar nicht Oscar, aber ich kann das auch beantworten:
Zu Punkt 1: Das Passwort ist zwar verschlüsselt, aber es kann mit dem Schlüssel wiederhergestellt werden. Wenn man aber nicht das verschlüsselte Passwort, sondern den Hashwert davon abspeichert, dann kann das Passwort nicht mehr hergestellt werden. Man muss dann das eingegebene Passwort auch hashen und dann die Hashwerte vergleichen.Zu Punkt 2: Das hat dann einen Sinn, wenn das Programm z.B. in C:\Programme liegt und man keine Schreibrechte auf diesen Ordner hat. Dann würde es nicht funktionieren. Um dies zu umgehen, verwendet man einen Programmordner im AppData-Bereich. Darum heißt der Ordner ja auch so. Wenn das Programm auf dem Desktop oder in den Eigenen Dateien liegt, dann spielt das keine Rolle. Will man das Programm aber weitergeben, ist diese Lösung die sicherste Variante.
-
Hab das Skript mal umgeschrieben, damit es übersichtlicher wird und die Font-Höhe passend ausgegeben wird.
BTW: Die Funktion SystemParametersInfo() muss ich in Zukunft öfter verwenden, damit kann man sehr viel anstellen!Spoiler anzeigen
[autoit]#include <WinAPI.au3>
[/autoit] [autoit][/autoit] [autoit]Global Const $tagNONCLIENTMETRICS = "UINT cbSize;int iBorderWidth;int iScrollWidth;int iScrollHeight;int iCaptionWidth;" & _
[/autoit] [autoit][/autoit] [autoit]
"int iCaptionHeight;byte lfCaptionFont[92];int iSmCaptionWidth;int iSmCaptionHeight;byte lfSmCaptionFont[92];int iMenuWidth;" & _
"int iMenuHeight;byte lfMenuFont[92];byte lfStatusFont[92];byte lfMessageFont[92];int iPaddedBorderWidth"Global Const $SPI_GETNONCLIENTMETRICS = 0x0029
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]Global $tCaptionFont, $tSmCaptionFont, $tMenuFont, $tStatusFont, $tMessageFont
[/autoit] [autoit][/autoit] [autoit]
Global $tNonClientMetrics = DllStructCreate($tagNONCLIENTMETRICS)
Global $iDllStructSize = DllStructGetSize($tNonClientMetrics)
If @OSVersion < 0x0600 Then $iDllStructSize -= 4DllStructSetData($tNonClientMetrics, "cbSize", $iDllStructSize)
[/autoit] [autoit][/autoit] [autoit]If _WinAPI_SystemParametersInfo($SPI_GETNONCLIENTMETRICS, $iDllStructSize, DllStructGetPtr($tNonClientMetrics)) Then
[/autoit] [autoit][/autoit] [autoit]
$tCaptionFont = DllStructCreate($tagLOGFONT, DllStructGetPtr($tNonClientMetrics, "lfCaptionFont"))
$tSmCaptionFont = DllStructCreate($tagLOGFONT, DllStructGetPtr($tNonClientMetrics, "lfSmCaptionFont"))
$tMenuFont = DllStructCreate($tagLOGFONT, DllStructGetPtr($tNonClientMetrics, "lfMenuFont"))
$tStatusFont = DllStructCreate($tagLOGFONT, DllStructGetPtr($tNonClientMetrics, "lfStatusFont"))
$tMessageFont = DllStructCreate($tagLOGFONT, DllStructGetPtr($tNonClientMetrics, "lfMessageFont"))ConsoleWrite("CaptionFont:"& @TAB & _GetFontInfo($tCaptionFont, 1) & " / " & _GetFontInfo($tCaptionFont, 2) & " / " & _GetFontInfo($tCaptionFont, 3) & @LF)
[/autoit] [autoit][/autoit] [autoit]
ConsoleWrite("SmCaptionFont:"& @TAB & _GetFontInfo($tSmCaptionFont, 1) & " / " & _GetFontInfo($tSmCaptionFont, 2) & " / " & _GetFontInfo($tSmCaptionFont, 3) & @LF)
ConsoleWrite("MenuFont:"& @TAB & _GetFontInfo($tMenuFont, 1) & " / " & _GetFontInfo($tMenuFont, 2) & " / " & _GetFontInfo($tMenuFont, 3) & @LF)
ConsoleWrite("StatusFont:"& @TAB & _GetFontInfo($tStatusFont, 1) & " / " & _GetFontInfo($tStatusFont, 2) & " / " & _GetFontInfo($tStatusFont, 3) & @LF)
ConsoleWrite("MessageFont:"& @TAB & _GetFontInfo($tMessageFont, 1) & " / " & _GetFontInfo($tMessageFont, 2) & " / " & _GetFontInfo($tMessageFont, 3) & @LF)
EndIfFunc _GetFontInfo($tLogFont, $iRet = 0)
[/autoit]
If $iRet < 0 Or $iRet > 3 Then Return SetError(1, 0, 0)
Local Const $LOGPIXELSY = 90
Local $aFontInfo[3]
$aFontInfo[0] = DllStructGetData($tLogFont, "FaceName")
$aFontInfo[1] = Round(-DllStructGetData($tLogFont, "Height") * 72 / _WinAPI_GetDeviceCaps(_WinAPI_GetDC(0), $LOGPIXELSY), 1)
$aFontInfo[2] = DllStructGetData($tLogFont, "Weight")
If $iRet = 0 Then
Return $aFontInfo
Else
Return $aFontInfo[$iRet - 1]
EndIf
EndFunc ;==>_GetFontInfo -
Die 12 glaub ich muss man mit 0.75 multiplizieren (Dots per inch und points per inch Berechnung so irgendwie), dann kommt 9 raus.
-
Spoiler anzeigen
[autoit]#cs
[/autoit] [autoit][/autoit] [autoit]
typedef struct tagNONCLIENTMETRICS {
UINT cbSize;
int iBorderWidth;
int iScrollWidth;
int iScrollHeight;
int iCaptionWidth;
int iCaptionHeight;
LOGFONT lfCaptionFont;
int iSmCaptionWidth;
int iSmCaptionHeight;
LOGFONT lfSmCaptionFont;
int iMenuWidth;
int iMenuHeight;
LOGFONT lfMenuFont;
LOGFONT lfStatusFont;
LOGFONT lfMessageFont;
#if (WINVER >= 0x0600)
int iPaddedBorderWidth;
#endif
} NONCLIENTMETRICS,
*LPNONCLIENTMETRICS;typedef struct tagLOGFONT {
[/autoit] [autoit][/autoit] [autoit]
LONG lfHeight;
LONG lfWidth;
LONG lfEscapement;
LONG lfOrientation;
LONG lfWeight;
BYTE lfItalic;
BYTE lfUnderline;
BYTE lfStrikeOut;
BYTE lfCharSet;
BYTE lfOutPrecision;
BYTE lfClipPrecision;
BYTE lfQuality;
BYTE lfPitchAndFamily;
TCHAR lfFaceName[LF_FACESIZE];
} LOGFONT, *PLOGFONT;
#ce$nonclientmetrics = DllStructCreate("uint;int;int;int;int;int;byte[60];int;int;byte[60];int;int;byte[60];byte[60];byte[60]")
[/autoit] [autoit][/autoit] [autoit]
DllStructSetData($nonclientmetrics, 1, DllStructGetSize($nonclientmetrics))Global Const $SPI_GETNONCLIENTMETRICS = 41
[/autoit] [autoit][/autoit] [autoit]$a = DllCall("user32.dll", "int", "SystemParametersInfo", "int", 41, "int", DllStructGetSize($nonclientmetrics), "ptr", DllStructGetPtr($nonclientmetrics), "int", 0)
[/autoit] [autoit][/autoit] [autoit]
$b = DllCall("kernel32.dll", "int", "GetLastError");~ MsgBox(4096, "SystemParametersInfo", "Last error: " & $b[0] & @CRLF& "SystemParametersInfo return value: " & $a[0])
[/autoit] [autoit][/autoit] [autoit]$logfont1 = DllStructCreate("long;long;long;long;long;byte;byte;byte;byte;byte;byte;byte;byte;char[32]", DllStructGetPtr($nonclientmetrics, 7))
[/autoit] [autoit][/autoit] [autoit]
$logfont2 = DllStructCreate("long;long;long;long;long;byte;byte;byte;byte;byte;byte;byte;byte;char[32]", DllStructGetPtr($nonclientmetrics, 10))
$logfont3 = DllStructCreate("long;long;long;long;long;byte;byte;byte;byte;byte;byte;byte;byte;char[32]", DllStructGetPtr($nonclientmetrics, 13))
$logfont4 = DllStructCreate("long;long;long;long;long;byte;byte;byte;byte;byte;byte;byte;byte;char[32]", DllStructGetPtr($nonclientmetrics, 14))
$logfont5 = DllStructCreate("long;long;long;long;long;byte;byte;byte;byte;byte;byte;byte;byte;char[32]", DllStructGetPtr($nonclientmetrics, 15))MsgBox(4096, "Fonts", "CaptionFont: " & DllStructGetData($logfont1, 14) & " - " & - DllStructGetData($logfont1, 1) & " - " & DllStructGetData($logfont1, 5) & @LF & _
[/autoit]
"SmCaptionWidth: " & DllStructGetData($logfont2, 14) & " - " & - DllStructGetData($logfont2, 1) & " - " & DllStructGetData($logfont2, 5) & @LF & _
"MenuFont: " & DllStructGetData($logfont3, 14) & " - " & - DllStructGetData($logfont3, 1) & " - " & DllStructGetData($logfont3, 5) & @LF & _
"StatusFont: " & DllStructGetData($logfont4, 14) & " - " & - DllStructGetData($logfont4, 1) & " - " & DllStructGetData($logfont4, 5) & @LF & _
"MessageFont: " & DllStructGetData($logfont5, 14) & " - " & - DllStructGetData($logfont5, 1) & " - " & DllStructGetData($logfont5, 5)) -
Hallo blubbstar!
Ich wünsche dir alles Gute zu deinem 22. Geburtstag! Bleib Gesund und feier schön! Samstag ist dafür ideal
-
Hallo, da ich die Funktion GetIpAddrTable brauchte, und im englischen Forum nur ein nicht mehr funktionierendes Beispiel aus dem Jahre 2006 zu finden war (hier), habe ich nun die Funktion neu geschrieben. Ich hoffe, das es jemand brauchen kann.
Spoiler anzeigen
[autoit]#include <Array.au3>
[/autoit] [autoit][/autoit] [autoit]Global $aIpTable = _GetIpAddrTable()
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
_ArrayDisplay($aIpTable)Func _GetIpAddrTable($bOrder = 0)
[/autoit] [autoit][/autoit] [autoit]
;funkey 2013, Aug 17th
Local Const $tagMIB_IPADDRROW = "STRUCT;DWORD dwAddr;DWORD dwIndex;DWORD dwMask;DWORD dwBCastAddr;DWORD dwReasmSize;USHORT unused1;USHORT wType;ENDSTRUCT;"
Local Const $tagMIB_IPADDRTABLE = "DWORD dwNumEntries;" & $tagMIB_IPADDRROWLocal Const $MIB_IPADDR_PRIMARY = 0x0001
[/autoit] [autoit][/autoit] [autoit]
Local Const $MIB_IPADDR_DYNAMIC = 0x0004
Local Const $MIB_IPADDR_DISCONNECTED = 0x0008
Local Const $MIB_IPADDR_DELETED = 0x0040
Local Const $MIB_IPADDR_TRANSIENT = 0x0080Local $aRet, $dwSize, $dwNumEntries, $tMIB_IPADDRTABLE, $tagTemp = $tagMIB_IPADDRTABLE
[/autoit] [autoit][/autoit] [autoit]
Local $iIpAddrRowSize = 24, $iSize = 28, $aTemp, $iTemp$aRet = DllCall("iphlpapi.dll", "int", "GetIpAddrTable", "ptr", 0, "DWORD*", 0, "BOOL", $bOrder)
[/autoit] [autoit][/autoit] [autoit]
$dwSize = $aRet[2]
While $iSize < $dwSize
$tagTemp &= $tagMIB_IPADDRROW
$iSize += $iIpAddrRowSize
WEnd$tMIB_IPADDRTABLE = DllStructCreate($tagTemp)
[/autoit] [autoit][/autoit] [autoit]$aRet = DllCall("iphlpapi.dll", "int", "GetIpAddrTable", "struct*", $tMIB_IPADDRTABLE, "DWORD*", $dwSize, "BOOL", $bOrder)
[/autoit] [autoit][/autoit] [autoit]
If $aRet[0] <> 0 Then Return SetError(1, 0, 0)$dwNumEntries = DllStructGetData($tMIB_IPADDRTABLE, "dwNumEntries")
[/autoit] [autoit][/autoit] [autoit]Local $aData[$dwNumEntries + 1][6] = [["Interface Index", "IP Address", "Subnet Mask", "Broadcast", "Reassembly size", "Type and State"]]
[/autoit] [autoit][/autoit] [autoit]
For $i = 1 To $dwNumEntries
$aData[$i][0] = DllStructGetData($tMIB_IPADDRTABLE, ($i - 1) * 7 + 3)
$aTemp = DllCall("ws2_32.dll", "str", "inet_ntoa", "ptr", DllStructGetData($tMIB_IPADDRTABLE, ($i - 1) * 7 + 2))
$aData[$i][1] = $aTemp[0]
$aTemp = DllCall("ws2_32.dll", "str", "inet_ntoa", "ptr", DllStructGetData($tMIB_IPADDRTABLE, ($i - 1) * 7 + 4))
$aData[$i][2] = $aTemp[0]
$aTemp = DllCall("ws2_32.dll", "str", "inet_ntoa", "ptr", DllStructGetData($tMIB_IPADDRTABLE, ($i - 1) * 7 + 5))
$aData[$i][3] = $aTemp[0]
$aData[$i][4] = DllStructGetData($tMIB_IPADDRTABLE, ($i - 1) * 7 + 6)
$iTemp = DllStructGetData($tMIB_IPADDRTABLE, ($i - 1) * 7 +
If BitAND($iTemp, $MIB_IPADDR_PRIMARY) Then $aData[$i][5] &= "Primary IP Address;"
If BitAND($iTemp, $MIB_IPADDR_DYNAMIC) Then $aData[$i][5] &= "Dynamic IP Address;"
If BitAND($iTemp, $MIB_IPADDR_DISCONNECTED) Then $aData[$i][5] &= "Address is on disconnected interface;"
If BitAND($iTemp, $MIB_IPADDR_DELETED) Then $aData[$i][5] &= "Address is being deleted;"
If BitAND($iTemp, $MIB_IPADDR_TRANSIENT) Then $aData[$i][5] &= "Transient address;"
$aData[$i][5] = StringTrimRight($aData[$i][5], 1)
NextReturn $aData
[/autoit]
EndFunc ;==>_GetIpAddrTable
Schöne Grüße
funkey -
Liegt die DLL auch im Skriptverzeichnis?
Und hier ist der Original-Thread, wo man auch fragen stellen kann, wenn man Probleme hat: http://www.autoitscript.com/forum/topic/12…df/#entry341916
Ich habe diese UDF auch mal benutzt, ging einwandfrei. -
-
Wird die Funktion auch genau mit dem Namen 'add' exportiert? Schau mal mit dem DLLExplorer oder Dependency-Walker nach. Ansonsten sollte es wohl passen. Hab jetzt allerdings nichts downgeloaded. 1,29MB für eine DLL die nur eine add-Funktion und eine AutoIt-Skript enthält ist recht groß

-
Man kann ja auch nicht ohne Fehler 'echo 123|456' in die Console eingeben! Das |-Zeichen dient als Pipe und es wird versucht das Programm 456 auszuführen.
Aber 'echo "123|456"' funktioniert in der Konsole. -
_WinAPI_DefineDosDevice() aus der WinAPIEx-UDF sollte auch funktionieren. Getestet habe ich das aber noch nicht.