Willst du deinen Code formatieren? Drück mal STRG+T
Beiträge von Xenobiologist
-
-
Macht es so nicht mehr Sinn?
Spoiler anzeigen
[autoit]HotKeySet("^o", "KeyToggle")
[/autoit] [autoit][/autoit] [autoit]
HotKeySet("1", "K1")Global $KeyOnOff = False
[/autoit] [autoit][/autoit] [autoit]Func KeyToggle()
[/autoit] [autoit][/autoit] [autoit]
$KeyOnOff = Not $KeyOnOff
EndFunc ;==>KeyToggleFunc K1()
[/autoit] [autoit][/autoit] [autoit]
If $KeyOnOff Then
Send("Hallo")
Else
HotKeySet("1")
Send(@HotKeyPressed)
HotKeySet("1", "K1")
EndIf
EndFunc ;==>K1While 1
[/autoit]
Sleep(100)
WEnd -
Ja, klassischer Fall von Case When.
-
Einfacher wäre es ggf. die Fenster mit WinSetTitle zu nummerieren und dann einfach anzusteuern.
-
Es gibt eine UDF die mit dem Object arbeitet.
Des Weiteren könntest du mal schauen was Autoit Window Info so ausspuckt. -
Über WM_ sollte das doch einfach möglich sein.
Warum hast du die Controls nicht ordentlich mit Namen versehen?
Warum hat der Thread so viele hits?
-
Spoiler anzeigen
[autoit];===============================================================================
[/autoit]
;
; Description: Insert a picture from a separate file into the active sheet.
; Syntax: _ExcelPictureInsert($oExcel, $sFilePath, $iLeft, $iTop, $iWidth, $iHeight, $fLinkToFile = False, $fSaveWithDoc = False)
; Parameter(s): $oExcel - An Excel object opened by a preceding call to _ExcelBookOpen() or _ExcelBookNew()
; $sFilePath - The full path of the picture to be inserted
; $fLinkToFile - "True" to link the picture to the file from which it was created.
; "False" to make the picture an independent copy of the file. The default value is False.
; $fSaveWithDoc - "True" to save the linked picture with the document. The default value is False.
; $iLeft - The position (in points) of the upper-left corner of the picture relative to the upper-left corner of the worksheet
; $iTop - The position (in points) of the upper-left corner of the picture relative to the top of the worksheet
; $iWidth - The width of the picture, in points
; $iHeight - The height of the picture, in points
; Requirement(s): None
; Return Value(s): On Success - Returns an object representing the inserted picture
; On Failure - Returns 0 and sets @error on errors:
; @error=1 - Specified object does not exist
; Author(s): SEO <locodarwin at yahoo dot com>
; Note(s): None
;
;===============================================================================
Func _ExcelPictureInsert($oExcel, $sFilePath, $iLeft, $iTop, $iWidth, $iHeight, $fLinkToFile = False, $fSaveWithDoc = False)
If NOT IsObj($oExcel) Then Return SetError(1, 0, 0)
If NOT FileExists($sFilePath) Then Return SetError(2, 0, 0)
If $iLeft < 1 Then $iLeft = 1
If $iTop < 1 Then $iTop = 1
If $iWidth < 1 Then $iWidth = 1
If $iHeight < 1 Then $iHeight = 1
$oExcel.ActiveSheet.Shapes.AddPicture($sFilePath, $fLinkToFile, $fSaveWithDoc, $iLeft, $iTop, $iWidth, $iHeight).Select
Return $oExcel.Selection.ShapeRange
EndFunc ;==>_ExcelPictureInsert -
Guck/Such mal nach WM_NOTIFY($hWnd, $iMsg, $iWparam, $iLparam) damit sollte es gehen.
Ist allerdings etwas umständlich. -
Spoiler anzeigen
[autoit]Global Const $DESKTOP_ENUMERATE = 0x40
[/autoit] [autoit][/autoit] [autoit]
Global Const $SPI_GETSCREENSAVERRUNNING = 114
Global Const $DESKTOP_SWITCHDESKTOP = 0x100HotKeySet("{ESC}", "_Terminate")
[/autoit] [autoit][/autoit] [autoit]
AdlibRegister("IsDeskTopLocked", 500)While 1
[/autoit] [autoit][/autoit] [autoit]
Sleep(10)
WEndFunc IsDeskTopLocked()
[/autoit] [autoit][/autoit] [autoit]
Local $p_lngHwnd, $p_lngRtn, $p_lngErr, $p_lngScreenSaver, $p_blnIsScreenSaver;~ ' ------------------------------------------
[/autoit] [autoit][/autoit] [autoit]
;~ ' First check for screen saver one of 2 ways,
;~ ' based of OS
;~ ' ------------------------------------------
If @OSTYPE = "WIN32_WINDOWS" Then
;~ ' ---------------------------------------
;~ ' Pre W2K -- Note, will only be TRUE if
;~ ' the "Password Protected" box is
;~ ' checked.
;~ ' ---------------------------------------
$p_lngHwnd = DllCall("user32.dll", "int", "OpenDesktopA", "str", "screen-saver", "int", 0, "int", False, "int", $DESKTOP_ENUMERATE)
If $p_lngHwnd[0] <> 0 Then
$p_blnIsScreenSaver = True
Else
$p_blnIsScreenSaver = False
EndIf
Else
;~ ' ---------------------------------------
;~ ' W2K+ -- Will determine if screen saver
;~ ' is running whether or not the
;~ ' "Password Protected" box is checked
;~ ' ---------------------------------------
$p_lngRtn = DllCall("user32.dll", "int", "SystemParametersInfoA", "int", $SPI_GETSCREENSAVERRUNNING, "int", 0, "int", $p_lngScreenSaver, "int", 0)
If $p_lngRtn[0] = 0 Then
ConsoleWrite("+>Error detecting screen saver" & @LF)
Else
$p_blnIsScreenSaver = $p_lngScreenSaver
EndIfEndIf
[/autoit] [autoit][/autoit] [autoit];~ ' ------------------------------------------
[/autoit] [autoit][/autoit] [autoit]
;~ ' If screen saver is *not* running, then
;~ ' check for locked workstation
;~ ' ------------------------------------------
If $p_blnIsScreenSaver Then
If @OSTYPE = "WIN32_WINDOWS" Then
ConsoleWrite("Screen saver is running..., Handle #" & $p_lngHwnd[0] & @LF)
$p_lngHwnd = DllCall("user32.dll", "int", "CloseDesktop", "int", $p_lngHwnd[0])
Else
ConsoleWrite("Screen saver is running on W2K+" & @LF)
EndIfElse
[/autoit] [autoit][/autoit] [autoit]
$p_lngHwnd = DllCall("user32.dll", "int", "OpenDesktopA", "str", "Default", "int", 0, "int", False, "int", $DESKTOP_SWITCHDESKTOP)If $p_lngHwnd[0] = 0 Then
[/autoit] [autoit][/autoit] [autoit]
ConsoleWrite("Error with OpenDesktop" & @LF)Else
[/autoit] [autoit][/autoit] [autoit]
$p_lngRtn = DllCall("user32.dll", "int", "SwitchDesktop", "int", $p_lngHwnd[0])
$p_lngErr = _GetLastErrorMessage()If $p_lngRtn[0] = 0 Then
[/autoit] [autoit][/autoit] [autoit]
If $p_lngErr = 0 Then
ConsoleWrite("! Desktop is locked" & @LF)
Else
ConsoleWrite("Error with SwitchDesktop" & @LF)
EndIf
Else
ConsoleWrite("Not locked!" & @LF)
EndIf$p_lngHwnd = DllCall("user32.dll", "int", "CloseDesktop", "int", $p_lngHwnd[0])
[/autoit] [autoit][/autoit] [autoit]EndIf
[/autoit] [autoit][/autoit] [autoit]
EndIf
EndFunc ;==>IsDeskTopLockedFunc _Terminate()
[/autoit] [autoit][/autoit] [autoit]
Exit
EndFunc ;==>_Terminate;===============================================
[/autoit] [autoit][/autoit] [autoit]
; _GetLastErrorMessage($DisplayMsgBox="")
; Format the last windows error as a string and return it
; if $DisplayMsgBox <> "" Then it will display a message box w/ the error
; Return Window's error as a string
;===============================================
Func _GetLastErrorMessage($DisplayMsgBox = "")
Local $ret, $s
Local $p = DllStructCreate("char[4096]")
Local Const $FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000If @error Then Return ""
[/autoit] [autoit][/autoit] [autoit]$ret = DllCall("Kernel32.dll", "int", "GetLastError")
[/autoit] [autoit][/autoit] [autoit]$ret = DllCall("kernel32.dll", "int", "FormatMessage", _
[/autoit]
"int", $FORMAT_MESSAGE_FROM_SYSTEM, _
"ptr", 0, _
"int", $ret[0], _
"int", 0, _
"ptr", DllStructGetPtr($p), _
"int", 4096, _
"ptr", 0)
$s = DllStructGetData($p, 1)
If $DisplayMsgBox <> "" Then MsgBox(0, "_GetLastErrorMessage", $DisplayMsgBox & @CRLF & $s)
Return $s
EndFunc ;==>_GetLastErrorMessageSpoiler anzeigen
[autoit]While 1
[/autoit] [autoit][/autoit] [autoit]
Sleep(1000)
If _isWorksatationLocked() Then ConsoleWrite(@HOUR & ":" & @MIN & ":" & @SEC & " - " & "workstation locked" & @CRLF)
WEndFunc _isWorksatationLocked()
[/autoit]
If StringInStr(WinGetText(""), "Program Manager") <> 0 And WinGetTitle("") = "" Then Return 1
Return 0
EndFunc ;==>_isWorksatationLocked -
Sowas?
Spoiler anzeigen
[autoit]#include <ComboConstants.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <GuiComboBox.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
$hGui = GUICreate("Neuen Eintrag hinzufügen", Default, Default, -1, -1)
$Combo = GUICtrlCreateCombo("", 1, 1, 150, 100, $CBS_DROPDOWNLIST)
_GUICtrlComboBox_AddString($Combo, "------Kategorie1")
_GUICtrlComboBox_AddString($Combo, "Eintrag 1")
_GUICtrlComboBox_AddString($Combo, "Eintrag 2")
_GUICtrlComboBox_AddString($Combo, "Eintrag 3")
_GUICtrlComboBox_AddString($Combo, "Eintrag 4")
_GUICtrlComboBox_AddString($Combo, "------Kategorie 2")
_GUICtrlComboBox_AddString($Combo, "Eintrag 5")
_GUICtrlComboBox_AddString($Combo, "Eintrag 6")
_GUICtrlComboBox_AddString($Combo, "Eintrag 7")
_GUICtrlComboBox_AddString($Combo, "Eintrag 8")
GUISetState()GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND")
[/autoit] [autoit][/autoit] [autoit]Do
[/autoit] [autoit][/autoit] [autoit]
$msg = GUIGetMsg()Until $msg = $GUI_EVENT_CLOSE
[/autoit] [autoit][/autoit] [autoit]Func MY_WM_COMMAND($hWnd, $msg, $wParam, $lParam)
[/autoit]
Local $controlID = _WinAPI_LoWord($wParam)
If $controlID = $Combo Then
If StringInStr(GUICtrlRead($Combo), 'Kategorie') <> 0 Then
_GUICtrlComboBox_SetCurSel($Combo, _GUICtrlComboBox_GetCurSel($Combo) + 1)
MsgBox(64, 'Info', 'Auswahl nicht erlaubt!', 1)
EndIf
; hier jegliche Logik rein.
EndIf
EndFunc ;==>MY_WM_COMMAND -
Hab mal reingehört. Ich bin nicht so der Rap-fan. Aber klingt als würde es einem bestimmten Klientel gefallen.
-
DANKE an ALLE!
Die Alienlady ist wirklich sexy
-
Lad mal eine Datei hoch, sodass man den Fehler nachstellen kann.
-
[autoit]
#include "_XMLDomWrapper.au3"
[/autoit]
_XMLFileOpen(@ScriptDir &'\XMLTestfile.xml')
_XMLTransform($objDoc.xml);, "", @ScriptDir & "\XMLJUHU.xml")
FileWrite('XMLjuhu.xml', $objDoc.xml) -
Wie viele hast du denn? UltraEdit hat ein XMl Formatter.
-
Ich glaube in Autoit kannst du nur ByRef für Funktionen nutzen und ansonsten musst du eine neue Variable anlegen und den Werte zuweisen.
-
Meinst du eine globale Variable?
-
Füge doch mal in Zeile 19 dies ein:
ConsoleWrite('! PFAD: ' & $lineArr[1] & "\*.xml")
Warum eigentlich \* ?
-
Ich kenne mich mit Codierungen nicht so aus, aber kannst du nicht einfach UF8 nutzen?
-
Meinst du, in dem du die Buttons vorher erzeugst? Also bevor die Verarbeitung beginnt.