Ja... Oder geht meine Uhr falsch? ![]()
Jetzt ist es 17:38...
So wie ich das sehe ist die Serveruhr um ne stunde verschoben...
Ja... Oder geht meine Uhr falsch? ![]()
Jetzt ist es 17:38...
So wie ich das sehe ist die Serveruhr um ne stunde verschoben...
Wow... Bei mir steht beim Post
ZitatHatte mal das selbe Problem (Ich hasse Avira) und bin deshalb auf Norton umgestiegen... Avira erkennt irgendwie alles als Virus...
Als Datum "Heute, 18:13... Es istr gerade 17:20
Ist die serverzeit falsch eingestellt? ![]()
Zu Avira:
Mein avira erkennt auch alles als virus... Wenn du spaß dran hast lädst du dir ne Bullguard demo und avira in ne Viurtal Machine, und installierst beide... Avira wird Bullguard zerhacken... (Hatte das mal...) Sowas kannst du ja mal mit meherern Virenschützen versuchen, dabei alles aufzeichnen, und am Ende als Antiviruskampf verkaufen ![]()
Ich nehm avast... Norton hat n schlechten ruf...
Avast findet fast alles!
Das Schwert
Ja, hatte ich vergessen rein zu schreiben. Hab ich jetzt nachgetragen... Danke ![]()
Neue version
==>Nun auch unterstützung für waves (.wav)
==>Nun eine zurückspul funktion, die noch nicht läuft (Wenn man auf {MEDIA_PREV} drück (|<<) dann kommt ein neuer song der nach Zufall (???) ausgewählt wird
==>Vorspul funktionsbugs: Irgendwann spult er einfach nicht mehr weiter, wenn man dann zurück drückt crasht das programm (Array variable has incorrect number of subscripts or subscript dimension range exceeded)
==>Nun über die MEDIA keys! (|<<, >>|, play/pause, und stop eingebaut. Stop beendet (strg alt q geht auchnoch), play pause tut das was der name sagt ;-), genauso wie vorspulen. Nur zurück macht was es will ![]()
==>Random toggle ToolTip bleibt nun nichtmehr auf dem Desktop
==>Hotkeys verändert:
Alt______ | Neu__________________| Funktion
-----------------|----------------------------------------|-------------------------
strg+alt+q | strg+alt+q /// MEDIA_STOP| Beenden
strg+alt+n|____MEDIA_NEXT________| Nächster titel
strg+alt+r|____strg+alt+s (shuffle)___| Radom playing an/aus
strg+alt+g|_____strg+alt+a_________| Grafische oberfläche für optionen usw. aufrufen
gabs nich| ___MEDIA_PREV________| Vorheriger titel
gabs nich|___MEDIA_PLAY/PAUSE__| Start / Pause für song
Meine Probleme:
--> Zum flackern: Ich weiß ich nicht wieso es das tut, er aktuelisert eigentlch nur jede sekunde...
-->Keine Ahnung wie ich das Zurückspulen hinkrigen soll (Versucht bitte nicht mir zu helfen, könnte zu irreeparablen hirnschäden füren, da das Gehirn überlastet wird. Ich check den code selber nurnoch zu teilen ![]()
To do:
-->Alles unter Meine Probleme lösen
-->BugFixen
-->Jemand noch ne Idee? PM schicken oder hier Posten!
Quelltext:
#include <File.au3>
#include <Sound.au3>
#include <Array.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
If IniRead (@ScriptDir & "\config.ini", "ops", "path", "error") == "error" Then
MsgBox (32, "Error!", "No path for mp3 files found in config.ini! Please set one!")
$newpath = FileSelectFolder ("Path for mp3's", "")
If @error Then Exit
IniWrite (@ScriptDir & "\config.ini", "ops", "path", $newpath)
EndIf
$isplayed = False
If $CMDLINE[0] <> 0 Then
If $CMDLINE[1] == "restart" Then
$thissong = IniRead (@ScriptDir & "\config.ini", "save", "lastSong", "error")
IniDelete (@ScriptDir & "\config.ini", "save", "lastSong")
If $thissong = "error" Then $CMDLINE[1] = ""
EndIf
EndIf
$getsong = False
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;All Features wich you can enable/disable are shown here
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
HotKeySet ("{MEDIA_NEXT}", "nextSong") ;Press the >>| key for next song for next song
HotKeySet ("{MEDIA_PREV}", "prevSong")
HotKeySet ("!^s", "rand") ;Press ctrl+alt+s to disable/enable random playing
HotKeySet ("{MEDIA_STOP}", "quit") ;Press the stop button to quit
HotKeySet ("!^q", "quit") ;If you don't have stop, just play/pause (like me) then u can press ctrl+alt+q for quit
HotKeySet ("!^i", "info") ;Press ctrl+alt+i to get now playing filename
HotKeySet ("!^a", "gui");Press ctrl+alt+a for GUI (A config etc. window)
HotKeySet ("{MEDIA_PLAY_PAUSE}", "pausePlay")
$showTitle = IniRead (@ScriptDir & "\config.ini", "ops", "showSongTitle", True)
;If $showTitle = "True" Then $showTitle = True
;@If $showTitle = "False" Then $showTitle = False
;;;; This program can only play .mp3's! (I think it can play other formats too, but if there e.g is a textfile in the folder the program will crash, if i don't just enable mp3's...
$rndList = _ArrayCreate ("")
$rand = IniRead (@ScriptDir & "\config.ini", "ops", "DefaultRandomState", True)
$path = IniRead (@ScriptDir & "\config.ini", "ops", "path", @ScriptDir)
If StringInStr ($path, "@ScriptDir") Then
$splt = StringSplit ($path, "@ScriptDir")
If $splt[1] == "" Then
$splt[1] = @ScriptDir ;Replace @ScriptDir to the real scriptpath
ElseIf $splt[1] <> "" Then
$x = 0
Do
$x += 1
Until $splt[$x] == ""
$splt[$x] = @ScriptDir ;Replace @ScriptDir to the real scriptpath
EndIf
EndIf
If StringInStr ($path, "@UserProfileDir") Then
$splt = StringSplit ($path, "@UserProfileDir")
If $splt[1] == "" Then
$splt[1] = @UserProfileDir ;Replace @ScriptDir to the real scriptpath
ElseIf $splt[1] <> "" Then
$x = 0
Do
$x += 1
Until $splt[$x] == ""
$splt[$x] = @UserProfileDir ;Replace @ScriptDir to the real scriptpath
EndIf
EndIf
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;To here
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$continue = False
While 1
$playedLst = ""
Global $playedLst[1]
$lst = check ()
If Not IsArray ($lst) Then
MsgBox (32, "Error: not files found!", "No supported files found in " & $path & "! Waiting for files.")
$exit = False
While 1
Sleep (1000)
$lst = check ()
If $exit = True Then ExitLoop
If IsArray ($lst) Then
$listgui = GUICreate("Generate list", 194, 119, 192, 124)
$Label1 = GUICtrlCreateLabel('Files found. Please klick "Ok" when', 8, 16, 174, 17)
$Label2 = GUICtrlCreateLabel("you are ready with moving / copying", 8, 32, 175, 17)
$Label3 = GUICtrlCreateLabel("new files into the song-folder.", 8, 48, 141, 17)
$goon = GUICtrlCreateButton("Ok", 56, 80, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
While 1
$msg = GUIGetMsg ()
If $msg = -3 Then Exit
If $msg = $goon Then ExitLoop
WEnd
GUIDelete ()
$exit = True
EndIf
WEnd
MsgBox (0, "Files found", "Found " & $lst[0] & " files. Press ctrl+alt+g AFTER YOU PRESSED OK and switch to 'now playing' to get a list of found songs! Supported file formats are wav and mp3.")
EndIf
$i = 1
Do
$getsong = IniRead (@ScriptDir & "\config.ini", "saves", "getSong", "False")
If $rand = True And $lst[0] <> UBound ($rndList) And $getsong = "False" Then
Do
$i = Random (1, $lst[0])
$splt = StringSplit ($i, ".")
$i = $splt[1]
Until _ArraySearch ($rndList, $i) == -1
_ArrayAdd ($rndList, $i)
$rndList[0] = UBound ($rndList)
ElseIf $lst[0] == UBound ($rndList) Then
$rndList = 0
$rndList = _ArrayCreate ("")
EndIf
If $getsong = "False" Then
IniWrite (@ScriptDir & "\config.ini", "saves", "Song", $lst[$i])
$open = _SoundOpen ($path & "\" & $lst[$i])
ElseIf $getsong = "True" Then
$open = _SoundOpen (IniRead (@ScriptDir & "\config.ini", "saves", "Song", "error"))
IniDelete (@ScriptDir & "\config.ini", "saves", "getSong")
EndIf
If $CMDLINE[0] <> 0 Then
If $isplayed = False Then
If $CMDLINE[1] == "restart" Then
$open = _SoundOpen ($path & "\" & $thissong)
$isplayed = True
EndIf
EndIf
EndIf
_ArrayAdd ($playedLst, $i)
_SoundPlay ($open)
If $showTitle == True Then
If $getsong = "False" Then ToolTip ("Now playing " & $lst[$i])
If $getsong = "True" Then
ToolTip ("Now playing " & IniRead (@ScriptDir & "\config.ini", "saves", "song", "[Error!]"))
EndIf
EndIf
If $showTitle == True Then $init = TimerInit ()
$stop = False
Do
If $stop = True Then ExitLoop
Sleep (100)
If $showTitle == True Then
If TimerDiff ($init) >= 1500 Then ToolTip ("") ;Show 1,5 seconds the new title
EndIf
Until _SoundPos ($open) == _SoundLength ($open)
$i += 1
If $stop = False Then _SoundClose ($open)
Until $i = -1 = $lst[0]
WEnd
Func NEXTSONG ()
_SoundStop ($open)
_SoundClose ($open)
$stop = True
EndFunc
FUNC PREVSONG ()
_SoundStop ($open)
_SoundClose ($open)
$iniwrite = $lst[UBound ($playedLst)-1]
$open = _SoundOpen ($path & "\" & $lst[$i])
IniWrite (@ScriptDir & "\config.ini", "saves", "song", $iniwrite)
$stop = True
IniWrite (@ScriptDir & "\config.ini", "saves", "getSong", "True")
ENDFUNC
FUNC RAND ()
If $rand = True Then
ToolTip ("Random off")
$rand = False
ElseIf $rand = False Then
ToolTip ("Random on")
$rand = True
EndIf
$init = TimerInit ()
Do
Sleep (100)
Until TimerDiff ($init) >= 200 ;Show 0,2 seconds the random state
ENDFUNC
FUNC QUIT ()
Exit
ENDFUNC
FUNC INFO ()
ToolTip (IniRead (@ScriptDir & "\config.ini", "saves", "Song", "error"))
$init = TimerInit ()
Do
Sleep (100)
Until TimerDiff ($init) >= 1500 ; Show 1,5 seconds the title
ToolTip ("")
ENDFUNC
FUNC GUI ()
ToolTip ("")
#Region ### START Koda GUI section ### Form=C:\Users\----\Desktop\Music\Form1.kxf
$Form1 = GUICreate("Backround muzik GUI", 625, 443, 192, 124)
$tab = GUICtrlCreateTab(0, 0, 617, 441)
GUICtrlSetFont(-1, 8, 400, 0, "Courier New")
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$TabSheet1 = GUICtrlCreateTabItem("Now playing")
$Label7 = GUICtrlCreateLabel("Song", 72, 32, 29, 17)
$songlist = GUICtrlCreateList("", 72, 56, 201, 370)
$Label8 = GUICtrlCreateLabel("Now playing", 224, 32, 62, 17)
$PlayMarkedSong = GUICtrlCreateButton("Play marked song", 288, 400, 115, 25, $WS_GROUP)
$timeplayed = GUICtrlCreateLabel("Time played:", 288, 344, 136, 17)
$timeleft = GUICtrlCreateLabel("Song length:", 432, 344, 119, 17)
$TabSheet2 = GUICtrlCreateTabItem("Ini Configuration")
$auostartBackMuz = GUICtrlCreateCheckbox("Put Backround muzik into startup (Autorun Backround muzik on windows start)", 56, 120, 521, 17)
$autornd = GUICtrlCreateCheckbox("Autostart random playing", 56, 56, 521, 17)
If IniRead (@ScriptDir & "\config.ini", "ops", "DefaultRandomPlaying", True) == True Then GUICtrlSetState ($autornd, $GUI_CHECKED)
$regstart = GUICtrlCreateRadio("Autostart over reg-entry", 88, 160, 481, 17)
$folderstart = GUICtrlCreateRadio("Autostart over startupfolder", 88, 184, 505, 17)
If RegRead ("HKCU\Software\Microsoft\Windows\CurrentVersion\Run", "Background Muzik") Or RegRead ("HKLM\Software\Microsoft\Windows\CurrentVersion\Run", "Background Muzik") Then
GUICtrlSetState ($regstart, $GUI_CHECKED)
GUICtrlSetState ($auostartBackMuz, $GUI_CHECKED)
ElseIf FileExists (@StartupCommonDir & "\Background Muzik.lnk") Or FileExists (@StartupDir & "\Background Muzik.lnk") Then
GUICtrlSetState ($folderstart, $GUI_CHECKED)
GUICtrlSetState ($auostartBackMuz, $GUI_CHECKED)
Else
GUICtrlSetState ($regstart, $GUI_CHECKED)
EndIf
$everyone = GUICtrlCreateCheckbox("For everyone who uses this computer", 88, 208, 505, 17)
$save = GUICtrlCreateButton("Save changes", 56, 360, 91, 25, $WS_GROUP)
$restart = GUICtrlCreateButton("Restart program (Required for new mp3 path)", 152, 360, 267, 25, $WS_GROUP)
$showTitelfield = GUICtrlCreateCheckbox("Show new songtitel if next song starts", 56, 264, 521, 17)
If IniRead (@ScriptDir & "\config.ini", "ops", "showSongTitle", True) == True Then GUICtrlSetState ($showTitelfield, $GUI_CHECKED)
$Label11 = GUICtrlCreateLabel("Folder with mp3's:", 8, 304, 88, 17)
$folderpath = GUICtrlCreateInput("", 104, 304, 441, 21)
GUICtrlSetData ($folderpath, IniRead (@ScriptDir & "\config.ini", "ops", "path", @ScriptDir))
$changeFolder = GUICtrlCreateButton("Change", 544, 304, 67, 25, $WS_GROUP)
$TabSheet3 = GUICtrlCreateTabItem("About")
GUICtrlSetState(-1,$GUI_SHOW)
$Label1 = GUICtrlCreateLabel("Backround muzik by Das Schwert (The Sword)", 32, 64, 225, 17)
$Label2 = GUICtrlCreateLabel("For support etc send a mail to [email='schwertsoft@web.de'][/email].", 32, 80, 249, 17)
$Label3 = GUICtrlCreateLabel("Homepage:", 32, 96, 59, 17)
$HPLnk = GUICtrlCreateLabel("http://schwertsoft.ucoz.com", 96, 96, 138, 17)
GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetCursor (-1, 0)
$Label5 = GUICtrlCreateLabel("(This page is german!)", 240, 96, 108, 17)
$Label6 = GUICtrlCreateLabel("If you have any idea to make my progs better, then send it to me!", 32, 128, 309, 17)
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$c = 1
$string = ""
Do
If $lst[$c] <> $lst[$i] And $lst[$c] <> IniRead (@ScriptDir & "\config.ini", "saves", "Song", "error") Then
$string &= $lst[$c] & "|"
ElseIf $lst[$c] == IniRead (@ScriptDir & "\config.ini", "saves", "Song", "error") Then
$string &= IniRead (@ScriptDir & "\config.ini", "saves", "Song", "error") & "------Playing...|"
Endif
$c += 1
Until $c = $lst[0]
$string &= $lst[$c]
GUICtrlSetData ($songlist, $string)
$init2 = TimerInit ()
$last = 0
While 1
If TimerDiff ($init2) + 1000 >= $last Then
$last = TimerDiff ($init2)
$played = _SoundPos ($open)
GUICtrlSetData ($timeplayed, $played)
GUICtrlSetData ($timeleft, _SoundLength ($open))
EndIf
$msg = GUIGetMsg ()
If $msg = -3 And (MsgBox (36, "Warning!", "If you close the window before klicking 'Save changes' all changes will be lost!") == 6) Then
GUIDelete ()
Return 0
EndIf
If $msg = $PlayMarkedSong Then
$song = GUICtrlRead ($songlist)
$i = 1
Do
If $lst[$i] == $song Then
ExitLoop
EndIf
$i += 1
Until $lst[0] = $i -1
_SoundStop ($open)
_SoundClose ($open)
;$i -= 1
$iniwrite = $lst[$i]
$open = _SoundOpen ($path & "\" & $lst[$i])
IniWrite (@ScriptDir & "\config.ini", "saves", "song", $iniwrite)
$stop = True
IniWrite (@ScriptDir & "\config.ini", "saves", "getSong", "True")
GUIDelete ()
Return 0
EndIf
If $msg = $save Then
RegDelete ("HKLM\Software\Microsoft\Windows\CurrentVersion\Run", "Background Muzik")
RegDelete ("HKCU\Software\Microsoft\Windows\CurrentVersion\Run", "Background Muzik")
FileDelete (@StartupCommonDir & "\Background Muzik.lnk")
FileDelete (@StartupDir & "\Background Muzik.lnk")
If GUICtrlRead ($showTitelfield) == $GUI_CHECKED Then
IniWrite (@ScriptDir & "\config.ini", "ops", "showSongTitle", True)
ElseIf GUICtrlRead ($showTitelfield) == $GUI_UNCHECKED Then
IniWrite (@ScriptDir & "\config.ini", "ops", "showSongTitle", False)
EndIf
If GUICtrlRead ($autornd) == $GUI_CHECKED Then
IniWrite (@ScriptDir & "\config.ini", "ops", "DefaultRandomPlaying", True)
Else
IniWrite (@ScriptDir & "\config.ini", "ops", "DefaultRandomPlaying", False)
EndIf
IniWrite (@ScriptDir & "\config.ini", "ops", "path", GUICtrlRead ($folderpath))
If GUICtrlRead ($auostartBackMuz) == $GUI_CHECKED Then
If GUICtrlRead ($everyone) == $GUI_CHECKED Then
$users = "everyone"
ElseIf GUICtrlRead ($everyone) == $GUI_UNCHECKED Then
$user = "me"
EndIf
If GUICtrlRead ($regstart) == $GUI_CHECKED Then
$startmethode = "reg"
ElseIf GUICtrlRead ($folderstart) == $GUI_CHECKED Then
$startmethode = "folder"
EndIf
If $startmethode = "reg" Then
If $user == "me" Then
RegWrite ("HKCU\Software\Microsoft\Windows\CurrentVersion\Run", "Background Muzik", "REG_SZ", @ScriptFullPath)
ElseIf $user == "everyone" Then
RegWrite ("HKCU\Software\Microsoft\Windows\CurrentVersion\Run", "Background Muzik", "REG_SZ", @ScriptFullPath)
EndIf
ElseIf $startmethode = "folder" Then
If $user = "everyone" Then
FileCreateShortcut (@ScriptFullPath, @StartupCommonDir & "\Background Muzik.lnk")
ElseIf $user = "me" Then
FileCreateShortcut (@ScriptFullPath, @StartupDir & "\Background Muzik.lnk")
Else
MsgBox (32, "Fatal error!", "Fatal error!")
EndIf
EndIf
EndIf
EndIf
If $msg = $restart Then
IniWrite (@ScriptDir & "\config.ini", "saves", "lastSong", $lst[$i])
ShellExecute (@ScriptFullPath, "restart")
Exit
EndIf
If $msg = $HPLnk Then
$splt = StringSplit (RegRead("HKEY_CLASSES_ROOT\http\shell\open\command", ""), '"')
$browser = $splt[2]
ShellExecute ($browser, "http://schwertsoft.ucoz.com")
EndIf
WEnd
ENDFUNC
FUNC ONAUTOITEXIT ()
IniDelete (@ScriptDir & "\config.ini", "saves", "song")
IniDelete (@ScriptDir & "\config.ini", "saves", "getSong")
ENDFUNC ;Made by Das Schwert
FUNC CHECK ()
$lst = _FileListToArray ($path, "*.wav")
$lst2 = _FileListToArray ($path, "*.mp3")
If IsArray ($lst) And IsArray ($lst2) Then
$v = 1
Do
_ArrayAdd ($lst, $lst2[$v])
$v += 1
Until $v -1 = $lst[0]
$lst[0] = UBound ($lst)
ElseIf IsArray ($lst2) Then
$lst = 0
$lst = _FileListToArray ($path, "*.mp3")
ElseIf IsArray ($lst) Then
$lst2 = 0;Just to stay clean and don't fill the memory with useless stuff
EndIf
Return $lst
ENDFUNC
FUNC PAUSEPLAY ()
If _SoundStatus ($open) == "playing" Then
_SoundPause ($open)
ElseIf _SoundStatus ($open) == "paused" Then
_SoundPlay ($open)
Else
MsgBox (0, "Failure", "Can't start/stop sound when sound status is " & _SoundStatus ($open) & ".")
EndIf
EndFunc
Zur ini file: Keine Ini mehr benötigt.
Alle optionen lassen sich über strg+alt+g lösen!!! ![]()
Naja, hast du mal geguckt wie lange der meida player zum starten braucht, und wie lange mein skript startet? ![]()
Nochmal zum Post davor:
Ist jetzt verbessert, da fehlte ne Zeile, was zum totalen crash geführt hat.
Und in der config.ini stimmte auch was nicht...
=>Bugs entfernt...
==>Nun läuft das manuelle auswählen von Lieder (über GUI) richtig.
=>Ich habe eine bearbeitete (mit Kommentaren versehene) Version der config.ini als Spoiler dabei...
Script
#include <File.au3>
#include <Sound.au3>
#include <Array.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
If IniRead (@ScriptDir & "\config.ini", "ops", "path", "error") == "error" Then
MsgBox (32, "Error!", "No path for mp3 files found in config.ini! Please set one!")
$newpath = FileSelectFolder ("Path for mp3's", @DesktopDir)
If @error Then Exit
IniWrite (@ScriptDir & "\config.ini", "ops", "path", $newpath)
EndIf
$isplayed = False
If $CMDLINE[0] <> 0 Then
If $CMDLINE[1] == "restart" Then
$thissong = IniRead (@ScriptDir & "\config.ini", "save", "lastSong", "error")
IniDelete (@ScriptDir & "\config.ini", "save", "lastSong")
If $thissong = "error" Then $CMDLINE[1] = ""
EndIf
EndIf
$getsong = False
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;All Features wich you can enable/disable are shown here
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
HotKeySet ("!^n", "nextSong") ;Press ctrl+alt+n for next song
HotKeySet ("!^r", "rand") ;Press ctrl+alt+r to disable/enable random playing
HotKeySet ("!^q", "quit") ;Press ctrl+alt+q to quit
HotKeySet ("!^i", "info") ;Press ctrl+alt+i to get now playing filename
HotKeySet ("!^g", "gui") ;Press ctrl+alt+g for GUI (A config etc. window)
$showTitle = IniRead (@ScriptDir & "\config.ini", "ops", "showSongTitle", True)
;If $showTitle = "True" Then $showTitle = True
;@If $showTitle = "False" Then $showTitle = False
;;;; This program can only play .mp3's! (I think it can play other formats too, but if there e.g is a textfile in the folder the program will crash, if i don't just enable mp3's...
$rndList = _ArrayCreate ("")
$rand = IniRead (@ScriptDir & "\config.ini", "ops", "DefaultRandomState", True)
$path = IniRead (@ScriptDir & "\config.ini", "ops", "path", @ScriptDir)
If StringInStr ($path, "@ScriptDir") Then
$splt = StringSplit ($path, "@ScriptDir")
If $splt[1] == "" Then
$splt[1] = @ScriptDir ;Replace @ScriptDir to the real scriptpath
ElseIf $splt[1] <> "" Then
$x = 0
Do
$x += 1
Until $splt[$x] == ""
$splt[$x] = @ScriptDir ;Replace @ScriptDir to the real scriptpath
EndIf
EndIf
If StringInStr ($path, "@UserProfileDir") Then
$splt = StringSplit ($path, "@UserProfileDir")
If $splt[1] == "" Then
$splt[1] = @UserProfileDir ;Replace @ScriptDir to the real scriptpath
ElseIf $splt[1] <> "" Then
$x = 0
Do
$x += 1
Until $splt[$x] == ""
$splt[$x] = @UserProfileDir ;Replace @ScriptDir to the real scriptpath
EndIf
EndIf
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;To here
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
While 1
$lst = _FileListToArray ($path, "*.mp3")
If Not IsArray ($lst) Then
MsgBox (32, "Error: not files found!", "No supported files found in " & $path & "! Waiting for files.")
Do
Sleep (3000)
$lst = _FileListToArray ($path, "*.mp3")
Until IsArray ($lst)
EndIf
$i = 1
Do
$getsong = False
$getsong = IniRead (@ScriptDir & "\config.ini", "saves", "getSong", "False")
If $rand = True And $lst[0] <> $rndList[0] And $getsong = "False" Then
Do
$i = Random (1, $lst[0])
$splt = StringSplit ($i, ".")
$i = $splt[1]
Until _ArraySearch ($rndList, $i) == -1
_ArrayAdd ($rndList, $i)
$rndList[0] = UBound ($rndList)
ElseIf $lst[0] == $rndList[0] Then
$rndList = 0
$rndList = _ArrayCreate ("")
EndIf
If $getsong = "False" Then
IniWrite (@ScriptDir & "\config.ini", "saves", "Song", $lst[$i])
$open = _SoundOpen ($path & "\" & $lst[$i])
EndIf
_SoundPlay ($open)
If $CMDLINE[0] <> 0 Then
If $isplayed = False Then
If $CMDLINE[1] == "restart" Then
$open = _SoundOpen ($path & "\" & $thissong)
$isplayed = True
EndIf
EndIf
EndIf
If $showTitle == True Then
If $getsong = "False" Then ToolTip ("Now playing " & $lst[$i])
If $getsong = "True" Then
ToolTip ("Now playing " & IniRead (@ScriptDir & "\config.ini", "saves", "song", "[Error!]"))
EndIf
EndIf
If $showTitle == True Then $init = TimerInit ()
$stop = False
Do
If $stop = True Then ExitLoop
Sleep (100)
If $showTitle == True Then
If TimerDiff ($init) >= 1500 Then ToolTip ("") ;Show 1,5 seconds the new title
EndIf
Until _SoundPos ($open) == _SoundLength ($open)
IniDelete (@ScriptDir & "\config.ini", "saves", "getSong")
$getsong = False
$i += 1
If $stop = False Then _SoundClose ($open)
Until $i = -1 = $lst[0]
WEnd
Func nextSong ()
_SoundStop ($open)
_SoundClose ($open)
$stop = True
EndFunc
FUNC RAND ()
If $rand = True Then
ToolTip ("Random off")
$rand = False
ElseIf $rand = False Then
ToolTip ("Random on")
$rand = True
EndIf
$init = TimerInit ()
Do
Sleep (100)
Until TimerDiff ($init) >= 200 ;Show 0,2 seconds the random state
ENDFUNC
FUNC QUIT ()
Exit
ENDFUNC
FUNC INFO ()
ToolTip (IniRead (@ScriptDir & "\config.ini", "saves", "Song", "error"))
$init = TimerInit ()
Do
Sleep (100)
Until TimerDiff ($init) >= 1500 ; Show 1,5 seconds the title
ToolTip ("")
ENDFUNC
FUNC GUI ()
ToolTip ("")
#Region ### START Koda GUI section ### Form=C:\Users\----\Desktop\Music\Form1.kxf
$Form1 = GUICreate("Backround muzik GUI", 625, 443, 192, 124)
$tab = GUICtrlCreateTab(0, 0, 617, 441)
GUICtrlSetFont(-1, 8, 400, 0, "Courier New")
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$TabSheet1 = GUICtrlCreateTabItem("Now playing")
$Label7 = GUICtrlCreateLabel("Song", 72, 32, 29, 17)
$songlist = GUICtrlCreateList("", 72, 56, 201, 370)
$Label8 = GUICtrlCreateLabel("Now playing", 224, 32, 62, 17)
$PlayMarkedSong = GUICtrlCreateButton("Play marked song", 288, 400, 115, 25, $WS_GROUP)
$timeplayed = GUICtrlCreateLabel("Time played:", 288, 344, 136, 17)
$timeleft = GUICtrlCreateLabel("Song length:", 432, 344, 119, 17)
$TabSheet2 = GUICtrlCreateTabItem("Ini Configuration")
$auostartBackMuz = GUICtrlCreateCheckbox("Put Backround muzik into startup (Autorun Backround muzik on windows start)", 56, 120, 521, 17)
$autornd = GUICtrlCreateCheckbox("Autostart random playing", 56, 56, 521, 17)
If IniRead (@ScriptDir & "\config.ini", "ops", "DefaultRandomPlaying", True) == True Then GUICtrlSetState ($autornd, $GUI_CHECKED)
$regstart = GUICtrlCreateRadio("Autostart over reg-entry", 88, 160, 481, 17)
$folderstart = GUICtrlCreateRadio("Autostart over startupfolder", 88, 184, 505, 17)
If RegRead ("HKCU\Software\Microsoft\Windows\CurrentVersion\Run", "Background Muzik") Or RegRead ("HKLM\Software\Microsoft\Windows\CurrentVersion\Run", "Background Muzik") Then
GUICtrlSetState ($regstart, $GUI_CHECKED)
GUICtrlSetState ($auostartBackMuz, $GUI_CHECKED)
ElseIf FileExists (@StartupCommonDir & "\Background Muzik.lnk") Or FileExists (@StartupDir & "\Background Muzik.lnk") Then
GUICtrlSetState ($folderstart, $GUI_CHECKED)
GUICtrlSetState ($auostartBackMuz, $GUI_CHECKED)
Else
GUICtrlSetState ($regstart, $GUI_CHECKED)
EndIf
$everyone = GUICtrlCreateCheckbox("For everyone who uses this computer", 88, 208, 505, 17)
$save = GUICtrlCreateButton("Save changes", 56, 360, 91, 25, $WS_GROUP)
$restart = GUICtrlCreateButton("Restart program (Required for new mp3 path)", 152, 360, 267, 25, $WS_GROUP)
$showTitelfield = GUICtrlCreateCheckbox("Show new songtitel if next song starts", 56, 264, 521, 17)
If IniRead (@ScriptDir & "\config.ini", "ops", "showSongTitle", True) == True Then GUICtrlSetState ($showTitelfield, $GUI_CHECKED)
$Label11 = GUICtrlCreateLabel("Folder with mp3's:", 8, 304, 88, 17)
$folderpath = GUICtrlCreateInput("", 104, 304, 441, 21)
GUICtrlSetData ($folderpath, IniRead (@ScriptDir & "\config.ini", "ops", "path", @ScriptDir))
$changeFolder = GUICtrlCreateButton("Change", 544, 304, 67, 25, $WS_GROUP)
$TabSheet3 = GUICtrlCreateTabItem("About")
GUICtrlSetState(-1,$GUI_SHOW)
$Label1 = GUICtrlCreateLabel("Backround muzik by Das Schwert (The Sword)", 32, 64, 225, 17)
$Label2 = GUICtrlCreateLabel("For support etc send a mail to [email='schwertsoft@web.de'][/email].", 32, 80, 249, 17)
$Label3 = GUICtrlCreateLabel("Homepage:", 32, 96, 59, 17)
$HPLnk = GUICtrlCreateLabel("http://schwertsoft.ucoz.com", 96, 96, 138, 17)
GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetCursor (-1, 0)
$Label5 = GUICtrlCreateLabel("(This page is german!)", 240, 96, 108, 17)
$Label6 = GUICtrlCreateLabel("If you have any idea to make my progs better, then send it to me!", 32, 128, 309, 17)
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$c = 1
$string = ""
Do
If $lst[$c] <> $lst[$i] And $lst[$c] <> IniRead (@ScriptDir & "\config.ini", "saves", "Song", "error") Then
$string &= $lst[$c] & "|"
ElseIf $lst[$c] == IniRead (@ScriptDir & "\config.ini", "saves", "Song", "error") Then
$string &= IniRead (@ScriptDir & "\config.ini", "saves", "Song", "error") & "------Playing...|"
Endif
$c += 1
Until $c = $lst[0]
$string &= $lst[$c]
GUICtrlSetData ($songlist, $string)
$init2 = TimerInit ()
$last = 0
While 1
If TimerDiff ($init2) + 1000 >= $last Then
$last = TimerDiff ($init2)
$played = _SoundPos ($open)
GUICtrlSetData ($timeplayed, $played)
GUICtrlSetData ($timeleft, _SoundLength ($open))
EndIf
$msg = GUIGetMsg ()
If $msg = -3 And (MsgBox (36, "Warning!", "If you close the window before klicking 'Save changes' all changes will be lost!") == 6) Then
GUIDelete ()
Return 0
EndIf
If $msg = $PlayMarkedSong Then
$song = GUICtrlRead ($songlist)
$i = 1
Do
If $lst[$i] == $song Then
ExitLoop
EndIf
$i += 1
Until $lst[0] = $i -1
_SoundStop ($open)
_SoundClose ($open)
;$i -= 1
$iniwrite = $lst[$i]
$open = _SoundOpen ($path & "\" & $lst[$i])
IniWrite (@ScriptDir & "\config.ini", "saves", "song", $iniwrite)
$stop = True
IniWrite (@ScriptDir & "\config.ini", "saves", "getSong", "True")
GUIDelete ()
Return 0
EndIf
If $msg = $save Then
RegDelete ("HKLM\Software\Microsoft\Windows\CurrentVersion\Run", "Background Muzik")
RegDelete ("HKCU\Software\Microsoft\Windows\CurrentVersion\Run", "Background Muzik")
FileDelete (@StartupCommonDir & "\Background Muzik.lnk")
FileDelete (@StartupDir & "\Background Muzik.lnk")
If GUICtrlRead ($showTitelfield) == $GUI_CHECKED Then
IniWrite (@ScriptDir & "\config.ini", "ops", "showSongTitle", True)
ElseIf GUICtrlRead ($showTitelfield) == $GUI_UNCHECKED Then
IniWrite (@ScriptDir & "\config.ini", "ops", "showSongTitle", False)
EndIf
If GUICtrlRead ($autornd) == $GUI_CHECKED Then
IniWrite (@ScriptDir & "\config.ini", "ops", "DefaultRandomPlaying", True)
Else
IniWrite (@ScriptDir & "\config.ini", "ops", "DefaultRandomPlaying", False)
EndIf
IniWrite (@ScriptDir & "\config.ini", "ops", "path", GUICtrlRead ($folderpath))
If GUICtrlRead ($auostartBackMuz) == $GUI_CHECKED Then
If GUICtrlRead ($everyone) == $GUI_CHECKED Then
$users = "everyone"
ElseIf GUICtrlRead ($everyone) == $GUI_UNCHECKED Then
$user = "me"
EndIf
If GUICtrlRead ($regstart) == $GUI_CHECKED Then
$startmethode = "reg"
ElseIf GUICtrlRead ($folderstart) == $GUI_CHECKED Then
$startmethode = "folder"
EndIf
If $startmethode = "reg" Then
If $user == "me" Then
RegWrite ("HKCU\Software\Microsoft\Windows\CurrentVersion\Run", "Background Muzik", "REG_SZ", @ScriptFullPath)
ElseIf $user == "everyone" Then
RegWrite ("HKCU\Software\Microsoft\Windows\CurrentVersion\Run", "Background Muzik", "REG_SZ", @ScriptFullPath)
EndIf
ElseIf $startmethode = "folder" Then
If $user = "everyone" Then
FileCreateShortcut (@ScriptFullPath, @StartupCommonDir & "\Background Muzik.lnk")
ElseIf $user = "me" Then
FileCreateShortcut (@ScriptFullPath, @StartupDir & "\Background Muzik.lnk")
Else
MsgBox (32, "Fatal error!", "Fatal error!")
EndIf
EndIf
EndIf
EndIf
If $msg = $restart Then
IniWrite (@ScriptDir & "\config.ini", "saves", "lastSong", $lst[$i])
ShellExecute (@ScriptFullPath, "restart")
Exit
EndIf
If $msg = $HPLnk Then
$splt = StringSplit (RegRead("HKEY_CLASSES_ROOT\http\shell\open\command", ""), '"')
$browser = $splt[2]
ShellExecute ($browser, "http://schwertsoft.ucoz.com")
EndIf
WEnd
ENDFUNC
FUNC ONAUTOITEXIT ()
IniDelete (@ScriptDir & "\config.ini", "saves", "song")
IniDelete (@ScriptDir & "\config.ini", "saves", "getSong")
ENDFUNC ;Made by Das Schwert
Ini
[saves]
==>
==>Don't touch this section! !!! It will be deleted when the program ends! Press CTRL+ALT+Q to exit BackMuz!
==>
song=Lie to me.mp3
getSong=True
[ops]
==>
==>Here you can change options. Some options me only affect after an restart!
==>
DefaultRandomPlaying=True
==>
==>Set to False if you want that it plays the songs from begin with a to begin with z
==>
path=C:\Users\Keno\Desktop\Music
==>
==>Set the folder for the mp3's. Folder can contain other files no Subfolders supported. Will look how to do this.
==>
showSongTitle=False
==>
==>If set to True it will show the new songtitle if a song finshes as ToolTip
==>
EDIT: Eine test MsgBox entfernt, und nen Crash-bug gefixt
Hab den code nochmal (Etwas) verbessert...
Ist jetzt zwar 192 Zeilen länger (304 zeilen), aber hat viele neue Funktionen und n GUI...
Der neue Code:
#include <File.au3>
#include <Sound.au3>
#include <Array.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
$isplayed = False
If $CMDLINE[0] <> 0 Then
If $CMDLINE[1] == "restart" Then
$thissong = IniRead (@ScriptDir & "\config.ini", "save", "lastSong", "error")
IniDelete (@ScriptDir & "\config.ini", "save", "lastSong")
If $thissong = "error" Then $CMDLINE[1] = ""
EndIf
EndIf
$getsong = False
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;All Features wich you can enable/disable are shown here
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
HotKeySet ("!^n", "nextSong") ;Press ctrl+alt+n for next song
HotKeySet ("!^r", "rand") ;Press ctrl+alt+r to disable/enable random playing
HotKeySet ("!^q", "quit") ;Press ctrl+alt+q to quit
HotKeySet ("!^i", "info") ;Press ctrl+alt+i to get now playing filename
HotKeySet ("!^g", "gui") ;Press ctrl+alt+g for GUI (A config etc. window)
$showTitle = IniRead (@ScriptDir & "\config.ini", "ops", "showSongTitle", True)
;If $showTitle = "True" Then $showTitle = True
;@If $showTitle = "False" Then $showTitle = False
;;;; This program can only play .mp3's! (I think it can play other formats too, but if there e.g is a textfile in the folder the program will crash, if i don't just enable mp3's...
$rndList = _ArrayCreate ("")
$rand = IniRead (@ScriptDir & "\config.ini", "ops", "DefaultRandomState", True)
$path = IniRead (@ScriptDir & "\config.ini", "ops", "path", @ScriptDir)
If StringInStr ($path, "@ScriptDir") Then
$splt = StringSplit ($path, "@ScriptDir")
If $splt[1] == "" Then
$splt[1] = @ScriptDir ;Replace @ScriptDir to the real scriptpath
ElseIf $splt[1] <> "" Then
$x = 0
Do
$x += 1
Until $splt[$x] == ""
$splt[$x] = @ScriptDir ;Replace @ScriptDir to the real scriptpath
EndIf
EndIf
If StringInStr ($path, "@UserProfileDir") Then
$splt = StringSplit ($path, "@UserProfileDir")
If $splt[1] == "" Then
$splt[1] = @UserProfileDir ;Replace @ScriptDir to the real scriptpath
ElseIf $splt[1] <> "" Then
$x = 0
Do
$x += 1
Until $splt[$x] == ""
$splt[$x] = @UserProfileDir ;Replace @ScriptDir to the real scriptpath
EndIf
EndIf
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;To here
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
While 1
$lst = _FileListToArray ($path, "*.mp3")
If Not IsArray ($lst) Then
MsgBox (32, "Error: not files found!", "No supported files found in " & $path & "! Waiting for files.")
Do
Sleep (3000)
$lst = _FileListToArray ($path, "*.mp3")
Until IsArray ($lst)
EndIf
$i = 1
Do
$getsong = False
$getsong = IniRead (@ScriptDir & "\config.ini", "saves", "getSong", False)
IniDelete (@ScriptDir & "\config.ini", "saves", "getSong")
If $rand = True And $lst[0] <> $rndList[0] And $getsong = "False" Then
Do
$i = Random (1, $lst[0])
$splt = StringSplit ($i, ".")
$i = $splt[1]
Until _ArraySearch ($rndList, $i) == -1
_ArrayAdd ($rndList, $i)
$rndList[0] = UBound ($rndList)
ElseIf $lst[0] == $rndList[0] Then
$rndList = 0
$rndList = _ArrayCreate ("")
EndIf
If $getsong = "False" Then
$open = _SoundOpen ($path & "\" & $lst[$i])
EndIf
_SoundPlay ($open)
If $CMDLINE[0] <> 0 Then
If $isplayed = False Then
If $CMDLINE[1] == "restart" Then
$open = _SoundOpen ($path & "\" & $thissong)
$isplayed = True
EndIf
EndIf
EndIf
If $showTitle == True Then
If $getsong = "False" Then ToolTip ("Now playing " & $lst[$i])
If $getsong = "True" Then
ToolTip ("Now playing " & IniRead (@ScriptDir & "\config.ini", "saves", "song", "[Error!]"))
IniDelete (@ScriptDir & "\config.ini", "saves", "song")
EndIf
EndIf
IniDelete (@ScriptDir & "\config.ini", "saves", "song")
If $showTitle == True Then $init = TimerInit ()
$stop = False
Do
If $stop = True Then ExitLoop
If $showTitle == True Then
If TimerDiff ($init) >= 1500 Then ToolTip ("") ;Show 1,5 seconds the new title
EndIf
Until _SoundPos ($open) == _SoundLength ($open)
$getsong = False
$i += 1
If $stop = False Then _SoundClose ($open)
Until $i = -1 = $lst[0]
WEnd
Func nextSong ()
_SoundStop ($open)
_SoundClose ($open)
$stop = True
EndFunc
FUNC RAND ()
If $rand = True Then
ToolTip ("Random off")
$rand = False
ElseIf $rand = False Then
ToolTip ("Random on")
$rand = True
EndIf
$init = TimerInit ()
Do
Sleep (100)
Until TimerDiff ($init) >= 200 ;Show 0,2 seconds the random state
ENDFUNC
FUNC QUIT ()
Exit
ENDFUNC
FUNC INFO ()
ToolTip ($lst[$i])
$init = TimerInit ()
Do
Sleep (100)
Until TimerDiff ($init) >= 1500 ; Show 1,5 seconds the title
ToolTip ("")
ENDFUNC
FUNC GUI ()
ToolTip ("")
#Region ### START Koda GUI section ### Form=C:\Users\----\Desktop\Music\Form1.kxf
$Form1 = GUICreate("Backround muzik GUI", 625, 443, 192, 124)
$tab = GUICtrlCreateTab(0, 0, 617, 441)
GUICtrlSetFont(-1, 8, 400, 0, "Courier New")
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$TabSheet1 = GUICtrlCreateTabItem("Now playing")
$Label7 = GUICtrlCreateLabel("Song", 72, 32, 29, 17)
$songlist = GUICtrlCreateList("", 72, 56, 201, 370)
$Label8 = GUICtrlCreateLabel("Now playing", 224, 32, 62, 17)
$PlayMarkedSong = GUICtrlCreateButton("Play marked song", 288, 400, 115, 25, $WS_GROUP)
$timeplayed = GUICtrlCreateLabel("Time played:", 288, 344, 136, 17)
$timeleft = GUICtrlCreateLabel("Song length:", 432, 344, 119, 17)
$TabSheet2 = GUICtrlCreateTabItem("Ini Configuration")
$auostartBackMuz = GUICtrlCreateCheckbox("Put Backround muzik into startup (Autorun Backround muzik on windows start)", 56, 120, 521, 17)
$autornd = GUICtrlCreateCheckbox("Autostart random playing", 56, 56, 521, 17)
If IniRead (@ScriptDir & "\config.ini", "ops", "DefaultRandomPlaying", True) == True Then GUICtrlSetState ($autornd, $GUI_CHECKED)
$regstart = GUICtrlCreateRadio("Autostart over reg-entry", 88, 160, 481, 17)
$folderstart = GUICtrlCreateRadio("Autostart over startupfolder", 88, 184, 505, 17)
If RegRead ("HKCU\Software\Microsoft\Windows\CurrentVersion\Run", "Background Muzik") Or RegRead ("HKLM\Software\Microsoft\Windows\CurrentVersion\Run", "Background Muzik") Then
GUICtrlSetState ($regstart, $GUI_CHECKED)
GUICtrlSetState ($auostartBackMuz, $GUI_CHECKED)
ElseIf FileExists (@StartupCommonDir & "\Background Muzik.lnk") Or FileExists (@StartupDir & "\Background Muzik.lnk") Then
GUICtrlSetState ($folderstart, $GUI_CHECKED)
GUICtrlSetState ($auostartBackMuz, $GUI_CHECKED)
Else
GUICtrlSetState ($regstart, $GUI_CHECKED)
EndIf
$everyone = GUICtrlCreateCheckbox("For everyone who uses this computer", 88, 208, 505, 17)
$save = GUICtrlCreateButton("Save changes", 56, 360, 91, 25, $WS_GROUP)
$restart = GUICtrlCreateButton("Restart program (Required for new mp3 path)", 152, 360, 267, 25, $WS_GROUP)
$showTitelfield = GUICtrlCreateCheckbox("Show new songtitel if next song starts", 56, 264, 521, 17)
If IniRead (@ScriptDir & "\config.ini", "ops", "showSongTitle", True) == True Then GUICtrlSetState ($showTitelfield, $GUI_CHECKED)
$Label11 = GUICtrlCreateLabel("Folder with mp3's:", 8, 304, 88, 17)
$folderpath = GUICtrlCreateInput("", 104, 304, 441, 21)
GUICtrlSetData ($folderpath, IniRead (@ScriptDir & "\config.ini", "ops", "path", @ScriptDir))
$changeFolder = GUICtrlCreateButton("Change", 544, 304, 67, 25, $WS_GROUP)
$TabSheet3 = GUICtrlCreateTabItem("About")
GUICtrlSetState(-1,$GUI_SHOW)
$Label1 = GUICtrlCreateLabel("Backround muzik by Das Schwert (The Sword)", 32, 64, 225, 17)
$Label2 = GUICtrlCreateLabel("For support etc send a mail to [email='schwertsoft@web.de'][/email].", 32, 80, 249, 17)
$Label3 = GUICtrlCreateLabel("Homepage:", 32, 96, 59, 17)
$HPLnk = GUICtrlCreateLabel("http://schwertsoft.ucoz.com", 96, 96, 138, 17)
GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetCursor (-1, 0)
$Label5 = GUICtrlCreateLabel("(This page is german!)", 240, 96, 108, 17)
$Label6 = GUICtrlCreateLabel("If you have any idea to make my progs better, then send it to me!", 32, 128, 309, 17)
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$c = 1
$string = ""
Do
If $lst[$c] <> $lst[$i] Then
$string &= $lst[$c] & "|"
Else
$string &= $lst[$c] & "------Playing...|"
Endif
$c += 1
Until $c = $lst[0]
$string &= $lst[$c]
GUICtrlSetData ($songlist, $string)
$init2 = TimerInit ()
$last = 0
While 1
If TimerDiff ($init2) + 1000 >= $last Then
$last = TimerDiff ($init2)
$played = _SoundPos ($open)
GUICtrlSetData ($timeplayed, $played)
GUICtrlSetData ($timeleft, _SoundLength ($open))
EndIf
$msg = GUIGetMsg ()
If $msg = -3 Then Exit
If $msg = $PlayMarkedSong Then
$song = GUICtrlRead ($songlist)
$i = 1
Do
If $lst[$i] == $song Then
ExitLoop
EndIf
$i += 1
Until $lst[0] = $i -1
_SoundStop ($open)
_SoundClose ($open)
;$i -= 1
$iniwrite = $lst[$i]
$open = _SoundOpen ($path & "\" & $lst[$i])
IniWrite (@ScriptDir & "\config.ini", "saves", "song", $iniwrite)
$stop = True
IniWrite (@ScriptDir & "\config.ini", "saves", "getSong", True)
GUIDelete ()
Return 0
EndIf
If $msg = $save Then
RegDelete ("HKLM\Software\Microsoft\Windows\CurrentVersion\Run", "Background Muzik")
RegDelete ("HKCU\Software\Microsoft\Windows\CurrentVersion\Run", "Background Muzik")
FileDelete (@StartupCommonDir & "\Background Muzik.lnk")
FileDelete (@StartupDir & "\Background Muzik.lnk")
If GUICtrlRead ($showTitelfield) == $GUI_CHECKED Then
IniWrite (@ScriptDir & "\config.ini", "ops", "showSongTitle", True)
ElseIf GUICtrlRead ($showTitelfield) == $GUI_UNCHECKED Then
IniWrite (@ScriptDir & "\config.ini", "ops", "showSongTitle", False)
EndIf
If GUICtrlRead ($autornd) == $GUI_CHECKED Then
IniWrite (@ScriptDir & "\config.ini", "ops", "DefaultRandomPlaying", True)
Else
IniWrite (@ScriptDir & "\config.ini", "ops", "DefaultRandomPlaying", False)
EndIf
IniWrite (@ScriptDir & "\config.ini", "ops", "path", GUICtrlRead ($folderpath))
If GUICtrlRead ($auostartBackMuz) == $GUI_CHECKED Then
If GUICtrlRead ($everyone) == $GUI_CHECKED Then
$users = "everyone"
ElseIf GUICtrlRead ($everyone) == $GUI_UNCHECKED Then
$user = "me"
EndIf
If GUICtrlRead ($regstart) == $GUI_CHECKED Then
$startmethode = "reg"
ElseIf GUICtrlRead ($folderstart) == $GUI_CHECKED Then
$startmethode = "folder"
EndIf
If $startmethode = "reg" Then
If $user == "me" Then
RegWrite ("HKCU\Software\Microsoft\Windows\CurrentVersion\Run", "Background Muzik", "REG_SZ", @ScriptFullPath)
ElseIf $user == "everyone" Then
RegWrite ("HKCU\Software\Microsoft\Windows\CurrentVersion\Run", "Background Muzik", "REG_SZ", @ScriptFullPath)
EndIf
ElseIf $startmethode = "folder" Then
If $user = "everyone" Then
FileCreateShortcut (@ScriptFullPath, @StartupCommonDir & "\Background Muzik.lnk")
ElseIf $user = "me" Then
FileCreateShortcut (@ScriptFullPath, @StartupDir & "\Background Muzik.lnk")
Else
MsgBox (32, "Fatal error!", "Fatal error!")
EndIf
EndIf
EndIf
EndIf
If $msg = $restart Then
IniWrite (@ScriptDir & "\config.ini", "saves", "lastSong", $lst[$i])
ShellExecute (@ScriptFullPath, "restart")
Exit
EndIf
If $msg = $HPLnk Then
$splt = StringSplit (RegRead("HKEY_CLASSES_ROOT\http\shell\open\command", ""), '"')
$browser = $splt[2]
ShellExecute ($browser, "http://schwertsoft.ucoz.com")
EndIf
WEnd
ENDFUNC
;Made by Das Schwert
Hallo, ich habe ein kleines Programm geschrieben, um dauerhaft Musik im Hintergrund laufen zu lassen...
Alle Informationen werden als ToolTip ausgegeben.
Man gibt in der config.ini im Scriptverzeichnis den Pfad zum ordner mit den mp3's an
Funktionen:
Zeigt bei nächstem Titel den Namen an (Auch abstellbar in der config.ini), ebenfalls aufrufbar über strg+alt+i aufrufbar
Zufallsfunktion (Ohne die möglichkeit, das ein Titel doppelt vorkommt!), standartgemäß von alleine an, in der options.ini umstellbar, und temporär über strg+alt+r verändernbar
Quit funktion
(strg+alt+q)
Im Ordnerpfad für die mp3's können @ScriptDir und @UserProfileDir verwendet werden!!!
Es kann allerdings nur mp3's abspielen
Hier ist der code, wenn ihr was meiner anleitung nicht versteht, einfach nach-haken!
#include <File.au3>
#include <Sound.au3>
#include <Array.au3>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;All Features wich you can enable/disable are shown here
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
HotKeySet ("!^n", "nextSong") ;Press ctrl+alt+n for next song
HotKeySet ("!^r", "rand") ;Press ctrl+alt+r to disable/enable random playing
HotKeySet ("!^q", "quit") ;Press ctrl+alt+q to quit
HotKeySet ("!^i", "info") ;Press ctrl+alt+i to get now playing filename
$showTitle = IniRead (@ScriptDir & "\config.ini", "ops", "showSongTitle", True)
;;;; This program can only play .mp3's! (I think it can play other formats too, but if there e.g is a textfile in the folder the program will crash, if i don't just enable mp3's...
$rndList = _ArrayCreate ("")
$rand = IniRead (@ScriptDir & "\config.ini", "ops", "DefaultRandomState", True)
$path = IniRead (@ScriptDir & "\config.ini", "ops", "path", @ScriptDir)
If StringInStr ($path, "@ScriptDir") Then
$splt = StringSplit ($path, "@ScriptDir")
If $splt[1] == "" Then
$splt[1] = @ScriptDir ;Replace @ScriptDir to the real scriptpath
ElseIf $splt[1] <> "" Then
$x = 0
Do
$x += 1
Until $splt[$x] == ""
$splt[$x] = @ScriptDir ;Replace @ScriptDir to the real scriptpath
EndIf
EndIf
If StringInStr ($path, "@UserProfileDir") Then
$splt = StringSplit ($path, "@UserProfileDir")
If $splt[1] == "" Then
$splt[1] = @UserProfileDir ;Replace @ScriptDir to the real scriptpath
ElseIf $splt[1] <> "" Then
$x = 0
Do
$x += 1
Until $splt[$x] == ""
$splt[$x] = @UserProfileDir ;Replace @ScriptDir to the real scriptpath
EndIf
EndIf
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;To here
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
While 1
$lst = _FileListToArray ($path, "*.mp3")
If Not IsArray ($lst) Then
MsgBox (32, "Error: not files found!", "No supported files found in " & $path & "! Waiting for files.")
Do
Sleep (3000)
$lst = _FileListToArray ($path, "*.mp3")
Until IsArray ($lst)
EndIf
$i = 1
Do
If $rand = True And $lst[0] <> $rndList[0] Then
Do
$i = Random (1, $lst[0])
$splt = StringSplit ($i, ".")
$i = $splt[1]
Until _ArraySearch ($rndList, $i) == -1
_ArrayAdd ($rndList, $i)
$rndList[0] = UBound ($rndList)
ElseIf $lst[0] == $rndList[0] Then
$rndList = 0
$rndList = _ArrayCreate ("")
EndIf
$open = _SoundOpen ($path & "\" & $lst[$i])
_SoundPlay ($open)
ToolTip ("Now playing " & $lst[$i])
If $showTitle == True Then $init = TimerInit ()
$stop = False
Do
If $stop = True Then ExitLoop
If $showTitle == True Then
If TimerDiff ($init) >= 1500 Then ToolTip ("") ;Show 1,5 seconds the new title
EndIf
Until _SoundPos ($open) == _SoundLength ($open)
$i += 1
_SoundClose ($open)
Until $i = -1 = $lst[0]
WEnd
Func nextSong ()
_SoundStop ($open)
_SoundClose ($open)
$stop = True
EndFunc
FUNC RAND ()
If $rand = True Then
ToolTip ("Random off")
$rand = False
ElseIf $rand = False Then
ToolTip ("Random on")
$rand = True
EndIf
$init = TimerInit ()
Do
Sleep (100)
Until TimerDiff ($init) >= 200 ;Show 0,2 seconds the random state
ENDFUNC
FUNC QUIT ()
Exit
ENDFUNC
FUNC INFO ()
ToolTip ($lst[$i])
$init = TimerInit ()
Do
Sleep (100)
Until TimerDiff ($init) >= 1500 ; Show 1,5 seconds the title
ENDFUNC
;Made by Das Schwert
[/autoit]EDIT:
Ihr könnt es zum Beispiel in den Autostart schieben...
Ja, danke, aber mir geht es drum das ganze selber zu machen...
Um was draus zu lernen...
Aber Danke, wenns garnicht klappt dann mach ichs so!
Hallo leute, ich versuche gerade einen kleinen TCP/IP mailsender zu machen...
Seht euch den code an, er soll eigentlich das gleiche machen, als wenn man sich über telnet mit nem smtp server verbindet, aber irgendwie geht er nicht...
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiIPAddress.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Anonymous e-mail sender", 625, 443, 192, 124)
$Label1 = GUICtrlCreateLabel("From", 8, 24, 27, 17)
$Label2 = GUICtrlCreateLabel("To", 8, 56, 17, 17)
$Label3 = GUICtrlCreateLabel("IP of targetserver", 8, 80, 85, 17)
$Label4 = GUICtrlCreateLabel("Data", 8, 104, 27, 17)
$data = GUICtrlCreateEdit("", 48, 112, 305, 233)
$from = GUICtrlCreateInput("", 40, 24, 121, 21)
$to = GUICtrlCreateInput("", 40, 48, 121, 21)
$ip = _GUICtrlIpAddress_Create($Form1, 104, 80, 130, 21)
_GUICtrlIpAddress_Set($ip, "0.0.0.0")
$log = GUICtrlCreateEdit("", 416, 16, 185, 273)
$go = GUICtrlCreateButton("Send", 48, 376, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
While 1
$msg = GUIGetMsg ()
If $msg = -3 Then Exit
If $msg = $go Then
TCPStartup ()
$socket = TCPConnect (GUICtrlRead ($ip), 25)
$listen = TCPListen (GUICtrlRead ($ip), 25)
TCPAccept ($listen)
Do
$recv = TCPRecv ($listen, 200000)
Until $recv <> ""
GUICtrlSetData ($log, $recv)
TCPSend ($socket, "helo " & @IPAddress1)
Do
$recv = TCPRecv ($listen, 2000000)
Until $recv <> ""
GUICtrlSetData ($log, @CRLF & $recv)
TCPSend ($socket, "mail from: " & GUICtrlRead ($from))
Do
$recv = TCPRecv ($listen, 2000000)
Until $recv <> ""
GUICtrlSetData ($log, $recv)
TCPSend ($socket, "rcpt to: " & GUICtrlRead ($to))
Do
$recv = TCPRecv ($listen, 2000000)
Until $recv <> ""
GUICtrlSetData ($log, $recv)
TCPSend ($socket, "data")
Do
$recv = TCPRecv ($listen, 2000000)
Until $recv <> ""
GUICtrlSetData ($log, $recv)
TCPSend ($socket, GUICtrlRead ($data))
TCPSend ($socket, @CRLF & "." & @CRLF)
Do
$recv = TCPRecv ($listen, 2000000)
Until $recv <> ""
GUICtrlSetData ($log, $recv)
TCPSend ($socket, "QUIT")
TCPCloseSocket ($socket)
TCPCloseSocket ($listen)
TCPShutdown ()
EndIf
WEnd
Danke schonmal, das Schwert
Wow, Danke, ich hab zwar nicht gefunden was anders ist, aber es geht... ![]()
Nur das zur seitenwand des Desktops ziehen zerschießt das Programm noch total, aber ich nehm mal an das werd ich auch alleine schaffen... ![]()
Danke!
Hallo, ich habe ein Problem was diese Funktion, bei der man lediglich das fenster gegen den oberen Rand des Bildschirms ziehen muss um es zu maximieren...
Irgendwie klappt es nicht... (Genausowenig an den Seiten...)
Die Funktion, ein Fesnter zu schütteln um alle anderen zu minimieren geht allerdings ![]()
Raupi meint bei ihr geht es mit autoit script einwandfrei...
Naja, hier ist der Code, vieleicht findet ihr ja n Fehler...
Danke schonmal, Das Schwert!
#include <WIndowsConstants.au3>
#include <GuiConstants.au3>
#include<EditConstants.au3>
#include <Array.au3>
#include <ButtonConstants.au3>
$GUI = GUICreate ("Binary Converter", IniRead (@ScriptDir & "\options.ini", "gui", "width", 300), IniRead (@ScriptDir & "\options.ini", "gui", "height", 125), IniRead (@ScriptDir & "\options.ini", "gui", "PosLeft", 100), IniRead (@ScriptDir & "\options.ini", "gui", "PosTop", 100), BitOr ($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX))
$convert = GUICtrlCreateButton ("Convert (B2Z)", 10, 28, 90, 20)
$zahl = GUICtrlCreateInput ("", 10, 52, 270, 16)
GUICtrlSetStyle (-1, $ES_NUMBER)
$conv2 = GUICtrlCreateButton ("Convert (Z2B)", 10, 70, 90, 20)
$10 = GUICtrlCreateInput ("", 10, 10, 270, 16)
GUICtrlSetStyle (-1, $ES_NUMBER)
GUISetState ()
$msg = GUIGetMsg ()
$Maxed = False
While 1
If $msg = -3 Then
$pos = WinGetPos ("Binary Converter")
Exit
EndIf
$msg = GUIGetMsg ()
If $msg = $Convert Then ;Convert B2Z
$splt = StringSplit (GUiCtrlRead($10), "")
If GUICtrlRead ($10) == "" Then
MsgBox (16, "Error!", "Please enter at least 1 number", Default, $GUI)
ContinueLoop
EndIf
$i = $splt[0]
$x = 1
$count = $splt[0]
Dim $splt2[$count +1]
Do
$splt2[$i] = $x
$i -= 1
$x *= 2
Until $i +1 = 1
$i = 1
Do
If $splt[$i] <> 0 Then
$splt[$i] = $splt2[$i]
EndIf
$i += 1
UNtil $i -1 = $splt[0]
$ergebnis = 0
$i = 1
Do
$ergebnis += $splt[$i]
$i += 1
Until $i -1 = $splt[0]
MsgBox (0, "", $ergebnis, Default, $GUI)
EndIf ;==> Convert B2Z
If $msg = $conv2 Then ;Convert Z2B
$zahl1 = GUICtrlRead ($zahl)
If $zahl1 <= 255 Then
Dim $01[9]
$01[1] = 128
$01[2] = 64
$01[3] = 32
$01[4] = 16
$01[5] = 8
$01[6] = 4
$01[7] = 2
$01[8] = 1
ElseIf $zahl1 > 255 Then
$zahl2 = $zahl1
$true = False
Do
$f = 1
Do
$f *= 2
Until $f >= $zahl2
If $f = $zahl2 Then
$true = True
Else
$zahl2 -= 1
EndIf
Until $true = True
Dim $01[2]
$01[1] = $zahl2
Do
$y = $01[UBound ($01)-1] /2
_ArrayAdd ($01, $y)
Until $01[UBound ($01)-1] = 1
EndIf
$ergebnis = ""
$ergebnis2 = 0
$i = 1
Do
If $ergebnis2 + $01[$i] < $zahl1 Or $ergebnis2 + $01[$i] = $zahl1 Then
$ergebnis &= 1
$ergebnis2 += $01[$i]
ElseIf $ergebnis2 + $01[$i] >= $zahl1 Then
$ergebnis &= 0
EndIf
$i += 1
Until $i -1 = UBound ($01) -1
MsgBox (0, "", $ergebnis, Default, $GUI)
EndIf
If $msg = $GUI_EVENT_MAXIMIZE Then
GUICtrlSetPos($10, 0, 0, 1361, 289)
GUICtrlSetPos($convert, 0, 296, 1363, 57)
GUICtrlSetPos($zahl, 0, 360, 1361, 289)
GUICtrlSetPos($conv2, 0, 656, 1363, 57)
GUISetState(@SW_SHOW)
EndIf
If $msg = $GUI_EVENT_RESTORE Then
GUICtrlSetPos($convert, 10, 28, 90, 20)
GUICtrlSetPos($zahl, 10, 52, 270, 16)
GUICtrlSetPos($conv2, 10, 70, 90, 20)
GUICtrlSetPos($10, 10, 10, 270, 16)
EndIf
WEnd
Func OnAutoItExit ()
IniWrite (@ScriptDir & "\options.ini", "gui", "PosLeft", $pos[0])
IniWrite (@ScriptDir & "\options.ini", "gui", "PosTop", $pos[1])
EndFunc
Ja, nichtmehr online weil er vlt. n virus versteckt hatte!
Wieso sollte er nicht den gezippten quelltext posten?
Ich würd noch ne win tastensperre einbauen, und einfach ne winlist erstellen und jedes neue Fenster killen...
MfG Das Schwert
EDIT: Sven, falls es wirklich nur n fehlalarm war hab ich nichts gesagt!
Vlt hat sich der download hoster ja auch n virus eingefangen... Oder du dir einen...
Was ich machen möchte:
Wie man eine Progressbar erstellt und so weiter ist klar, und auch das es einfach ein steuerelement wie eine checkbox ist.
Aber auf win 7 kann dieses steuerelement auch in der tasbar dargestellt werden... (Siehe der untere rote kreis im bild.)
Von dem was bei msdn steht versteh ich nur bahnhof, steht da überhaupt was drüber wie entwickler das in ihre progs
einbauen können? (Ausser der befehl um ddie Progressbar zu erschaffen)?
Naja, danke, schade das es nicht geht...
Hallo, ich habe auf meinem rechner die Win7 Beta.
Wenn ein Programm wie safari einen Progressbar anzeigt
[Blockierte Grafik: http://funkjedi.com/wp-content/uploads/2009/01/windows7-toolbar.jpg]
(Bild über google gefunden)
Kann ich das auch mit autoit scripten machen?
Wenn ich einfach mit GuiCtrlCreateProgress mach ist der balken
nur im fenster, aber nicht in dem tasklisten symbol...
Danke schonmal, das schwert!
Hi, Ich hatte die Idee ne ganz simple Shell zu schreiben: Eine Kommandozeile, welche die Eingabe in eine au3 Datei unsetzt und diesse sofort ausführt
(Ne eingabezeile mit Au3 Funktionen eben...)
(Ja, ich weiß das es nicht besonders kreativ ist, aber mir fällt nichts ein was ich sonst machen kann :D)
Allerdings habe ich dazu ein paar fragen:
1.:
Wenn man bei der "Vollversion" von SciTe auf F5 drückt startet ja der Au3 Check Errors... Wie kann ich machen das mein Programm die Fehler die in dieser einen zeile gefunden wurden von Au3 Check Errors emüfängt? (StdOutRead odasowas??)
2.:
Wie kann ich einen HotKey an das Fesnter von meinem Programm binden?
Wenn ich _IsPressed ("") in die While schleife vom GUI häng wirds sehhhhrrrr langsam...
Aber das Problem ist:
Wenn man z.b. MsgBox (0, "", "") in die Zeile Schreibt, und ENTER drückt, dann erscheint tatsächlich eine MsgBox, allerdings hat mein HotKey wohl das Von der Box überspielt, odaso... Wenn ich auf ENTER klicke um die Box zu schließen geht sie nicht zu, sondern eine neue kommt...
Wie bekomm ich einen HotKey der nicht die Anderen wegspült, aber auchnicht den GUI zu stark verlangsamt???
HBier ist mein bisheriger (Noch sehr simpler) Code:
(Er kann bis jetzt noch keine Funcs abspielen die n Include brauchen, etc...)
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=C:\Programme\AutoIt3\SciTE\Koda\Templates\Schwert Shell.kxf
$Form1 = GUICreate("Au3/Schwert Shell", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP)
$lst = GUICtrlCreateEdit("", 0, 0, 1273, 713)
$cmd = GUICtrlCreateInput("", 0, 720, 1273, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
HotKeySet ("{ENTER}", "read")
While 1
$msg = GUIGetMsg ()
If $msg = -3 Then Exit
WEnd
Func read ()
If Not WinActive ("Schwert Shell") Then Return 0
$line = GUICtrlRead ($cmd)
FileDelete (@TempDir & "\Temp.au3")
FileWrite (@TempDir & "\Temp.au3", $line)
ShellExecute (@AutoItExe, @TempDir & "\Temp.au3")
EndFunc
Vielen Dank schonmal ![]()
Das Schwert
Thx, Oscar!!
Jetzt läufts... (Mit Servernamen...)
Wer will: Hier ist nochmal der neueste Code...
(ist aber durch _TCPIPTONAME etwas langsam...)
Achutng! Es hakt beim anfang des Scans, einfach n moment warten, es gibt sich von allein ![]()
Sonst einfach ; vor TCPStartup (), TCPShutdown () hängen und die If anweisung wieder wegnehmen...
EDIT:
Neue version
Mit einer ini für die optionen: TCPipToName lässt sich abschalten (Ohne ist es viel schneller) und der ping timeout lässt sich einstellen.
Neuer Quelltext:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <INet.au3>
#Region ### START Koda GUI section ### Form=c:\dokumente und einstellungen\keno\eigene dateien\eigene dokumente\koda\ping subnet.kxf
$Form1 = GUICreate("Ping Subnet", 423, 450, 192, 124)
$range = GUICtrlCreateInput("192.168.0.xxx", 0, 0, 121, 21)
$go = GUICtrlCreateButton("Go", 184, 0, 75, 25, $WS_GROUP)
$found = GUICtrlCreateEdit("", 0, 40, 273, 409)
$MaxIp = GUICtrlCreateInput("100", 136, 0, 41, 21)
$addfield = GUICtrlCreateInput("IP", 288, 40, 121, 21)
$add = GUICtrlCreateButton("Add zu known IPs", 288, 96, 99, 25, $WS_GROUP)
$addname = GUICtrlCreateInput("Name", 288, 64, 121, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
If IniRead ("names.ini", "options", "showName", 1) == 1 Then TCPStartup ()
While 1
$msg = GUIGetMsg ()
If $msg = -3 Then Exit
If $msg = $go Then
GUICtrlSetData ($found, "")
$max = GUICtrlRead ($maxIp)
GUICtrlSetData ($go, "Stop")
GUICtrlSetState ($MaxIp, $GUI_DISABLE)
GUICtrlSetState ($add, $GUI_DISABLE)
GUICtrlSetState ($addfield, $GUI_DISABLE)
GUICtrlSetState ($addname, $GUI_DISABLE)
GUICtrlSetState ($range, $GUI_DISABLE)
$split = StringSplit (GUICtrlRead ($range), "xxx")
$split[2] = $split[1]
$i = 1
WinSetTitle ("Ping Subnet", "","Scanning: " & $split[2] & $i)
;Optionen werden hier ausgelesen
$timeout = IniRead ("names.ini", "options", "timeout", 500)
$tcpname = IniRead ("names.ini", "options", "showName", 1)
Do
$ping = Ping ($split[2] & $i, $timeout)
If $ping <> 0 Then
$read = GUICtrlRead ($found)
If $tcpname = 1 Then
$name = _TCPIpToName ($split[2] & $i)
If $name == "" Then
GUICtrlSetData ($found, $read & IniRead (@ScriptDir & "\names.ini", "names", $split[2] & $i, $split[2] & $i) & " " & $ping & "ms" & @CRLF)
Else
GUICtrlSetData ($found, $read & $name & " " & $split[2] & $i & " " & $ping & "ms" & @CRLF)
EndIf
ElseIf $tcpname <> 1 Then
GUICtrlSetData ($found, $read & IniRead (@ScriptDir & "\names.ini", "names", $split[2] & $i, $split[2] & $i) & " " & $ping & "ms" & @CRLF)
EndIf
EndIf
$i += 1
WinSetTitle ("Scanning: " & $split[2] & $i -1, "", "Scanning: " & $split[2] & $i)
If GUIGetMsg () = $go Then ExitLoop
Until $i = $max
GUICtrlSetData ($go, "Go")
WinSetTitle ("Scanning: " & $split[2] & $i, "", "Ping Subnet")
GUICtrlSetState ($MaxIp, $GUI_ENABLE)
GUICtrlSetState ($add, $GUI_ENABLE)
GUICtrlSetState ($addfield, $GUI_ENABLE)
GUICtrlSetState ($addname, $GUI_ENABLE)
GUICtrlSetState ($range, $GUI_ENABLE)
EndIf
If $msg = $add Then
IniWrite (@ScriptDir & "\names.ini", "Names", GUICtrlRead ($addfield), GUICtrlRead ($addname))
GUICtrlSetData ($addfield, "IP")
GUICtrlSetData ($addname, "Name")
EndIf
WEnd
Func OnAutoItExit ()
If IniRead ("names.ini", "options", "showName", 1) == 1 Then TCPShutdown ()
EndFunc
Names.ini (Datei mit den Optionen und für mit Namen gespeicherte IP adressen:
[Names]
192.168.0.1=Router
[options]
timeout=300
showName=1
Einfach showName auf 0 setzen um Namens anzeige zu deaktivieren...
Wo denn? Einfach gnz oben?
Oder auchnoch TcpAccept undso?
Hi, Ich schreibe mir gerade ein kleines Ping-Subnet programm (Es scannt einen ip stamm nach rechner die online sind)
Und habe da ein Problem:
Ich will mit _TCPIpToName die Namen der Rechner (Nicht nur die IP anzeigen, aber irgendwie gibt _TCPIpToName immer nur "" (Fehler) zurück...
Ich habe keine ahnung warum...
Hier ist mein Code:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <INet.au3>
#Region ### START Koda GUI section ### Form=c:\dokumente und einstellungen\keno\eigene dateien\eigene dokumente\koda\ping subnet.kxf
$Form1 = GUICreate("Ping Subnet", 423, 450, 192, 124)
$range = GUICtrlCreateInput("192.168.0.xxx", 0, 0, 121, 21)
$go = GUICtrlCreateButton("Go", 184, 0, 75, 25, $WS_GROUP)
$found = GUICtrlCreateEdit("", 0, 40, 273, 409)
$MaxIp = GUICtrlCreateInput("100", 136, 0, 41, 21)
$addfield = GUICtrlCreateInput("IP", 288, 40, 121, 21)
$add = GUICtrlCreateButton("Add zu known IPs", 288, 96, 99, 25, $WS_GROUP)
$addname = GUICtrlCreateInput("Name", 288, 64, 121, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$msg = GUIGetMsg ()
If $msg = -3 Then Exit
If $msg = $go Then
GUICtrlSetData ($found, "")
$max = GUICtrlRead ($maxIp)
GUICtrlSetData ($go, "Stop")
GUICtrlSetState ($MaxIp, $GUI_DISABLE)
GUICtrlSetState ($add, $GUI_DISABLE)
GUICtrlSetState ($addfield, $GUI_DISABLE)
GUICtrlSetState ($addname, $GUI_DISABLE)
GUICtrlSetState ($range, $GUI_DISABLE)
$split = StringSplit (GUICtrlRead ($range), "xxx")
$split[2] = $split[1]
$i = 1
WinSetTitle ("Ping Subnet", "","Scanning: " & $split[2] & $i)
Do
$ping = Ping ($split[2] & $i, 500)
If $ping <> 0 Then
$read = GUICtrlRead ($found)
$name = _TCPIpToName ($split[2] & $i)
If $name == "" Then
GUICtrlSetData ($found, $read & IniRead (@ScriptDir & "\names.ini", "names", $split[2] & $i, $split[2] & $i) & " " & $ping & "ms" & @CRLF)
Else
GUICtrlSetData ($found, $read & $name & " " & $ping & "ms" & @CRLF)
EndIf
EndIf
$i += 1
WinSetTitle ("Scanning: " & $split[2] & $i -1, "", "Scanning: " & $split[2] & $i)
If GUIGetMsg () = $go Then ExitLoop
Until $i = $max
GUICtrlSetData ($go, "Go")
WinSetTitle ("Scanning: " & $split[2] & $i, "", "Ping Subnet")
GUICtrlSetState ($MaxIp, $GUI_ENABLE)
GUICtrlSetState ($add, $GUI_ENABLE)
GUICtrlSetState ($addfield, $GUI_ENABLE)
GUICtrlSetState ($addname, $GUI_ENABLE)
GUICtrlSetState ($range, $GUI_ENABLE)
EndIf
If $msg = $add Then
IniWrite (@ScriptDir & "\names.ini", "Names", GUICtrlRead ($addfield), GUICtrlRead ($addname))
GUICtrlSetData ($addfield, "IP")
GUICtrlSetData ($addname, "Name")
EndIf
WEnd
Thx schonmal ![]()