• Moin!

    Ich hatte mir vorgenommen ein bisschen mehr über AutoIt zu lernen. dazu habe ich mir einfach mal ein Projekt ausgedacht, und es angefangen. hier mal mein Code.

    Ach ja, und noch mal... Ich bin anfänger. geht also bitte nicht zu hart mit mir ins gericht. :p


    [autoit]


    #cs ----------------------------------------------------------------------------
    DJBeatstar's Portable App Studio Deluxe
    Author: DJBeatstar in DJBeatstar Design
    (C) 2010 By Stefan Parpart A.K.A. DJBeatstar
    v. 1.2
    #ce ----------------------------------------------------------------------------
    #include <GUIConstants.au3>
    Global $main, $apploader
    ;Settings werden gelesen
    if IniRead(@ScriptDir & "\data\settings.ini", "Configuration", "splash", "") = "1" Then
    SplashImageOn ("DJBeatstar's Portable Apps Stidio DELUXE", @ScriptDir & "\data\splash.bmp",640, 480, @DesktopWidth/2-320, @DesktopHeight/2-240, 1)
    sleep (3000)
    SplashOff()
    EndIf
    ;Settings lesen Ende
    maingui()
    Func maingui()
    ;Gui wird aufgebaut
    #Region ### START Koda GUI section ### Form=F:\DJBeatstar's Portable App Studio Deluxe\Main Window.kxf
    $main = GUICreate("DJBeatstar's Portable Apps Studio DELUXE v1.2", 530, 501)
    GUICtrlCreatePic(@ScriptDir & "\data\side.bmp", 304, 0, 225, 500)
    $applist = GUICtrlCreateListView("Programmname", 16, 32, 265, 305)
    $apps = GUICtrlCreateGroup("Apps", 8, 0, 281, 345)
    GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $run = GUICtrlCreateButton("Run App", 8, 352, 81, 25, 0)
    $explore = GUICtrlCreateButton("Explore Stick", 208, 352, 83, 25, 0)
    $cmd = GUICtrlCreateButton("Open CMD Console", 8, 384, 123, 25, 0)
    $apploader1 = GUICtrlCreateButton("Check for new Apps", 168, 384, 123, 25, 0)
    $splash = GUICtrlCreateCheckbox("SplashImage bei jedem start anzeigen", 8, 448, 201, 17)
    if IniRead(@ScriptDir & "\data\settings.ini", "Configuration", "splash", "") = "1" Then
    GUICtrlSetState(-1, $GUI_CHECKED)
    EndIf
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    ;Appliste
    For $i = 1 To IniRead(@ScriptDir & "\data\settings.ini", "appno", "apps", "") step 1
    $appname = IniRead(@ScriptDir & "\data\settings.ini", "apps", $i, "")
    $item1=GUICtrlCreateListViewItem($appname, $applist)
    Next
    ;Appliste Ende
    ;Gui Aufbau Ende

    [/autoit][autoit][/autoit][autoit]

    ;Hauptprogramm
    While 1
    $Msg = GUIGetMsg(1)
    Select
    case $Msg[0] = $run
    $app = GUICtrlRead(GUICtrlRead($applist))
    Run (@ScriptDir & "\Apps" & IniRead(@ScriptDir & "\data\settings.ini", "appexe", $app, ""))
    Case $Msg[0] = $GUI_EVENT_CLOSE And $Msg[1] = $main
    Exit
    Case $Msg[0] = $splash
    IniWrite(@ScriptDir & "\data\settings.ini", "Configuration", "splash", GUICtrlRead($splash))
    Case $Msg[0] = $cmd
    Run (@WindowsDir & "\System32\cmd.exe")
    Case $Msg[0] = $explore
    Run (@WindowsDir & "\explorer.exe " & @ScriptDir)
    Case $Msg[0] = $apploader1
    apploader()

    [/autoit][autoit][/autoit][autoit]

    EndSelect
    WEnd
    ;Hauptprogramm Ende
    EndFunc
    ;AppLoader
    Func apploader()
    ;Appliste laden
    InetGet ("http://ServerXYZ.de/asd/newapps.ini", "newapps.ini", 1, 0)
    ;Appliste laden Ende
    ;AppLoader Gui aufbauen
    #Region ### START Koda GUI section ### Form=E:\Daten\SourceCodes\DJBeatstar's Portable App Studio Deluxe\AppLoader.kxf
    $apploader = GUICreate("DJBeatstar's Apps Studio Deluxe 1.0 AppLoader", 530, 501)
    GUICtrlCreatePic(@ScriptDir & "\data\side.bmp", 304, 0, 225, 500)
    $newapps = GUICtrlCreateListView("Programmname", 16, 32, 265, 305)
    ;Appliste für neue Apps
    For $i = 1 To IniRead(@ScriptDir & "\newapps.ini", "newapps", "no", "") step 1
    $newappname = IniRead(@ScriptDir & "\newapps.ini", "newapps", $i, "")
    $item1=GUICtrlCreateListViewItem($newappname, $newapps)
    Next
    ;Appliste für neue Apps Ende
    GUICtrlCreateGroup("New Apps", 8, 0, 281, 345)
    GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $load = GUICtrlCreateButton("Load App", 8, 352, 281, 25)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    ;AppLoader Gui aufbauen Ende

    [/autoit][autoit][/autoit][autoit]

    ;AppLoader Hauptfuntion
    While 1
    $Msg = GUIGetMsg(1)
    Select
    Case $Msg[0] = $GUI_EVENT_CLOSE And $Msg[1] = $apploader
    ;Apploader schließe
    GUISetState (@SW_HIDE, $apploader)
    ExitLoop
    ;Apploader schließe Ende
    Case $Msg[0] = $load
    ;Appdaten einlesen
    Global $app2load = GUICtrlRead(GUICtrlRead($newapps))
    Global $apparc = IniRead(@ScriptDir & "\newapps.ini", "apparc", $app2load, "")
    ;Appdaten einlesen Ende
    ;Progressbar erstellen
    $progress = GUICtrlCreateProgress (8, 400, 281, 20)
    ;Progressbar erstellen
    ;Download der App
    Local $hDownload = InetGet("http://ServerXYZ.de/asd/apps/" & $apparc, @ScriptDir & "\Apps\" & $apparc, 1, 1)
    ;Progressbar mit daten versorgen
    Do
    $size = InetGetSize ("http://ServerXYZ.de/asd/apps/" & $apparc)
    $percent = InetGetInfo ($hDownload,0) * 100 / $size
    GUICtrlSetData ($progress,$percent)
    Sleep (1000)
    Until InetGetInfo($hDownload, 2)
    Local $nBytes = InetGetInfo($hDownload, 0)
    ;Progressbar mit daten versorgen
    InetClose($hDownload)
    ;Download der App Ende
    ;Entpacken der App
    InetGet ("http://ServerXYZ.de/asd/apps/" & $apparc & ".cmd", @ScriptDir & "\" & $apparc & ".cmd", 1, 0)
    run (@ScriptDir & "\" & $apparc & ".cmd")
    ;Entpacken der App Ende
    ;Auf entpacken warten
    wait()
    ;Auf entpacken warten ende
    ;Integrieren der App
    $no = IniRead(@ScriptDir & "\data\settings.ini", "appno", "apps", "")
    $appnamenew = IniRead(@ScriptDir & "\Apps\setup.ini", "setup", "name", "")
    $exe = IniRead(@ScriptDir & "\Apps\setup.ini", "setup", "exe", "")
    IniWrite(@ScriptDir & "\data\settings.ini", "appno", "apps", $no+1)
    IniWrite(@ScriptDir & "\data\settings.ini", "apps", $no+1, $appnamenew)
    IniWrite(@ScriptDir & "\data\settings.ini", "appexe", $appnamenew & "|", $exe)
    ;Integrieren der App Ende
    ;Restart MainGui und AppLoader schließen
    GUIDelete ($main)
    GUIDelete ($apploader)
    FileDelete (@ScriptDir & "\" & $apparc & ".cmd")
    FileDelete (@ScriptDir & "\Apps\setup.ini")
    FileDelete (@ScriptDir & "\newapps.ini")
    maingui()
    ;Restart MainGui und AppLoader schließen Ende
    EndSelect
    WEnd
    ;AppLoader Hauptfuntion Ende
    EndFunc
    ;Apploader ende
    Func wait()
    while 3
    if Not ProcessExists ("cmd.exe") Then
    ExitLoop
    EndIf
    Sleep(10)
    WEnd
    EndFunc

    [/autoit]


    PS.: FÜr anregungen und verbesserungen bin ich immer gerne zu haben.

  • Hallo.
    Du hast dein Programm nicht gut genug erklärt.
    Anhand der Buttons kann ich nicht entnehmen, wozu dieses Programm gecoded wurde.
    Ich kann die DOS Console aufrufen, den Explorer benutzen und sog. "Apps" hinzufügen.
    Wenn ich ne App hinzufügen will, und auf Load App klicke, freezt das Fenster,
    und nach einiger Zeit geht es weg, aber nichts verändert sich.
    Und zu guter letzt downloadest du i.was ausm Inet, was sich auf serverxyz.de befindet,
    diese Seite gibts aber nicht.
    Du solltest dich mal dran setzen und das Programm überarbeiten, damit es funktioniert,
    und du solltest deinen Thread ausführlicher erklären.
    MfG. PrideRage

    Meine Projekte:
    ClipBoard Manager (beendet)
    Gutes ClipBoard Verwaltungs Programm mit nützlichen Funktionen.

    HTML Creator (beendet)
    Nützliches Tool um schnell ein eigenes HTML Dokument zu erstellen.

  • Also ich hatte in meinen Quellcode keinen Existierenden server eingetragen. hab jetzt einfach mal ein par daten zusammen gepackt, damit ihr das ganze auch testen könnt. in dem RAR File sind alle datein vorhanden die man benötigt.

    alle INI's und auch die "unzip.exe"

    Habe dabei einen alten server von mir benutzt um ein par Apps dort abzulegen. :)

    das ganze programm ist für einen USB Stick kozipiert worden. damit hat man eine Zentrale schnittstelle für Portable Apps wie z.B. FireFoxPortable und andere. diese Apps können im programm selber jetzt aus dem Internet geladen werden.

    Im übrigen bin ich auch dankbar für alle verbesserungsvorschläge.

    Edit:

    Ich hatte einige Schwirigkeiten mit meinem Server. jetzt sollte alles wieder funktionieren. :)