Sign in to follow this  
Followers 0
JustinReno

Unkown Error

1 post in this topic

I've recently started to mess around with MicroOS again, I abandoned the project since I've gotten software errors starting it, or changing settings in its control panel.

Please tell me if you get an error starting the script or changing its preferences in the start menu.

I keep getting a software error!!

#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_outfile_type=exe
#AutoIt3Wrapper_icon=Rocket.ico
#AutoIt3Wrapper_outfile=MicroOS.a3x
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_PassPhrase=8%*L9@BV@S@P++XB@A5^A&K
#AutoIt3Wrapper_Res_Comment=Created by Justin Reno.
#AutoIt3Wrapper_Res_Description=Your own virtual OS.
#AutoIt3Wrapper_Res_Fileversion=0.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=MicroOS copyright Justin Reno 2007 with all applications included.
#AutoIt3Wrapper_Res_Language=1033
#AutoIt3Wrapper_Run_Tidy=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#Include <IE.au3>
#Include <File.au3>
#Include <String.au3>
#Include <GUIEdit.au3>
#Include <Misc.au3>
#Include <Sound.au3>
#Include <Array.au3>
#Include <Date.au3>

If @OSVersion <> "WIN_VISTA" Then
    If @OSVersion <> "WIN_XP" Then
        MsgBox(16, "MicroOS", "You need Windows XP or higher for MicroOS to work.")
        Exit
    EndIf
EndIf

#cs
FileInstall("Earth.ico", @TempDir & "\Earth.ico")
FileInstall("Notepad.ico", @TempDir & "\Notepad.ico")
FileInstall("Music.ico", @TempDir & "\Music.ico")
FileInstall("StartButton.bmp", @TempDir & "\StartButton.bmp")
FileInstall("Ripple.jpg", @TempDir & "\Ripple.jpg")
FileInstall("Friend.jpg", @TempDir & "\Friend.jpg")
FileInstall("HelpFile.html", @TempDir & "\HelpFile.html")
#CE

Global $StartButtonWidth
Global $Ini = @ScriptDir & "\MicroOSSettings.ini"

If FileExists($Ini) Then
    $DecryptIni = _StringEncrypt(0, FileRead($Ini), "MicroOS")
    FileDelete($Ini)
    FileWrite($Ini, $DecryptIni)
EndIf

Global $HomePage = IniRead($Ini, "Internet", "Homepage", "")
Global $StartUpSound = IniRead($Ini, "MicroOS", "StartUpSound", ""), $ShutdownSound = IniRead($Ini, "MicroOS", "ShutdownSound", "")
Global $DesktopBackground = IniRead($Ini, "MicroOS", "DesktopBackground", ""), $StartMenuColor = IniRead($Ini, "MicroOS", "StartMenuColor", "")
Global $StartUpPassword = IniRead($Ini, "MicroOS", "StartUpPassword", "")
Global $SYSTEM_POWER_STATUS

AdlibEnable("_TimeBattery", 1000)

Opt("GuiResizeMode", 1)

$MicroOS = GUICreate("MicroOS", 640, 480)

_StartUpFunctions()

$DesktopContextMenu = GUICtrlCreateContextMenu()
$InternetContextMenuItem = GUICtrlCreateMenuItem("Internet", $DesktopContextMenu)
$Separator = GUICtrlCreateMenuItem("", $DesktopContextMenu)
$NotepadContextMenuItem = GUICtrlCreateMenuItem("Notepad", $DesktopContextMenu)
$Separator = GUICtrlCreateMenuItem("", $DesktopContextMenu)
$MusicPlayerContextMenuItem = GUICtrlCreateMenuItem("Music Player", $DesktopContextMenu)

$Help_Menu = GUICtrlCreateMenu("Help")
$Help = GUICtrlCreateMenuItem("Help", $Help_Menu)

$DesktopInternetButton = GUICtrlCreateButton("Internet", 10, 40, 20, -1, $BS_ICON)
GUICtrlSetImage($DesktopInternetButton, @TempDir & "\Earth.ico")

$DesktopNotepadButton = GUICtrlCreateButton("Notepad", 10, 100, 20, -1, $BS_ICON)
GUICtrlSetImage($DesktopNotepadButton, @TempDir & "\Notepad.ico")

$DesktopMusicPlayerButton = GUICtrlCreateButton("Music Player", 10, 160, 20, -1, $BS_ICON)
GUICtrlSetImage($DesktopMusicPlayerButton, @TempDir & "\Music.ico")

If @DesktopWidth = 1440 And @DesktopHeight = 900 Then $StartButtonWidth = @DesktopWidth / 29
If @DesktopWidth = 1280 And @DesktopHeight = 768 Then $StartButtonWidth = @DesktopWidth / 23
If @DesktopWidth = 1280 And @DesktopHeight = 720 Then $StartButtonWidth = @DesktopWidth / 23
If @DesktopWidth = 1024 And @DesktopHeight = 768 Then $StartButtonWidth = @DesktopWidth / 14.5
If @DesktopWidth = 800 And @DesktopHeight = 600 Then $StartButtonWidth = @DesktopWidth / 8.9
$StartButton = GUICtrlCreateButton("Start", 1, 435, $StartButtonWidth, 25, $BS_BITMAP)
GUICtrlSetImage($StartButton, @TempDir & "\StartButton.bmp")

WinSetState($MicroOS, "", @SW_MAXIMIZE)
GUISetState(@SW_SHOW, $MicroOS)
MouseMove(@DesktopWidth / 2, @DesktopHeight / 2, 0)

$SYSTEM_POWER_STATUS = DllStructCreate("byte;byte;byte;byte;int;int")

_ReduceMemory()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            _Shutdown()
        Case $Help
            _Internet(1, @TempDir & "\HelpFile.html")
        Case $DesktopInternetButton
            _Internet(1)
        Case $DesktopNotepadButton
            _Notepad(1)
        Case $DesktopMusicPlayerButton
            _MusicPlayer(1)
        Case $StartButton
            _StartMenu()
        Case $InternetContextMenuItem
            _Internet(1)
        Case $NotepadContextMenuItem
            _Notepad(1)
        Case $MusicPlayerContextMenuItem
            _MusicPlayer(1)
    EndSwitch
WEnd

Func _Internet($YN = 0, $ReDirectURL = 0)
    Opt("GuiResizeMode", 1)
    _IEErrorHandlerRegister()
    $Internet = GUICreate("MicroOS - Internet", 628, 447, -1, -1, $WS_OVERLAPPED + $WS_CAPTION + $WS_SYSMENU + $WS_THICKFRAME + $WS_MAXIMIZEBOX, $WS_EX_TOPMOST)
    $URL = GUICtrlCreateInput("", 56, 400, 121, 21)
    GUICtrlCreateLabel("Enter URL:", 0, 408, 57, 17)
    $Go = GUICtrlCreateButton("Go", 184, 400, 75, 25, $BS_DEFPUSHBUTTON)
    $Stop = GUICtrlCreateButton("Stop", 264, 400, 75, 25, 0)
    $Back = GUICtrlCreateButton("Back", 344, 400, 75, 25, 0)
    $Forward = GUICtrlCreateButton("Forward", 424, 400, 75, 25, 0)
    $IE = ObjCreate("Shell.Explorer.2")
    GUICtrlCreateObj($IE, 0, 0, 626, 396)
    $File_Menu = GUICtrlCreateMenu("File")
    $Open = GUICtrlCreateMenuItem("Open", $File_Menu)
    $Separator = GUICtrlCreateMenuItem("", $File_Menu)
    $Save = GUICtrlCreateMenuItem("Save", $File_Menu)
    $Separator = GUICtrlCreateMenuItem("", $File_Menu)
    $Print = GUICtrlCreateMenuItem("Print", $File_Menu)
    $Separator = GUICtrlCreateMenuItem("", $File_Menu)
    $Exit = GUICtrlCreateMenuItem("Exit", $File_Menu)
    If $HomePage = "" Then $HomePage = "about:blank"
    If $ReDirectURL = 0 Then _IENavigate($IE, $HomePage, 0)
    If Not $ReDirectURL = 0 Then _IENavigate($IE, $ReDirectURL, 0)
    GUISetState(@SW_SHOW)
    _ReduceMemory()
    While 1
        WinSetTitle($Internet, "", "MicroOS - Internet - " & _IEPropertyGet($IE, "LocationURL") & " - " & @IPAddress1 & "")
        _IELoadWaitTimeout(1000)
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                GUIDelete($Internet)
                WinActivate($MicroOS)
                If $YN = 1 Then ExitLoop
                If $YN = 0 Then ExitLoop (2)
            Case $Go
                $URLReadURL = GUICtrlRead($URL)
                _IENavigate($IE, $URLReadURL)
                IniWrite($Ini, "Internet", "URL", $URLReadURL)
            Case $Stop
                _IEAction($IE, "Stop")
            Case $Back
                _IEAction($IE, "Back")
            Case $Forward
                _IEAction($IE, "Forward")
            Case $Open
                $OpenFileDialog = FileOpenDialog("MicroOS - Internet - Open File", @ScriptDir, "HTML Files(*.html)")
                _IENavigate($IE, $OpenFileDialog)
            Case $Save
                _IEAction($IE, "SaveAs")
            Case $Print
                _IEAction($IE, "Print")
            Case $Exit
                GUIDelete($Internet)
                If $YN = 1 Then ExitLoop
                If $YN = 0 Then ExitLoop (2)
        EndSwitch
    WEnd
EndFunc   ;==>_Internet

Func _Console()
    Opt("GuiResizeMode", 1)
    $Console = GUICreate("MicroOS - Console", 634, 435, -1, -1, $WS_OVERLAPPED + $WS_CAPTION + $WS_SYSMENU + $WS_THICKFRAME + $WS_MAXIMIZEBOX, $WS_EX_TOPMOST)
    $Out = GUICtrlCreateEdit("Type Help to view a list of commands.", 0, 0, 633, 385)
    $In = GUICtrlCreateInput("", 0, 384, 633, 21)
    $SendCommand = GUICtrlCreateButton("Send Command", 0, 408, 627, 25, $BS_DEFPUSHBUTTON)
    GUICtrlSetState($Out, $GUI_DISABLE)
    GUICtrlSetBkColor($Out, 0x000000)
    GUICtrlSetColor($Out, 0xFFFFFF)
    GUISetState(@SW_SHOW)
    _ReduceMemory()
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                GUIDelete($Console)
                WinActivate($MicroOS)
                ExitLoop (2)
            Case $SendCommand
                $ReadCommand = GUICtrlRead($In)
                If $ReadCommand = "Help" Then
                    GUICtrlSetData($Out, "List Of Commands: Help: Shows all the commands " & @CRLF & " IP: Shows your IP address " & @CRLF & " Computer Information: Shows stats about your computer " & @CRLF & " CLS: Clears the console output " & @CRLF & " Reset Desktop Background Image: Resets the desktop background image to default " & @CRLF & " Format MicroOS: Resets MicroOS.")
                    GUICtrlSetData($In, "")
                EndIf
                If $ReadCommand = "IP" Then
                    $ReadPreviousOut = GUICtrlRead($Out)
                    GUICtrlSetData($Out, $ReadPreviousOut & "" & @CRLF & @CRLF & @IPAddress1 & "")
                    GUICtrlSetData($In, "")
                EndIf
                If $ReadCommand = "Computer Information" Then
                    $ReadPreviousOut = GUICtrlRead($Out)
                    GUICtrlSetData($Out, $ReadPreviousOut & "" & @CRLF & @CRLF & @ComputerName & @CRLF & @HomeDrive & @CRLF & @IPAddress1 & @CRLF & @OSVersion & @CRLF & @DesktopDir & @CRLF & @ProgramFilesDir & @CRLF & @SystemDir & @CRLF & @TempDir & @CRLF & @UserName & @CRLF & @WindowsDir & "")
                    GUICtrlSetData($In, "")
                EndIf
                If $ReadCommand = "CLS" Then
                    GUICtrlSetData($Out, "")
                    GUICtrlSetData($In, "")
                EndIf
                If $ReadCommand = "Reset Desktop Background Image" Then
                    GUICtrlSetData($Out, "")
                    GUICtrlSetData($In, "")
                    IniDelete($Ini, "MicroOS", "DesktopBackground")
                    _Restart()
                EndIf
                If $ReadCommand = "Format MicroOS" Then
                    GUICtrlSetData($Out, "")
                    GUICtrlSetData($In, "")
                    FileDelete($Ini)
                    _Restart()
                EndIf
        EndSwitch
    WEnd
EndFunc   ;==>_Console

Func _Notepad($YN = 0)
    Opt("GuiResizeMode", 1)
    $Notepad = GUICreate("MicroOS - Notepad", 627, 438, -1, -1, $WS_OVERLAPPED + $WS_CAPTION + $WS_SYSMENU + $WS_THICKFRAME + $WS_MAXIMIZEBOX, $WS_EX_TOPMOST)
    $Edit = GUICtrlCreateEdit("", 0, 0, 625, 417)
    $File_Menu = GUICtrlCreateMenu("File")
    $New = GUICtrlCreateMenuItem("New", $File_Menu)
    $Open = GUICtrlCreateMenuItem("Open", $File_Menu)
    $Save = GUICtrlCreateMenuItem("Save", $File_Menu)
    $Print = GUICtrlCreateMenuItem("Print", $File_Menu)
    GUICtrlCreateMenuItem("", $File_Menu)
    $Exit = GUICtrlCreateMenuItem("Exit", $File_Menu)
    $Edit_Menu = GUICtrlCreateMenu("Edit")
    $InsertCurrentTime = GUICtrlCreateMenuItem("Insert Current Time", $Edit_Menu)
    GUICtrlCreateMenuItem("", $Edit_Menu)
    $ReverseText = GUICtrlCreateMenuItem("Reverse Text", $Edit_Menu)
    GUICtrlCreateMenuItem("", $Edit_Menu)
    $WordCount = GUICtrlCreateMenuItem("Word Count", $Edit_Menu)
    GUICtrlCreateMenuItem("", $Edit_Menu)
    $Copy = GUICtrlCreateMenuItem("Copy", $Edit_Menu)
    $Paste = GUICtrlCreateMenuItem("Paste", $Edit_Menu)
    GUICtrlCreateMenuItem("", $Edit_Menu)
    $Undo = GUICtrlCreateMenuItem("Undo", $Edit_Menu)
    GUICtrlCreateMenuItem("", $Edit_Menu)
    $Font = GUICtrlCreateMenuItem("Font", $Edit_Menu)
    GUISetState(@SW_SHOW)
    _ReduceMemory()
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE, $Exit
                GUIDelete($Notepad)
                WinActivate($MicroOS)
                If $YN = 1 Then ExitLoop
                If $YN = 0 Then ExitLoop (2)
            Case $New
                GUICtrlSetData($Edit, "")
            Case $Open
                $FileOpen = FileOpenDialog("MicroOS - Notepad - Open File", @ScriptDir, "Text Files(*.txt)")
                If Not @error Then
                    GUICtrlSetData($Edit, FileRead($FileOpen))
                EndIf
            Case $Save
                $FileSave = FileSaveDialog("MicroOS - Notepad - Save File", @ScriptDir, "Text Files(*.txt)")
                If Not @error Then FileWrite($FileSave, GUICtrlRead($Edit))
            Case $Print
                FileWrite(@TempDir & "\Print.txt", GUICtrlRead($Edit))
                _FilePrint(@TempDir & "\Print.txt")
            Case $InsertCurrentTime
                ControlSend($Notepad, "", $Edit, "" & @HOUR & ":" & @MIN & ":" & @SEC & "")
            Case $ReverseText
                GUICtrlSetData($Edit, _StringReverse(GUICtrlRead($Edit)))
            Case $WordCount
                $GetWords = StringSplit(GUICtrlRead($Edit), " ")
                MsgBox(0, "MicroOS - Notepad - Word Count", "Word Count: " & $GetWords[0] & ".")
            Case $Copy
                ClipPut(GUICtrlRead($Edit))
            Case $Paste
                GUICtrlSetData($Edit, GUICtrlRead($Edit) & ClipGet())
            Case $Undo
                _GUICtrlEdit_Undo ($Edit)
            Case $Font
                $SFont = _ChooseFont()
                If Not @error Then
                    $Font = GUICtrlSetFont($Edit, $SFont[3], $SFont[4], $SFont[1], $SFont[2])
                    $Color = GUICtrlSetColor($Edit, $SFont[7])
                EndIf
        EndSwitch
    WEnd
EndFunc   ;==>_Notepad

Func _MusicPlayer($YN = 0)
    Opt("GuiResizeMode", 1)
    Global $SoundLoad
    $MusicPlayer = GUICreate("MicroOS - Music Player", 236, 122, -1, -1, $WS_OVERLAPPED + $WS_CAPTION + $WS_SYSMENU + $WS_THICKFRAME + $WS_MAXIMIZEBOX, $WS_EX_TOPMOST)
    $LoadSound = GUICtrlCreateButton("Load Sound", 0, 0, 75, 25, 0)
    $PlaySound = GUICtrlCreateButton("Play Sound", 0, 24, 75, 25, 0)
    $PauseSound = GUICtrlCreateButton("Pause Sound", 0, 48, 75, 25, 0)
    $ResumeSound = GUICtrlCreateButton("Resume Sound", 0, 72, 75, 25, 0)
    $StopSound = GUICtrlCreateButton("Stop Sound", 0, 96, 75, 25, 0)
    $Status = GUICtrlCreateLabel("Status:", 80, 0, 80, 57)
    GUISetState(@SW_SHOW)
    _ReduceMemory()
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                _SoundStop($SoundLoad)
                GUIDelete($MusicPlayer)
                WinActivate($MicroOS)
                If $YN = 1 Then ExitLoop
                If $YN = 0 Then ExitLoop (2)
            Case $LoadSound
                $MusicLoad = FileOpenDialog("MicroOS - Music Player - Open File", @ScriptDir, "Music Files(*.mp3;*.wav)")
                If Not @error Then
                    $SoundLoad = _SoundOpen($MusicLoad)
                    _SoundPlay($SoundLoad)
                    GUICtrlSetData($Status, "Status: Loaded and Playing.")
                EndIf
            Case $PlaySound
                _SoundPlay($SoundLoad)
                GUICtrlSetData($Status, "Status: Playing.")
            Case $PauseSound
                _SoundPause($SoundLoad)
                GUICtrlSetData($Status, "Status: Pause.")
            Case $ResumeSound
                _SoundResume($SoundLoad)
                GUICtrlSetData($Status, "Status: Resumed and Playing.")
            Case $StopSound
                _SoundStop($SoundLoad)
                GUICtrlSetData($Status, "Status: Stopped.")
        EndSwitch
    WEnd
EndFunc   ;==>_MusicPlayer

Func _Calculator()
    Opt("GuiResizeMode", 1)
    Global $MultiplySelected = 0, $DivideSelected = 0, $Additionselected = 0, $Subtractionselected = 0
    $Calculator = GUICreate("MicroOS - Calculator", 223, 130, -1, -1, $WS_OVERLAPPED + $WS_CAPTION + $WS_SYSMENU + $WS_THICKFRAME + $WS_MAXIMIZEBOX, $WS_EX_TOPMOST)
    $InputOutput = GUICtrlCreateInput("", 0, 0, 121, 21)
    $1 = GUICtrlCreateButton("1", 0, 32, 19, 25, 0)
    $2 = GUICtrlCreateButton("2", 24, 32, 19, 25, 0)
    $3 = GUICtrlCreateButton("3", 48, 32, 19, 25, 0)
    $4 = GUICtrlCreateButton("4", 72, 32, 19, 25, 0)
    $5 = GUICtrlCreateButton("5", 96, 32, 19, 25, 0)
    $6 = GUICtrlCreateButton("6", 0, 64, 19, 25, 0)
    $7 = GUICtrlCreateButton("7", 24, 64, 19, 25, 0)
    $8 = GUICtrlCreateButton("8", 48, 64, 19, 25, 0)
    $9 = GUICtrlCreateButton("9", 72, 64, 19, 25, 0)
    $0 = GUICtrlCreateButton("0", 96, 64, 19, 25, 0)
    $Multiply = GUICtrlCreateButton("*", 0, 104, 19, 25, 0)
    $Divide = GUICtrlCreateButton("/", 24, 104, 19, 25, 0)
    $Addition = GUICtrlCreateButton("+", 48, 104, 19, 25, 0)
    $Subtraction = GUICtrlCreateButton("-", 72, 104, 19, 25, 0)
    $Equals = GUICtrlCreateButton("=", 96, 104, 19, 25, 0)
    $Reset = GUICtrlCreateButton("Reset", 120, 104)
    GUISetState(@SW_SHOW)
    _ReduceMemory()
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                GUIDelete($Calculator)
                WinActivate($MicroOS)
                ExitLoop (2)
            Case $1
                GUICtrlSetData($InputOutput, GUICtrlRead($InputOutput) & "1")
            Case $2
                GUICtrlSetData($InputOutput, GUICtrlRead($InputOutput) & "2")
            Case $3
                GUICtrlSetData($InputOutput, GUICtrlRead($InputOutput) & "3")
            Case $4
                GUICtrlSetData($InputOutput, GUICtrlRead($InputOutput) & "4")
            Case $5
                GUICtrlSetData($InputOutput, GUICtrlRead($InputOutput) & "5")
            Case $6
                GUICtrlSetData($InputOutput, GUICtrlRead($InputOutput) & "6")
            Case $7
                GUICtrlSetData($InputOutput, GUICtrlRead($InputOutput) & "7")
            Case $8
                GUICtrlSetData($InputOutput, GUICtrlRead($InputOutput) & "8")
            Case $9
                GUICtrlSetData($InputOutput, GUICtrlRead($InputOutput) & "9")
            Case $0
                GUICtrlSetData($InputOutput, GUICtrlRead($InputOutput) & "0")
            Case $Multiply
                $MultiplySelected = 1
                $MultiplyReadBefore = GUICtrlRead($InputOutput)
                GUICtrlSetData($InputOutput, "")
            Case $Divide
                $DivideSelected = 1
                $DivideReadBefore = GUICtrlRead($InputOutput)
                GUICtrlSetData($InputOutput, "")
            Case $Addition
                $Additionselected = 1
                $AdditionReadBefore = GUICtrlRead($InputOutput)
                GUICtrlSetData($InputOutput, "")
            Case $Subtraction
                $Subtractionselected = 1
                $SubtractionReadBefore = GUICtrlRead($InputOutput)
                GUICtrlSetData($InputOutput, "")
            Case $Equals
                $ReadAllAfter = GUICtrlRead($InputOutput)
                If $MultiplySelected = 1 Then
                    $Answer = Number($MultiplyReadBefore * $ReadAllAfter)
                    GUICtrlSetData($InputOutput, $Answer)
                EndIf
                If $DivideSelected = 1 Then
                    $Answer = Number($DivideReadBefore / $ReadAllAfter)
                    GUICtrlSetData($InputOutput, $Answer)
                EndIf
                If $Additionselected = 1 Then
                    $Answer = Number($AdditionReadBefore + $ReadAllAfter)
                    GUICtrlSetData($InputOutput, $Answer)
                EndIf
                If $Subtractionselected = 1 Then
                    $Answer = Number($SubtractionReadBefore - $ReadAllAfter)
                    GUICtrlSetData($InputOutput, $Answer)
                EndIf
            Case $Reset
                $MultiplySelected = 0
                $DivideSelected = 0
                $Additionselected = 0
                $Subtractionselected = 0
                GUICtrlSetData($InputOutput, "")
        EndSwitch
    WEnd
EndFunc   ;==>_Calculator

Func _ExcuseMaker()
    $Something1 = _ArrayCreate(10, "My Computer", "My cat", "My dog", "My brother", "My sister", "Hitler", "My mom", "My dad", "The Police", "My school")
    $Todo = _ArrayCreate(11, "ate", "vomited on", "burned", "blew up", "shot", "cut", "washed", "stole", "ran over", "cried", "peed on")
    $Something2 = _ArrayCreate(10, "my homework", "my money", "my house", "my face", "my brother", "my sister", "Hitler", "my mind", "my life", "me")
    MsgBox(0, "Excuse Maker", $Something1[Random(1, 10, 1) ] & " " & $Todo[Random(1, 11, 1) ] & " " & $Something2[Random(1, 10, 1) ] & ".")
EndFunc   ;==>_ExcuseMaker

Func _ControlPanel()
    $ControlPanel = GUICreate("MicroOS - Control Panel", 439, 110)
    GUICtrlCreateGroup("Internet:", 8, 0, 145, 105)
    If $HomePage = "" Then $HomePage = "about:blank"
    $HomePage = GUICtrlCreateInput($HomePage, 16, 40, 121, 21)
    GUICtrlCreateLabel("Home Page:", 16, 24, 63, 17)
    $Change = GUICtrlCreateButton("Change", 16, 64, 123, 25, 0)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUICtrlCreateGroup("MicroOS", 160, 0, 273, 105)
    $StartUpSound = GUICtrlCreateButton("Start Up Sound", 168, 24, 83, 25, 0)
    $ShutdownSound = GUICtrlCreateButton("Shutdown Sound", 168, 56, 83, 25, 0)
    GUICtrlSetFont($ShutdownSound, 8)
    $DesktopBackground = GUICtrlCreateButton("Desktop Background", 256, 24, 83, 57, $BS_MULTILINE)
    $StartUpPassword = GUICtrlCreateButton("Start Up Password", 344, 24, 83, 57, $BS_MULTILINE)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUISetState(@SW_SHOW)
    _ReduceMemory()
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                MsgBox(48, "MicroOS - Control Panel", "MicroOS needs to be restarted for changes to take effect. Press OK to restart.")
                GUIDelete($ControlPanel)
                WinActivate($MicroOS)
                _Restart()
            Case $Change
                IniWrite($Ini, "Internet", "HomePage", GUICtrlRead($HomePage))
                MsgBox(0, "MicroOS - Control Panel", "Done.")
            Case $StartUpSound
                $SelectStartUpSound = FileOpenDialog("MicroOS - Control Panel - Select Start Up Sound", @ScriptDir, "Sound Files(*.mp3;*.wav)")
                If Not @error Then
                    IniWrite($Ini, "MicroOS", "StartUpSound", FileGetShortName($SelectStartUpSound))
                    MsgBox(0, "MicroOS - Control Panel", "Done.")
                EndIf
            Case $ShutdownSound
                $SelectShutdownSound = FileOpenDialog("MicroOS - Control Panel - Select Shutdown Sound", @ScriptDir, "Sound Files(*.mp3;*.wav)")
                If Not @error Then
                    IniWrite($Ini, "MicroOS", "ShutdownSound", FileGetShortName($SelectShutdownSound))
                    MsgBox(0, "MicroOS - Control Panel", "Done.")
                EndIf
            Case $DesktopBackground
                $NewDesktopBackground = FileOpenDialog("MicroOS - Control Panel - Choose Desktop Background", @ScriptDir, "Images(*.jpg;*.bmp)")
                If Not @error Then
                    IniWrite($Ini, "MicroOS", "DesktopBackground", FileGetShortName($NewDesktopBackground))
                    MsgBox(0, "MicroOS - Control Panel", "Done.")
                EndIf
            Case $StartUpPassword
                $NewStartUpPassword = InputBox("MicroOS - Control Panel - Start Up Password", "Type in your new start up password:", "", "*")
                If Not @error Then
                    IniWrite($Ini, "MicroOS", "StartUpPassword", $NewStartUpPassword)
                    MsgBox(0, "MicroOS - Control Panel", "Done.")
                EndIf
        EndSwitch
    WEnd
EndFunc   ;==>_ControlPanel

Func _Lock()
    $Password = InputBox("MicroOS - Lock", "What password do you want to lock MicroOS with?", "", "*M")
    If Not @error Then
        $Lock = GUICreate("MicroOS - Lock - Type your Password to unlock.", 388, 26, -1, -1, $WS_OVERLAPPED + $WS_CAPTION + $WS_SYSMENU + $WS_THICKFRAME)
        $PasswordInput = GUICtrlCreateInput("", 0, 0, 121, 21, $ES_PASSWORD)
        $Ok = GUICtrlCreateButton("Ok", 120, 0, 267, 25, $BS_DEFPUSHBUTTON)
        GUISetState(@SW_SHOW)
        _ReduceMemory()
        While 1
            If Not WinActive($Lock) Then WinActivate($Lock)
            If ProcessExists("taskmgr.exe") Then ProcessClose("taskmgr.exe")
            Switch GUIGetMsg()
                Case $Ok
                    $ReadPasswordInput = GUICtrlRead($PasswordInput)
                    If $ReadPasswordInput <> $Password Then
                        MsgBox(16, "MicroOS - Lock", "Invalid Password.")
                    Else
                        MsgBox(0, "MicroOS - Lock", "Correct.")
                        GUIDelete($Password)
                        WinActivate($MicroOS)
                        ExitLoop (2)
                    EndIf
            EndSwitch
        WEnd
    EndIf
EndFunc   ;==>_Lock

Func _StartMenu()
    $GetFirst = Number(@DesktopHeight - 235)
    $GetAll = Number($GetFirst - 45)
    $StartMenu = GUICreate("MicroOS - Start Menu", 247, 235, 3, $GetAll, $WS_POPUP)
    $Internet = GUICtrlCreateButton("Internet", 40, 0, 75, 33, 0)
    GUICtrlCreateIcon(@ScriptDir & "\Earth.ico", 0, 0, 0, 32, 32, BitOR($SS_NOTIFY, $WS_GROUP))
    GUICtrlCreateIcon(@ScriptDir & "\Console.ico", 0, 0, 40, 32, 32, BitOR($SS_NOTIFY, $WS_GROUP))
    $Console = GUICtrlCreateButton("Console", 40, 40, 75, 33, 0)
    GUICtrlCreateIcon(@ScriptDir & "\Notepad.ico", 0, 0, 80, 32, 32, BitOR($SS_NOTIFY, $WS_GROUP))
    $Notepad = GUICtrlCreateButton("Notepad", 40, 80, 75, 33, 0)
    GUICtrlCreateIcon(@ScriptDir & "\Music.ico", 0, 0, 120, 32, 32, BitOR($SS_NOTIFY, $WS_GROUP))
    $MusicPlayer = GUICtrlCreateButton("Music Player", 40, 120, 75, 33, 0)
    GUICtrlCreateIcon(@ScriptDir & "\Calculator.ico", 0, 0, 160, 32, 32, BitOR($SS_NOTIFY, $WS_GROUP))
    $Calculator = GUICtrlCreateButton("Calculator", 40, 160, 75, 33, 0)
    $ExcuseMaker = GUICtrlCreateButton("Excuse Maker", 40, 200, 75, 33, 0)
    GUICtrlCreateIcon(@ScriptDir & "\People.ico", 0, 0, 200, 32, 32, BitOR($SS_NOTIFY, $WS_GROUP))
    GUICtrlCreateIcon(@ScriptDir & "\Gear.ico", 0, 128, 0, 32, 32, BitOR($SS_NOTIFY, $WS_GROUP))
    $ControlPanel = GUICtrlCreateButton("Control Panel", 168, 0, 75, 33, 0)
    GUICtrlCreateIcon(@ScriptDir & "\Lock.ico", 0, 128, 40, 32, 32, BitOR($SS_NOTIFY, $WS_GROUP))
    $Lock = GUICtrlCreateButton("Lock", 168, 40, 75, 33, 0)
    GUICtrlCreateIcon(@ScriptDir & "\Shutdown.ico", 0, 128, 80, 32, 32, BitOR($SS_NOTIFY, $WS_GROUP))
    $Shutdown = GUICtrlCreateButton("Shutdown", 168, 80, 75, 33, 0)
    $StartMenuContextMenu = GUICtrlCreateContextMenu()
    $StartMenuColorContextMenuItem = GUICtrlCreateMenuItem("Change Background Color", $StartMenuContextMenu)
    If Not $StartMenuColor = "" Then GUISetBkColor($StartMenuColor, $StartMenu)
    GUISetState(@SW_SHOW)
    _ReduceMemory()
    While 1
        If Not WinActive($StartMenu) Then
            GUIDelete($StartMenu)
            WinActivate($MicroOS)
            ExitLoop
        EndIf
        Switch GUIGetMsg()
            Case $Internet
                GUIDelete($StartMenu)
                _Internet()
            Case $Console
                GUIDelete($StartMenu)
                _Console()
            Case $Notepad
                GUIDelete($StartMenu)
                _Notepad()
            Case $MusicPlayer
                GUIDelete($StartMenu)
                _MusicPlayer()
            Case $Calculator
                GUIDelete($StartMenu)
                _Calculator()
            Case $ExcuseMaker
                GUIDelete($StartMenu)
                _ExcuseMaker()
                ExitLoop
            Case $ControlPanel
                GUIDelete($StartMenu)
                _ControlPanel()
            Case $Lock
                GUIDelete($StartMenu)
                _Lock()
            Case $Shutdown
                GUIDelete($StartMenu)
                _Shutdown()
            Case $StartMenuColorContextMenuItem
                $ChooseStartMenuColor = _ChooseColor(2)
                If Not @error Then
                    GUISetBkColor($ChooseStartMenuColor, $StartMenu)
                    IniWrite($Ini, "MicroOS", "StartMenuColor", $ChooseStartMenuColor)
                    $StartMenuColor = IniRead($Ini, "MicroOS", "StartMenuColor", "")
                EndIf
        EndSwitch
    WEnd
EndFunc   ;==>_StartMenu

Func _TimeBattery()
    DllCall("kernel32.dll", "int", "GetSystemPowerStatus", "ptr", DllStructGetPtr($SYSTEM_POWER_STATUS))
    WinSetTitle($MicroOS, "", "MicroOS - " & _Now() & " - Battery Status: " & DllStructGetData($SYSTEM_POWER_STATUS, 3) & "% - MicroOS created by Justin Reno 2007.")
EndFunc   ;==>_TimeBattery

Func _StartUpFunctions()
    If $DesktopBackground = "" Then
        $PickRandom = Random(1, 2, 1)
        If $PickRandom = 1 Then $RandomPicture = @TempDir & "\Ripple.jpg"
        If $PickRandom = 2 Then $RandomPicture = @TempDir & "\Friend.jpg"
        $DesktopBackgroundPicture = GUICtrlCreatePic($RandomPicture, 0, 0, 640, 480)
        GUICtrlSetState($DesktopBackgroundPicture, $GUI_DISABLE)
    EndIf
    If Not $DesktopBackground = "" Then
        $DesktopBackgroundPicture = GUICtrlCreatePic($DesktopBackground, 0, 0, 640, 480)
        GUICtrlSetState($DesktopBackgroundPicture, $GUI_DISABLE)
    EndIf
    If Not $StartUpPassword = "" Then
        $StartUpPasswordAsk = InputBox("MicroOS - Login", "Enter your password to login:", "", "*")
        If $StartUpPasswordAsk <> $StartUpPassword Then
            MsgBox(16, "MicroOS - Login", "Incorrect.")
            _Shutdown()
        EndIf
    EndIf
    If Not $StartUpSound = "" Then SoundPlay($StartUpSound, 1)
EndFunc   ;==>_StartUpFunctions

Func _Restart()
    _Shutdown(1)
    If @Compiled = 1 Then
        Run(FileGetShortName(@ScriptFullPath))
    Else
        Run(FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath))
    EndIf
    Exit
EndFunc   ;==>_Restart

Func _Shutdown($E = 0)
    _ReduceMemory()
    If Not $ShutdownSound = "" Then SoundPlay($ShutdownSound, 1)
    If FileExists($Ini) Then
        $EncryptIni = _StringEncrypt(1, FileRead($Ini), "MicroOS")
        FileDelete($Ini)
        FileWrite($Ini, $EncryptIni)
    EndIf
    FileDelete(@TempDir & "\Earth.ico")
    FileDelete(@TempDir & "\Notepad.ico")
    FileDelete(@TempDir & "\Music.ico")
    FileDelete(@TempDir & "\StartButton.bmp")
    FileDelete(@TempDir & "\Ripple.jpg")
    FileDelete(@TempDir & "\Friend.jpg")
    FileDelete(@TempDir & "\HelpFile.html")
    FileDelete(@TempDir & "\Print.txt")
    If $E = 0 Then Exit
EndFunc   ;==>_Shutdown

Func _ReduceMemory($i_PID = -1)
    If $i_PID <> -1 Then
        Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $i_PID)
        Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0])
        DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle[0])
    Else
        Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
    EndIf
    Return $ai_Return[0]
EndFunc   ;==>_ReduceMemory

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0