Am besten schreibst du mal in Worten auf, wie der Ablauf sein sollte. Einfach PseudoCode schreiben und dann bauen wir das in Autoit.
Beiträge von Xenobiologist
-
-
Genau, du musst ja nur gucken, ob das Fenster welches gerade aktiv ist nicht zu dem Prozess gehört.
-
[autoit]
#include <Process.au3>
[/autoit]
Local $pid = WinGetProcess("[Active]")
MsgBox(4096, "PID = Program", _ProcessGetName($pid)) -
Viel Spaß!
In Scite ALT+w drücken Code Wizard.
-
Hallo,
das ist natürlich noch sehr einfach.
Aber hier ist auch noch ein kleiner FehlerBei 0 kommt nur ok. In Scite gibt es übrigens eine MsgBox Hilfetool!
[autoit][/autoit][autoit][/autoit][autoit]; Shows Message Box with buttons OK and Cancel
[/autoit][autoit][/autoit][autoit][/autoit][autoit]Func OK_Cancel ($Title,$Text)
[/autoit][autoit][/autoit][autoit]Local $OK_Cancel =MsgBox(0, $Title, $Text)
[/autoit][autoit][/autoit][autoit]
If $OK_Cancel = 2 Then abort("You pressed Cancel.")Return
[/autoit][autoit][/autoit][autoit][/autoit]
EndFunc -
Spoiler anzeigen
[autoit]#Region ;************ Includes ************
[/autoit]
#Include <Array.au3>
#EndRegion ;************ Includes ************
Global $a[3] = [1,2,3]
_ArrayDisplay($a)
_ArrayDisplay($a, '', '', 1) -
Gib mal ne kleine Testdatei. Das geht sicher noch schneller.
-
Ja, ich hatte auch erhebliche Probleme mit der UDF. Ich habe sie komplett ersetzt in meinem aktuellen Projekt.
Leider musste ich dadurch auch ein bisschen Funktionalität umgestalten.
Aus meiner Sicht ist die buggy. -
Kannst du das mit einen unkomplexen Skript nachstellen, sodass man testen und experimentieren kann?
-
Ping ist zu langsam?
Vielleicht nslookup?
Oder sowas _TCPIpToName -
Alles einlesen mit FileRead und dann mit StringSplit trennen.
Wie prüfst du denn?
Mit Arrays oder Strings? -
Spoiler anzeigen
[autoit]#include <GUIConstantsEx.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <WindowsConstants.au3>$main_GUI = GUICreate("Main GUI", 300, 100, 10, 10, BitOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX))
[/autoit] [autoit][/autoit] [autoit]
$b_1 = GUICtrlCreateButton("Click me 1", 10, 10, 80, 20)
GUISetState(@SW_SHOW, $main_GUI)$child_GUI = GUICreate("Child GUI", 300, 100, 330, 10, BitOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX), Default, $main_GUI)
[/autoit] [autoit][/autoit] [autoit]
$b_2 = GUICtrlCreateButton("Click me 2", 10, 10, 80, 20)
GUISetState(@SW_SHOW, $child_GUI)GUIRegisterMsg($WM_GETMINMAXINFO, "MY_WM_GETMINMAXINFO")
[/autoit] [autoit][/autoit] [autoit]While 1
[/autoit] [autoit][/autoit] [autoit]
$msg = GUIGetMsg(1)
Select
Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $main_GUI
MsgBox(16, "MAIN", "Closed MAIN", 2)
Exit(0)
Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $child_GUI
MsgBox(16, "CHILD", "CLOSED CHILD", 2)
GUIDelete($child_GUI)
Case $msg[0] = $b_1 And $msg[1] = $main_GUI
MsgBox(16, "MAIN", "Button 1", 2)
Case $msg[0] = $b_2 And $msg[1] = $child_GUI
MsgBox(16, "CHILD", "Button 2", 2)
EndSelect
WEndFunc MY_WM_GETMINMAXINFO($hWnd, $msg, $wParam, $lParam)
[/autoit]
If $hWnd <> $main_GUI Then Return
$minmaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam)
DllStructSetData($minmaxinfo, 7, 500) ; min X
DllStructSetData($minmaxinfo, 8, 250) ; min Y
DllStructSetData($minmaxinfo, 9, 500) ; max X
DllStructSetData($minmaxinfo, 10, 700) ; max Y
Return 0
EndFunc ;==>MY_WM_GETMINMAXINFO -
Hilfe -> GUIGetMsg --> Gui Message Loop.
-
Hi,
okay, ich gucke es mir mal an.
Was willst du denn erreichen?
Was soll es machen, wenn es fertig ist?
MegaSpoiler anzeigen
[autoit]#include <WMMedia.au3>
[/autoit] [autoit][/autoit] [autoit]$sFilename = FileOpenDialog("Select an MP3 File To Use.", @WorkingDir, "Mp3s(*.mp3)", 3)
[/autoit] [autoit][/autoit] [autoit]
If @error Then Exit
WMStartPlayer()
$sObj = WMOpenFile($sFilename)
WMPlay($sFilename)For $i = 0 To 100
[/autoit] [autoit][/autoit] [autoit]
WmSetVolume(100 - $i)
Sleep(100)
Next
For $i = 0 To 100
WmSetVolume($i)
Sleep(100)
NextWMFastForward()
[/autoit] [autoit][/autoit] [autoit]
ConsoleWrite(" : FF")
Sleep(3000)
WMReverse()
ConsoleWrite(" : RR")
Sleep(3000)
WMPause()
ConsoleWrite(" : Pause")
Sleep(3000)
WMResume()
ConsoleWrite(" : Resume")
Sleep(3000)
WMStop()
ConsoleWrite(" : Stop")
Sleep(3000)
WMPlay($sFilename)
ConsoleWrite(" : Play")
Sleep(3000)
WMSetPosition(100)
ConsoleWrite(" : Set Pos")MsgBox(0, "Song Data", "Duration - " & WMGetDuration($sObj) & @LF & _
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit]
"Artist - " & WmGetArtist($sObj) & @LF & _
"Album - " & WmGetAlbum($sObj) & @LF & _
"Title - " & WmGetTitle($sObj) & @LF & _
"Bitrate - " & WmGetBitrate($sObj) & @LF & _
"MediaType - " & WmGetMediaType($sObj) & @LF & _
"FileSize - " & WmGetFileSize($sObj) & @LF & _
"FileType - " & WmGetFileType($sObj) & @LF & _
"Category - " & WMGetCategory($sObj) & @LF & _
"Genre - " & WMGetGenre($sObj) & @LF & _
"Year - " & WMGetYear($sObj) & @LF & _
"State - " & WMGetState())
$sObj = 0
WMClosePlayer() -
Hi,
der erste Pfad zur deiner Ini muss OHNE Varaiable angegeben werden. (siehe Hilfe)
Mega
-
Sind die denn wirklich noch verfügbar? Ggf. hat sich die IP geändert. Drück mal F5
oder versuch ein If FileExsits auf die Laufwerke. -
Spoiler anzeigen
[autoit]Local $aArray = DriveGetDrive("ALL")
[/autoit]
If @error Then
; An error occurred when retrieving the drives.
MsgBox(4096, "DriveGetDrive", "It appears an error occurred.")
Else
For $i = 1 To $aArray[0]
; Show all the drives found and convert the drive letter to uppercase.
MsgBox(4096, "DriveGetDrive", "Drive " & $i & "/" & $aArray[0] & ":" & @CRLF & StringUpper($aArray[$i]))
Next
EndIf
Geht bei mir einwandfrei. -
Ich denke mal, du musst erstmal das Objekt erzeugen und dir zurückgeben lassen.
Dann kannst du damit arbeiten.
Immer prüfen mit isObj .... -
Hi,
ich habe mal eine Lösung ausprobiert.
Folgendes muss getan werden, dann eine Restart-Funktion in Scite zur Verfügung steht.In der AutoIt3Warpper.au3 (unter Programme \AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3 ) zu finden.
[autoit]
in Zeile 1049 diesRun(@ScriptDir & '\Restart.exe ' & '"' & $AutoIT3_PGM & '"', @WorkingDir)
[/autoit]ergänzen.
Spoiler anzeigen
[autoit]; Run your script
[/autoit]
Run(@ScriptDir & '\Restart.exe ' & '"' & $AutoIT3_PGM & '"', @WorkingDir)
$Pid = Run('"' & $AutoIT3_PGM & '" /ErrorStdOut "' & $ScriptFile_In & '" ' & $s_CMDLine, "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
EndIfDann die AutoItWrapper.au3 neu compilieren. Dies geht nicht, weil die exe ja benutzt wird zum Kompilieren.
[autoit]
Also vorher in Zeile 4 den Namen ändern#AutoIt3Wrapper_Outfile=_AutoIt3Wrapper.exe
[/autoit]zum Beispiel einen Unterstrich davorsetzen. Dann kompilieren und anschließend die _AutoIt3Wrapper.exe umbenennen, sodass die AutoIt3Wrapper.exe ersetzt wird.
Im selben Verzeichnis die Restart.exe legen. (hier die au3 die auch vorher noch kompiliert werden muss)
Spoiler anzeigen
[autoit]; Restart
[/autoit] [autoit][/autoit] [autoit]Global $WM_COPYDATA = 74
[/autoit] [autoit][/autoit] [autoit]Opt('MustDeclareVars', 1)
[/autoit] [autoit][/autoit] [autoit]
Opt('WinSearchChildren', 1)
Opt('TrayIconHide', 1)AdlibRegister('_SelfExit', 1500)
[/autoit] [autoit][/autoit] [autoit]
GUIRegisterMsg($WM_COPYDATA, 'MY_WM_COPYDATA'); Variables
[/autoit] [autoit][/autoit] [autoit]
Global $autoit3Exe = 'Autoit3.exe'
Global $autoit3Wrapper = 'Autoit3wrapper.exe' ; 2x
Global $sciteExe = 'SciTE.exe'
Global $sciteWindowClass = '[CLASS:SciTEWindow]'
; SciTE variable
Global $SciTECmd = 0HotKeySet('^!{F5}', '_restart')
[/autoit] [autoit][/autoit] [autoit]While 1
[/autoit] [autoit][/autoit] [autoit]
Sleep(500)
WEndFunc _restart()
[/autoit] [autoit][/autoit] [autoit]
AdlibUnRegister('_selfExit')
While ProcessExists($autoit3Exe) Or ProcessExists($autoit3Wrapper)
ProcessClose($autoit3Exe)
ProcessClose($autoit3Wrapper)
Sleep(500) ; some time before the refresh starts
_RefreshSystemTray()
WEnd
_runScriptInSciTE()
EndFunc ;==>_restart; Activating SciTE and sending the command for "GO" F5
[/autoit] [autoit][/autoit] [autoit]
Func _runScriptInSciTE()
If Not WinExists($sciteWindowClass, '') Or Not ProcessExists($sciteExe) Then
MsgBox(16, 'Restart', 'No restart, because there is SciTE running')
Exit (0)
EndIf
SendSciTE_Command('menucommand:420') ; Clear Output
SendSciTE_Command('output:+> ' & '===============================================================================' & '\n')
SendSciTE_Command('output:+> Restarting ... --> ' & _scriptName() & '\n')
SendSciTE_Command('output:+> ' & '===============================================================================' & '\n')
Sleep(250)
WinActivate($sciteWindowClass, '')
SendSciTE_Command('menucommand:' & _checkStableOrBeta()) ; GO
Exit (0)
EndFunc ;==>_runScriptInSciTE; If no AutoIt3.exe or AutoIt3Wrapper.exe exists, then exit
[/autoit] [autoit][/autoit] [autoit]
Func _SelfExit()
If ProcessExists($autoit3Exe) = 0 And ProcessExists($autoit3Wrapper) = 0 Then Exit (0)
EndFunc ;==>_SelfExitFunc _checkStableOrBeta()
[/autoit] [autoit][/autoit] [autoit]
Local $command = 0
If $cmdLine[0] > 0 Then
If StringInStr($cmdLine[1], 'beta') = 0 Then
$command = '303' ; stable
Else
$command = '1100' ; beta
EndIf
Return $command
EndIf
MsgBox(16, 'Stable or Beta', 'Could not find Stable or Beta command')
Exit(0)
EndFunc ;==>_checkStableOrBeta;===============================================================================
[/autoit] [autoit][/autoit] [autoit]
; Description: Sending commands to SciTE interface
;===============================================================================
Func SendSciTE_Command($sCmd, $Wait_For_Return_Info = 0)
Local $WM_GETTEXT = 0x000D
Local $WM_GETTEXTLENGTH = 0x000E224
Local Const $SCI_GETLINE = 2153
Local $Scite_hwnd = WinGetHandle('DirectorExtension') ; Get SciTE Director Handle
Local $My_Hwnd = GUICreate('AutoIt3-SciTE interface') ; Create GUI to receive SciTE info
Local $My_Dec_Hwnd = Dec(StringTrimLeft($My_Hwnd, 2)) ; Convert my Gui Handle to decimal
$sCmd = ':' & $My_Dec_Hwnd & ':' & $sCmd ; Add dec my gui handle to commandline to tell SciTE where to send the return info
Local $CmdStruct = DllStructCreate('Char[' & StringLen($sCmd) + 1 & ']')
DllStructSetData($CmdStruct, 1, $sCmd)
Local $COPYDATA = DllStructCreate('Ptr;DWord;Ptr')
DllStructSetData($COPYDATA, 1, 1)
DllStructSetData($COPYDATA, 2, StringLen($sCmd) + 1)
DllStructSetData($COPYDATA, 3, DllStructGetPtr($CmdStruct))
DllCall('User32.dll', 'None', 'SendMessage', 'HWnd', $Scite_hwnd, _
'Int', $WM_COPYDATA, 'HWnd', $My_Hwnd, _
'Ptr', DllStructGetPtr($COPYDATA))
GUIDelete($My_Hwnd)
EndFunc ;==>SendSciTE_Command
;===============================================================================
; Description: Sending commands to SciTE interface
;===============================================================================
Func MY_WM_COPYDATA($hWnd, $msg, $wParam, $lParam)
Local $COPYDATA = DllStructCreate('Ptr;DWord;Ptr', $lParam)
Local $SciTECmdLen = DllStructGetData($COPYDATA, 2)
Local $CmdStruct = DllStructCreate('Char[255]', DllStructGetData($COPYDATA, 3))
$SciTECmd = StringLeft(DllStructGetData($CmdStruct, 1), $SciTECmdLen)
EndFunc ;==>MY_WM_COPYDATAFunc _scriptName()
[/autoit] [autoit][/autoit] [autoit]
Local $opt = Opt('WinTitleMatchMode', 4)
SendSciTE_Command('askfilename:')
$SciTECmd = StringReplace($SciTECmd, '\\', '\')
Local $filename = StringTrimLeft($SciTECmd, StringInStr($SciTECmd, ':', Default, 3))
Local $scriptDirPath = StringLeft($filename, StringInStr($filename, '\', Default, -1))
Opt('WinTitleMatchMode', $opt)
Return StringMid($filename, StringInStr($filename, '\', 2, -1) + 1, 100)
EndFunc ;==>_scriptName; ===================================================================
[/autoit] [autoit][/autoit] [autoit]
; Removes any dead icons from the notification area.
; Parameters:
; $nDelay - IN/OPTIONAL - The delay to wait for the notification area to expand with Windows XP's
; 'Hide Inactive Icons' feature (In milliseconds).
; Returns:
; Sets @error on failure:
; 1 - Tray couldn't be found.
; 2 - DllCall error.
; ===================================================================
Func _RefreshSystemTray($nDelay = 1000)
; Save Opt settings
Local $oldMatchMode = Opt('WinTitleMatchMode', 4)
Local $oldChildMode = Opt('WinSearchChildren', 1)
Local $error = 0
Do; Pseudo loop
Local $hWnd = WinGetHandle('classname=TrayNotifyWnd')
If @error Then
$error = 1
ExitLoop
EndIfLocal $hControl = ControlGetHandle($hWnd, '', 'Button1')
[/autoit] [autoit][/autoit] [autoit]; We're on XP and the Hide Inactive Icons button is there, so expand it
[/autoit] [autoit][/autoit] [autoit]
If $hControl <> '' And ControlCommand($hWnd, '', $hControl, 'IsVisible', '') Then
ControlClick($hWnd, '', $hControl)
Sleep($nDelay)
EndIfLocal $posStart = MouseGetPos()
[/autoit] [autoit][/autoit] [autoit]
Local $posWin = WinGetPos($hWnd)Local $y = $posWin[1]
[/autoit] [autoit][/autoit] [autoit]
While $y < $posWin[3] + $posWin[1]
Local $x = $posWin[0]
While $x < $posWin[2] + $posWin[0]
DllCall('user32.dll', 'int', 'SetCursorPos', 'int', $x, 'int', $y)
If @error Then
$error = 2
ExitLoop 3; Jump out of While/While/Do
EndIf
$x += 8
WEnd
$y += 8
WEnd
DllCall('user32.dll', 'int', 'SetCursorPos', 'int', $posStart[0], 'int', $posStart[1])
; We're on XP so we need to hide the inactive icons again.
If $hControl <> '' And ControlCommand($hWnd, '', $hControl, 'IsVisible', '') Then
ControlClick($hWnd, '', $hControl)
EndIf
Until 1; Restore Opt settings
[/autoit] [autoit][/autoit] [autoit][/autoit]
Opt('WinTitleMatchMode', $oldMatchMode)
Opt('WinSearchChildren', $oldChildMode)
SetError($error)
EndFunc ;==>_RefreshSystemTrayAnschließend kann in SciTE durch STRG+ALT+F5 das laufende Skript beendet und neu gestartet werden.
Mega
P.S: Ich weiß, viel Aufwand, aber manchmal braucht man sowas ja zum Testen

-
Hier ein altes Skript, welches noch gehen sollte.
Spoiler anzeigen
[autoit]Opt('SendKeyDelay', 1)
[/autoit] [autoit][/autoit] [autoit]
Opt('WinTitleMatchMode', 2)
#include <string.au3>Global Const $waitTitle = 'Lotus Notes'
[/autoit] [autoit][/autoit] [autoit]
Global Const $waitTitle2 = '- XXX eG'
Global Const $waitTitle3 = 'Arbeitsbereich'
Global Const $process = 'nlnotes.exe'
Global Const $defaultPath = 'C:\Programme\Notes\nlnotes.exe'
Global Const $password = 'XXX'_run()
[/autoit] [autoit][/autoit] [autoit]
Exit (0)Func _run()
[/autoit]
;~ Local $password = _StringEncrypt(0, IniRead($pathPWD, 'Notes', 'PWD', 'Not Found'), @UserName & @ComputerName & RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "InstallDate"), 2)
ShellExecute($defaultPath, '', '', 'open', @SW_SHOW)
If WinWait($waitTitle, '', 40) = 0 Then Exit (0)
WinSetState($waitTitle2, '', @SW_MAXIMIZE)
ControlFocus($waitTitle, '', '')
ControlSend($waitTitle, '', '', $password & '{Enter}')
If WinWait($waitTitle3, '', 20) = 0 Then Exit (0)
ControlSend($waitTitle3, '', '', '!l1')
EndFunc ;==>_run