Hallo Leute, ich bin mal wieder auf ein problem gestoßen als ich meinen "Web-musicplayer" optimieren wollte und zwar ist mein problem wie
die überschrift schon sagt , das ich wenn ich menüitems hinzugefügt habe dann muss ich erst das script neustarten damit ich diese dem menü hinzufügen könnte
und das würde ich gern umgehen , könnt ihr mir helfen , script und co im anhang (ich hab das wichtigste raus vom script damits übersichtlicher ist)
Spoiler anzeigen
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <ModernMenuRaw.au3>
#include <GuiListView.au3>
#include <String.au3>
Opt('GUIOnEventMode', 1)
[/autoit] [autoit][/autoit] [autoit]Global $Fehler,$sender[99],$senderinfo[99][2],$Input1,$Input2,$add_channel,$sText=""
[/autoit] [autoit][/autoit] [autoit]Global $R10= IniReadSectionNames(@ScriptDir & "/test.ini")
if @error Then $Fehler=1
Global $Form1 = GUICreate("No restart", 160, 50, 990, 30,-1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE,$WS_EX_TOPMOST, $WS_EX_APPWINDOW))
GUISetOnEvent(-3, '_Exit')
$Menu = GUICtrlCreateMenu("&Sender/Songs")
$nSideItem = _CreateSideMenu($Menu)
if not $Fehler=1 Then
for $i=0 to $R10[0]
$Temp_Read=IniReadSection(@ScriptDir & "/test.ini",$R10[$i])
if not @error Then
$cut= _Stringbetween($Temp_Read[1][1],"http://","/")
if IsArray($cut) Then
if $cut[0]="www.youtube.de" Or $cut[0]="www.youtube.com" Then
$sender[$i]=_GUICtrlCreateODMenuItem($R10[$i],$Menu,@ScriptDir & "/youtube.ico")
GUICtrlSetOnEvent(-1, '_Radio')
$senderinfo[$i][0]=$Temp_Read[1][1]
$senderinfo[$i][1]=$R10[$i]
Else
$sender[$i]=_GUICtrlCreateODMenuItem($R10[$i],$Menu,"shell32.dll",-139)
GUICtrlSetOnEvent(-1, '_Radio')
$senderinfo[$i][0]=$Temp_Read[1][1]
$senderinfo[$i][1]=$R10[$i]
EndIf
EndIf
EndIf
Next
EndIf
$Menu2 = GUICtrlCreateMenu("&?")
$nSideItem2 = _CreateSideMenu($Menu2)
$senderlist = _GUICtrlCreateODMenuItem("Radiosender suchen",$Menu2,"shell32.dll",-210)
GUICtrlSetOnEvent(-1, '_Senderlist')
$senderlist2 = _GUICtrlCreateODMenuItem("Youtube-Song suchen",$Menu2,@ScriptDir & "/youtube.ico")
GUICtrlSetOnEvent(-1, '_Senderlist2')
$channelconfig = _GUICtrlCreateODMenuItem("Sender/Song hinzufügen",$Menu2,"shell32.dll",-217)
GUICtrlSetOnEvent(-1, 'channelconfig')
$deletetitel = _GUICtrlCreateODMenuItem("Sender/Song löschen",$Menu2,"shell32.dll",-132)
GUICtrlSetOnEvent(-1, 'deletetitel')
$creditz = _GUICtrlCreateODMenuItem("Skins",$Menu2,"shell32.dll",-142)
GUICtrlSetOnEvent(-1, 'skins')
$Updateitem = _GUICtrlCreateODMenuItem("Update",$Menu2,"shell32.dll",-14)
GUICtrlSetOnEvent(-1, 'update')
;~ $creditz = _GUICtrlCreateODMenuItem("Creditz",$Menu2,"shell32.dll",-222)
GUICtrlSetOnEvent(-1, 'creditz')
$exit = _GUICtrlCreateODMenuItem("Exit",$Menu2,"shell32.dll",-28)
GUICtrlSetOnEvent(-1, '_Exit')
GUISetState(@SW_SHOW)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]While Sleep(100)
WEnd
Func _Senderlist()
__FFStartProcess("http://www.surfmusik.de/bundesland.htm",True)
EndFunc
Func _Senderlist2()
__FFStartProcess("http://www.youtube.com/?gl=DE&hl=de",True)
EndFunc
Func _Exit()
Exit
EndFunc
Func channelconfig()
[/autoit] [autoit][/autoit] [autoit]Global $add_channel = GUICreate("Sender/Song hinzufügen", 305, 190, 541, 178,-1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE, $WS_EX_APPWINDOW))
GUISetOnEvent(-3, '_switch')
Global $Input1 = GUICtrlCreateInput("", 24, 40, 249, 21)
Global $Input2 = GUICtrlCreateInput("", 24, 104, 249, 21)
$Label7 = GUICtrlCreateLabel("Sender/Song-Name:", 16, 16, 150, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Label8 = GUICtrlCreateLabel("Sender/Song-Url:", 16, 80, 150, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$save = GUICtrlCreateButton("Speichern", 16, 136, 265, 41, 0)
GUICtrlSetOnEvent(-1, '_save')
GUISetState(@SW_SHOW)
EndFunc
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]Func _save()
If GUICtrlRead($Input1)="" or GUICtrlRead($Input2)="" Then
MsgBox(16,"Error","Missing Input/s!")
GUIDelete($add_channel)
GUISwitch($Form1)
Else
IniWrite(@ScriptDir & "/test.ini",GUICtrlRead($Input1),"Url",GUICtrlRead($Input2))
$saveask=MsgBox(4,"","Saved successfully!"& @CRLF & "You need to restart before the changes become effective, do you want to restart now?")
If $saveask=7 Then
GUIDelete($add_channel)
GUISwitch($Form1)
Else
SplashTextOn("", "Restarting Script.....",150,100)
Sleep(900)
SplashOff()
Run(@ScriptDir & "/WRRestarter.exe")
Exit
EndIf
EndIf
EndFunc
Func _switch()
GUIDelete($add_channel)
GUISwitch($Form1)
EndFunc
Func deletetitel()
[/autoit] [autoit][/autoit] [autoit]Global $dtform = GUICreate("Titel löschen??", 331, 352, 764, 78,-1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE, $WS_EX_APPWINDOW))
GUISetOnEvent(-3, '_switch3')
Global $list=GUICtrlCreateListView("Titel ", 0, 0, 329, 297)
$Loeschen = GUICtrlCreateButton("Löschen", 24, 304, 281, 41, 0)
GUICtrlSetOnEvent(-1, 'delete')
GUISetState(@SW_SHOW)
if not $Fehler=1 Then
for $i=1 to $R10[0]
GUICtrlCreateListViewItem($R10[$i],$list)
Next
Else
GUIDelete($dtform)
MsgBox(0,"Fehler","Keine Ini-Datei vorhanden.")
EndIf
EndFunc
Func delete()
$clicked = GUICtrlRead(GUICtrlRead($list))
If not $clicked="" Then
$cut2=StringTrimRight($clicked,1)
_GUICtrlListView_DeleteItemsSelected ($list)
IniDelete(@ScriptDir & "/test.ini", $cut2)
Else
MsgBox(0,"","Kein Titel ausgewählt.")
EndIf
EndFunc
Func _switch3()
GUIDelete($dtform)
$askrestart=MsgBox(4,"Info","Änderungen werden erst nach Neustart des Web-Radio`s wirksam, möchten Sie jetzt neustarten?")
If $askrestart= 7 Then
GUISwitch($Form1)
Else
SplashTextOn("", "Restarting Script.....",150,100)
Sleep(900)
SplashOff()
Run(@ScriptDir & "/WRRestarter.exe")
Exit
EndIf
EndFunc
MfG Hellboy