Ist das Leerzeichen zwischen Benutzername und ENTER wirklich gewollt?
Beiträge von Ahnungslos
-
-
Anbei noch ein paar Hinweise:
- Mit Radiobuttons sparst du einiges an Quellcode
- du solltest Checkboxen oder Radios mit BitAnd abfragen (ist sauberer) "BitAND(GUICtrlRead($idRadio1), $GUI_CHECKED)"
- in deinen If-Abfragen wiederholt sich einiges, eventuell kannst du sie aufteilen
-
Folgendes Script funktioniert bei mir: (irgendwo aus dem englischen Forum)
Code
Alles anzeigen$sFolder = $CmdLine[1] ; @DesktopDir & "\Testordner" $sIcon = @ProgramFilesDir & "\AutoIt3\Icons\au3.ico" IniWriteSection($sFolder & "\" & "desktop.ini", ".ShellClassInfo", _ "IconFile=" & $sIcon & @LF & _ "IconIndex=0" & @LF & _ "IconResourceIconResource=" & $sIcon & ",-1" & @LF ) FileSetAttrib($sFolder, "+R") FileSetAttrib($sFolder & "\desktop.ini", "+HSA")
Zum Einrichten in das Kontextmenü:
1. Script kompilieren
2. Verknüpfung der Exe erstellen
3. WIN + R drücken
4. shell:sendto eingeben & OK drücken
5. Verknüpfung in den Ordner kopierenNun kannst du auf einen Ordner einen Rechtsklick machen -> Senden an... -> "deine Verknüpfung" und es wird das Icon dem Ordner zugeordnet. Das aktuallisieren des Icons dauert bei mir trotz F5 recht lang.
Wichtig: im Script die Variable $sIcon anpassen!
-
-
Eventuell sperrt deine Firewall / Antivirus den Zugriff nach außen. Schalte diese zum Testen bitte einmal aus.
Lg Ahnungslos
-
@Einexage Ihr Algorithmus enthält einen entscheidenden Fehler. In der deutschen Sprache werden Zahlwörter größer 999.999 getrennt geschrieben.
-
Ungetestet tippe ich mal darauf das $deleteAfterDays ein String und keine Zahl ist. Wandel die Variable mal vorher um
-
Bei der Entwicklung von AuPDF ist eine kleine Funktion entstanden, mit der man Farbtiefe, Höhe, Breite und Farbraum einer JPEG-Datei auslesen kann.
Vllt. braucht es ja irgendwann mal jemand...
Spoiler anzeigen
[autoit]Local $aData = _JPEG_GetData("PDF.jpg")
[/autoit] [autoit][/autoit] [autoit]
If @error Then
MsgBox(0, "Fehler", @error)
Else
MsgBox(0, "Daten", "Farbtiefe: " & $aData[0] & @lf & "Höhe: " & $aData[1] & @lf & "Breite: " & $aData[2] & @lf & "Farbraum: " & $aData[3])
EndIf; #FUNCTION# ====================================================================================================================
[/autoit] [autoit][/autoit] [autoit]
; Name...........: _JPEG_GetData
; Description ...: Ermittelt Farbtiefe, Höhe, Breite und Farbraum einer JPEG-Datei.
; Syntax.........: _JPEG_GetData($sFile)
; Parameters ....: $sFile - Pfad und Dateiname des Bildes.
; Return values .: Success - array[0]: Farbtiefe
; - array[1]: Höhe
; - array[2]: Breite
; - array[3]: Farbraum
; Failure - @error 1: Konnte Datei nicht öffnen.
; - @error 2: Signatur Fehlerhaft. Falsches Dateiformat?
; - @error 3: Frameheader fehlt.
; - @error 4: Unbekannter Block.
; - @error 5: Unerwartetes Dateiende.
; Author ........: Christian Korittke (Ahnungslos)
; Modified.......:
; Remarks .......: Farbraum - 1 Graustufen
; - 3 RGB
; - 4 CMYK
; Related .......:
; Link ..........:
; Example .......:
; ===============================================================================================================================
Func _JPEG_GetData($sFile)
Local $hFile = FileOpen($sFile, 16)
If @error Then SetError(1, 0, -1)
If FileRead($hFile, 2) <> 0xD8FF Then Return SetError(2, FileClose($hFile), -1) ; no jpeg signatureWhile FileRead($hFile, 1) = 0xFF
[/autoit]
Switch FileRead($hFile, 1)
Case 0xD0 To 0xD9 ; empty block
FileSetPos($hFile, 1, 1) ; skip 1 byte
Case 0xC0 To 0xC3, 0xC5 To 0xC7, 0xC9 To 0xCB, 0xCD To 0xCF ; frame header
FileSetPos($hFile, 2, 1) ; skip 2 bytes
Local $aImage[4]
$aImage[0] = Int(FileRead($hFile, 1)) ; color depth
$aImage[1] = Int(BitRotate(FileRead($hFile, 2), 8)) ; height ; big to little endian
$aImage[2] = Int(BitRotate(FileRead($hFile, 2), 8)) ; width ; big to little endian
$aImage[3] = Int(FileRead($hFile, 1)) ; color space
Return $aImage
Case 0xDB To 0xFE ; other stuff
FileSetPos($hFile, Int(BitRotate(FileRead($hFile, 2), 8)) - 2, 1) ; skip block ; big to little endian
Case 0xDA ; image start
Return SetError(3, FileClose($hFile), -1) ; miss frame header
Case Else ; error
Return SetError(4, FileClose($hFile), -1) ; unknow block type
EndSwitch
WEnd
Return SetError(5, FileClose($hFile), -1) ; eof
EndFunc -
UEZ Danke für die Vorschläge, wird im ersten Update umgesetzt.
BugFix Tabellen sind in PDF schwer umzusetzen, da es dafür keine extra Syntax gibt. Stehen aber auf meiner Todo-Liste
Update:
Bilder werden jetzt unterstützt. Vorerst aber nur JPG im 24 Bit RGB Format. Alles andere wirft einen @error = 2. -
UEZ habe den Anhang neu sortiert und die Beispiele hinzugefügt
-
Ich möchte euch hier AuPDF vorstellen, eine UDF die PDF-Dateien ohne installierte Drittanbietersoftware erstellen kann. Text wird ähnlich wie in Word automatisch am Zeilen- und Seitenende umgebrochen.
Ihr benötigt nur die AutoItObject UDF, die ihr zum Beispiel hier findet. Und natürlich AuPDF aus dem Dateianhang.
Viel Spaß beim Testen oder Nutzen und bitte fleißig kommentieren.
Changelog
Version 0.11
* _AuPDF_SetAlignVersion 0.12
* _AuPDF_DrawPicVersion 0.13 (15 Downloads)
* Unterstützung für deutsche Umlaute (ANSI)
* Fehler behoben: PDF Header
Version 1.0
* Fehler behoben: große Bilder können nun eingebettet werden* Neue Grafikformate werden unterstützt (alle Formate die GDI+ anbietet)
-
Du könntest in deiner Unterfunktion regelmäsig eine globale Variable abfragen und dann Return aufrufen, wenn diese gesetzt ist.
Spoiler anzeigen
[autoit]#Include <Misc.au3>
[/autoit] [autoit][/autoit] [autoit]Global $LeaveFunc = False
[/autoit] [autoit][/autoit] [autoit]HotKeySet("{ESC}", "LeaveFunc")
[/autoit] [autoit][/autoit] [autoit]UnterProgramm()
[/autoit] [autoit][/autoit] [autoit]Func UnterProgramm()
[/autoit] [autoit][/autoit] [autoit]
While 1
Sleep(500)
If $LeaveFunc Then Return
Sleep(500)
WEnd
EndFuncFunc LeaveFunc()
[/autoit]
$LeaveFunc = True
EndFuncDer Hotkey dient nur der Veranschaulichung, hier solltest du die von Raupi besagte WM_COMMAND nutzen um die Variable zu setzen.
-
Schau dir mal _DateAdd an, ich denke das ist die Funktion die du suchst.
[autoit]#Include <Date.au3>
[/autoit][autoit][/autoit][autoit]$sNewDate = _DateAdd('D', -7, "2011/08/18")
[/autoit]
MsgBox(4096, "", "Datum: " & $sNewDate)Edit: Minus nicht Plus
-
Also bei mir läuft _GUICtrlComboBox_ResetContent($combo)...
Ansonsten kannst du auch GuiCtrlSetData($combo, "") nutzen.Der Fehler liegt aber meines Erachtens an deinem Array "$Datentypen", denn das wird nie zurück gesetzt.
Stattdessen sammelt es bei jedem Aufruf weitere Indexe.Kann aber ohne Ini nicht testen.
-
Es gibt mehrere Möglichkeiten auf WordPad zu verzichten. Du könntest zum Beispiel ein IE oder RichEdit-Control erzeugen und daraus drucken.
Anbei ein Beispiel für RichEdit (Achtung: druckt sofort auf dem Standartdrucker)
Spoiler anzeigen
[autoit]
[/autoit] [autoit][/autoit] [autoit]
#include <GuiRichEdit.au3>Global $sZeile[4] = ["ABSENDER: der fröhliche Lieferer blabla", "PAUL TEST", "TESTGASSE 12", "12345 Probierstadt"]
[/autoit] [autoit][/autoit] [autoit]ConsoleWrite(Main() & @CRLF)
[/autoit] [autoit][/autoit] [autoit]Func Main()
[/autoit] [autoit][/autoit] [autoit]
Local $hGui, $hRichEdit, $iMsg, $sPrint
$hGui = GUICreate("Richedit", 320, 240)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "", 10, 10, 300, 220)
_GUICtrlRichEdit_SetCharAttributes($hRichEdit, "+un")
_GUICtrlRichEdit_SetFont($hRichEdit, 10)
_GUICtrlRichEdit_AppendText($hRichEdit, $sZeile[0] & @CRLF)
_GUICtrlRichEdit_SetCharAttributes($hRichEdit, "-un")
For $i = 1 To 3
_GUICtrlRichEdit_SetFont($hRichEdit, 14)
_GUICtrlRichEdit_AppendText($hRichEdit, $sZeile[$i] & @CRLF)
Next
GUISetState() ; löschen wenn Fester unsichtbar bleiben soll
$sPrint = _RTF_Print(_GetDC_PrinterNoDialog(), $hRichEdit, "Titel")
GUIDelete()
Return $sPrint
EndFunc ;==>MainFunc _GetDC_PrinterNoDialog()
[/autoit] [autoit][/autoit] [autoit]
Local $strcPD, $bRet, $hDC
Local $PDtags = "align 1;DWORD lStructSize;HWND hwndOwner;handle hDevMode;handle hDevNames;handle hDC;DWORD Flags;WORD nFromPage;WORD nToPage;" & _
"WORD nMinPage;WORD nMaxPage;WORD nCopies;handle hInstance;LPARAM lCustData;ptr lpfnPrintHook;ptr lpfnSetupHook;ptr lpPrintTemplateName;" & _
"ptr lpSetupTemplateName;handle hPrintTemplate;handle hSetupTemplate"
$strcPD = DllStructCreate($PDtags)
DllStructSetData($strcPD, "lStructSize", DllStructGetSize($strcPD))
DllStructSetData($strcPD, "Flags", 0x100 + 0x40 + 0x400)
$bRet = DllCall("Comdlg32.dll", "int", "PrintDlgW", "ptr", DllStructGetPtr($strcPD))
If $bRet[0] Then Return DllStructGetData($strcPD, "hDC")
Return 0
EndFunc ;==>_GetDC_PrinterNoDialogFunc _RTF_Print($hPrintDc, $hwnd, $DocTitle, $LeftMinMrgn = 1, $TopMinMrgn = 1, $RightMinMrgn = 1, $BottomMinMrgn = 1)
[/autoit] [autoit][/autoit] [autoit]
$TopMinMrgn *= 567
$LeftMinMrgn *= 567
$RightMinMrgn *= 567
$BottomMinMrgn *= 567$dotInchX = _WinAPI_GetDeviceCaps($hPrintDc, 88);-----Const LOGPIXELSX = 88
[/autoit] [autoit][/autoit] [autoit]
$dotInchY = _WinAPI_GetDeviceCaps($hPrintDc, 90);-----Const LOGPIXELSY = 90$PageW = _WinAPI_GetDeviceCaps($hPrintDc, 8);-----Const HORZRES= 8
[/autoit] [autoit][/autoit] [autoit]
$PageH = _WinAPI_GetDeviceCaps($hPrintDc, 10);-----Const VERTRES = 10
$PaperW = _WinAPI_GetDeviceCaps($hPrintDc, 110) ;-----Const PHYSICALWIDTH = 110
$PaperH = _WinAPI_GetDeviceCaps($hPrintDc, 111) ;-----Const PHYSICALHEIGHT = 111$OffSetX = _WinAPI_GetDeviceCaps($hPrintDc, 112) ;-----Const PHYSICALOFFSETX = 112
[/autoit] [autoit][/autoit] [autoit]
$OffSetY = _WinAPI_GetDeviceCaps($hPrintDc, 113);-----Const PHYSICALOFFSETY = 113
$RightMrgn = $PaperW - $PageW - $OffSetX
$BottomMrgn = $PaperH - $PageH - $OffSetY$TwipsInchX = $dotInchX / 1440;-----convert dots to twips [per inch]
[/autoit] [autoit][/autoit] [autoit]
$TwipsInchY = $dotInchY / 1440;-----convert dots to twips [per inch]
;--------convert all measurments to twips
$OffSetX = $OffSetX / $TwipsInchX ;-----convert Left dots to twips
$OffSetY = $OffSetY / $TwipsInchY ;-----convert Left dots to twips
$PageW = $PageW / $TwipsInchX ;-----convert Right dots to twips
$PageH = $PageH / $TwipsInchY ;-----convert Right dots to twips
$PaperW = $PaperW / $TwipsInchX ;-----convert Paper Width dots to twips
$PaperH = $PaperH / $TwipsInchY ;-----convert Paper Width dots to twips;----------Set the margins and keep everything in the printable area
[/autoit] [autoit][/autoit] [autoit]
$Left1 = $LeftMinMrgn - $OffSetX
If $Left1 < 0 Then $Left1 = 0;-----dont print before printable area starts$Top1 = $TopMinMrgn - $OffSetY
[/autoit] [autoit][/autoit] [autoit]
If $Top1 < 0 Then $Top1 = 0;-----dont print before printable area starts$Right1 = $RightMinMrgn - $RightMrgn
[/autoit] [autoit][/autoit] [autoit]
If $Right1 < 0 Then $Right1 = 0;-----dont print after printable area ends
$Right1 = $PageW - $Right1 ;+$Left1;- $OffSetX$Bottom1 = $BottomMinMrgn - $BottomMrgn
[/autoit] [autoit][/autoit] [autoit]
If $Bottom1 < 0 Then $Bottom1 = 0;-----dont print after printable area ends
$Bottom1 = $PageH - $Bottom1;+$Top1$z = _SendMessage($hwnd, $EM_SETTARGETDEVICE, 0);---0=wrap----anything else is 1 char per page!!!!!
[/autoit] [autoit][/autoit] [autoit]
If $z = 0 Then Return 'Cant find RichEdit Control'If _GUICtrlRichEdit_GetTextLength($hwnd) < 1 Then Return 'Nothing to Print.'
[/autoit] [autoit][/autoit] [autoit]
;---------must have a selection on the richEdit control---------------
_SendMessage($hwnd, $EM_SETSEL, 0, -1);--ok----select all$pgTags = "int Left1;int Top1;int Right1;int Bottom1;int Left2;int Top2;int Right2;int Bottom2;"
[/autoit]
$rgTags = "LONG cpMin;LONG cpMax"
$dcHTags = "HANDLE hdc;HANDLE hdcTarget;"
;------------create a structure for the printed page
$strcPg = DllStructCreate($dcHTags & $pgTags & $rgTags)
DllStructSetData($strcPg, "hdc", $hPrintDc);-------------printer
DllStructSetData($strcPg, "Left1", $Left1);-----twip--------printer
DllStructSetData($strcPg, "Right1", $Right1);-----twip--------printer
DllStructSetData($strcPg, "Top1", $Top1);-----twip--------printer
DllStructSetData($strcPg, "Bottom1", $Bottom1);-----twip--------printer
;---------get the pointer to all that will be printed??? {I think????????}
$a = DllStructGetPtr($strcPg) + DllStructGetSize(DllStructCreate($dcHTags & $pgTags))
;-----------use this pointer-----------
_SendMessage($hwnd, $EM_EXGETSEL, 0, $a)
;-----------find the last char of the document to be printed
$cpMax = DllStructGetData($strcPg, "cpMax")
;-----------set the 1st page start char-----------
$cpMin = 0
$cpMin2 = -1
;-----------------------------------------------------------------------------------
;--------create a Document structure for the print job title
$strDocNm = DllStructCreate("char DocName[" & StringLen($DocTitle & Chr(0)) & "]")
DllStructSetData($strDocNm, "DocName", $DocTitle & Chr(0))
$strDoc = DllStructCreate("int Size;ptr DocName;ptr Output;ptr Datatype;dword Type")
DllStructSetData($strDoc, "Size", DllStructGetSize($strDoc))
;---------------insert the document name structure into the document structure
DllStructSetData($strDoc, "DocName", DllStructGetPtr($strDocNm))
DllCall("gdi32.dll", "long", "StartDoc", "hwnd", $hPrintDc, "ptr", DllStructGetPtr($strDoc))
;-----------------------------------------------------------------------------------
;-----------make a loop to format each printed page and exit when-----------
;-----$cpMin reaches the $cpMax
;-----$cpMin is less than 0---{I have seen -1 but I forget when}---
;----ALSO-- ExitLoop if $cpMin = $cpMin 2---if it stops finding the start of next page
While $cpMax > $cpMin And $cpMin > -1
;-----------start a new page-----------
$StartPage = DllCall("Gdi32.dll", "int", "StartPage", "HANDLE", $hPrintDc)
;-----------increment page the count-----------
;-----------if not done now it will exit the loop before counting the last page
; ;-----------get the 1st char of the next page, {but how does it work ???}
$cpMin2 = $cpMin
$cpMin = _SendMessage($hwnd, $EM_FORMATRANGE, True, DllStructGetPtr($strcPg))
;----ExitLoop when $cpMin = $cpMin 2---just in case it stops finding the start of next page
If $cpMin2 = $cpMin Then ExitLoop;---get out of loop before more pages are added
; ;-----------set the next page start char-----------
DllStructSetData($strcPg, "cpMin", $cpMin)
;------this sends it to the printer
$EndPage = DllCall("Gdi32.dll", "int", "EndPage", "HANDLE", $hPrintDc)
;-----------end the page and loop again for the next page until the end of document
WEnd
_SendMessage($hwnd, $EM_FORMATRANGE, False, 0)
If $EndPage[0] Then
$r = 'Sent to the printer.'
DllCall("Gdi32.dll", "int", "EndDoc", "HANDLE", $hPrintDc)
Else
$r = 'Printing aborted.'
DllCall("Gdi32.dll", "int", "AbortDoc", "HANDLE", $hPrintDc)
EndIf
Return $r
EndFunc ;==>_RTF_Print
Die Druckfunktion ist von hier. -
Schade, dass es nicht so komfortabel geht.
Verbinde jetzt mit OpenDSObject und cache die Einträge.Danke.
-
Mit der Active Directory UDF kann ich mich auf den Domain internen LDAP-Dienst verbinden, dafür schomal riesen Dank an Water
Nun wollte ich auch noch Abfragen an ein Novell eDirectory schicken. Dieses befindet sich in einer anderen Domain.
[autoit]
Kann mir jemand sagen wie die letzten 3 Parameter aussehen müssen, bzw. wie man diese ermitteln kann???
[/autoit][autoit][/autoit][autoit]
#include <AD.au3>Local $sUser = "Nutzer1"
[/autoit][autoit][/autoit][autoit]
Local $sPass = "Pass1"Local $sDNSDomain = "DC=subdomain,DC=domain,DC=de"
[/autoit][autoit][/autoit][autoit]
Local $sHostServer = "server.subdomain.domain.de"
Local $sConfig = "CN=Configuration,DC=subdomain,DC=domain,DC=de"_AD_Open($sUser, $sPass, $sDNSDomain, $sHostServer, $sConfig)
[/autoit]
If @error Then Exit ConsoleWrite("Error: " & @error & " Extended: " & @extended & @crlf)
_AD_Close()ZitatError: 8 Extended: -2147352567
-
Bitte den Quellcode in Autoit-Tags und Spoiler setzen.
Das macht das Script übersichtlicher und mehr Leute antwortenNun zu deinem Problem:
Autoit wird auf dem anderen PC nicht benötigt, sobald du dein Script compiliert hast.In Zeile 5 hast du ein Run() mit vollständiger Pfadangabe, stimmt der Pfad auch auf dem 2. PC?
Besser wäre evtl. eine relative Pfadangabe, z.B.: @ScriptDir & '\FSViewerSetup46.exe'Außerdem nutzt du Send() und die Mouse... Befehle.
Schau dir mal die Control... Befehle an. Diese sind nicht so anfällig für Fehler.Lg Ahnungslos
-
Nö, unter Windoof sollten eh Zeilenwechsel und Eingabe-Zeichen genutzt werden.
-
Evtl. hat das Control (unter XP) Probleme bei fehlendem Eingebezeichen...
Versuch mal den String mit StringAddCR() zu bearbeiten.Lg Ahnungslos
Edit: Unter Firefox hab ich die gleichen Probleme, nur das das Zeichen anders aussieht. Liegt aber an unescapten Umlauten im HTML-Text.
-
Für die Maus gibt es eine UDF im englischen Forum:
MouseSetOnEventLg Ahnungslos
Edit: Ob sich die Maus über einem Control befindet, kannst du dann mit GUIGetCursorInfo() ermitteln.