Sign in to follow this  
Followers 0
FriendsFade

NFO Reader

1 post in this topic

#1 ·  Posted (edited)

Hello :unsure:

I made this a long time ago and it probably doesn't even work no more and is discontinued...but feel free to use it as a scrap :>

#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=icons\cyber-skull.ico
#AutoIt3Wrapper_Res_Comment=Created by - FriendsFade
#AutoIt3Wrapper_Res_Description=Mercenary NFO Viewer
#AutoIt3Wrapper_Res_Fileversion=1
#AutoIt3Wrapper_Res_LegalCopyright=MercNFO - FriendsFade
#AutoIt3Wrapper_Res_Language=1033
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <Misc.au3>
#Include <Constants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Global $Text , $ReadIni[5]
;ReadIni = Ini's +1
Opt("TrayMenuMode" ,1)
;Opt("OnExitFunc" , "_Exit")

_Singleton(@ScriptName)

$MainPath = @AppDataDir & "\Mercenary NFO Viewer\"
$SettingsPath = @AppDataDir & "\Mercenary NFO Viewer\NFO-Settings.ini"
$Executable = "MercNFO.exe"
$Section = "Settings"
$KeyRun = "Run"
$KeyNFOCol = "NFO Color"
$KeyTextCol = "Text Color"
$KeyTrans = "Transparent"
$KeyOnTop = "Always on Top"
$Buffer = ""
$Width = 672
$Height = 300
$Run = 0
$Trans = 0
$AlwaysOnTop = 0
$NFOCol = 0x000000
$TextCol = 0xFF0000
$Red = 0xFF0000
$Blue = 0x0000FF
$Black = 0x000000
$White = 0xFFFFFF
$Green = 0x00FF00
$Purple = 0x800080
$Yellow = 0xFFFF00

Global $Greet = "" & _
        "   ÜÛ²±°          þ                                  þ          °±²ÛÜ  " & @CRLF & _
        "  ÜÛ²²±±°           °                                  °          °±±²²ÛÜ  " & @CRLF & _
        "  Û²ß ßß   Üܲ²²²ÜÜ  ±°                                 °±  Üܲ²²²ÜÜ   ßß ß²Û  " & @CRLF & _
        "   ßÜ    ÜÛßßß  ßßÛ²±°ß                                  ß°±²Ûßß  ßßßÛÜ  Üß   " & @CRLF & _
        "   þ þß         ßß                                        ßß        ßþ þ     " & @CRLF & _
        "   ÜÜ    ßÜ        **      **  *********   *****           Üß    ÜÜ    " & @CRLF & _
        "  ÜÛ²²²²ÛÛÜ  Ü±°       **      **  *********   ********        °±Ü  ÜÛÛ²²²²ÛÜ  " & @CRLF & _
        " Þ±²ß   ßß²²±°ß     ***     **  **      *** ***         ß°±²²ßß   ß²±Þ " & @CRLF & _
        " ²±Ý                ****    **  **      **      **                  ݱ² " & @CRLF & _
        " ±                    ** **   **  **      ***     **                      ± " & @CRLF & _
        " ±                    **  **   **  ********  **       **                      ± " & @CRLF & _
        " ±                    **   *   **  ********  **       **                      ± " & @CRLF & _
        " ±                    **   **  **  **     **      ***                     ± " & @CRLF & _
        " ±                    **  ** **  **       **      **                      ± " & @CRLF & _
        " ±                    **  ****  **        **  ***                     ± " & @CRLF & _
        " ±                    **      ***  **         ********                        ± " & @CRLF & _
        " ±                    **      **  **          ****                        ± " & @CRLF & _
        " ±                                                                            ± " & @CRLF & _
        " ± This ""NFO Reader"" was created by FriendsFade.                            ± " & @CRLF & _
        " ±                                                                            ± " & @CRLF & _
        " ±                                                                            ± " & @CRLF & _
        " ±                                                                            ± " & @CRLF & _
        " ±                                                                            ± " & @CRLF & _
        " ±                                                                            ± " & @CRLF & _
        " ±                                                                            ± " & @CRLF & _
        " ²±                                                                          ±² " & @CRLF & _
        " ²±                                                                          ±² " & @CRLF & _
        " Þ²±ÜÛ²²Ü                                                              ܲ²Ûܱ²Þ " & @CRLF & _
        "  ß²²ß ²±Ü                                                              ܱ² ß²²ß  " & @CRLF & _
        "   ÜÛ²±°          þ                                  þ          °±²ÛÜ  " & @CRLF & _
        "  ÜÛ²²±±°           °                                  °          °±±²²ÛÜ  " & @CRLF & _
        "  Û²ß ßß   Üܲ²²²ÜÜ  ±°                                 °±  Üܲ²²²ÜÜ   ßß ß²Û  " & @CRLF & _
        "   ßÜ    ÜÛßßß  ßßÛ²±°ß                                  ß°±²Ûßß  ßßßÛÜ  Üß    " & @CRLF & _
        "   þ þß     Üþ ßß                                   ßß þÜ       ßþ þ     "

If $CmdLine[0] <> 0 Then
    If StringTrimLeft($CmdLine[1] , StringLen($CmdLine[1]) -4) = ".NFO" Then
        $FileData = $CmdLine[1]
        $Buffer = FileRead($FileData)
    Else
        MsgBox(16 , "Error" , "This isn't a NFO File!")
        Exit
    EndIf
EndIf

If @ScriptName <> $Executable Then
    MsgBox(16 , "Error" , "Please rename the program back to " & StringTrimRight($Executable , 4) & " or else you can't run this program.")
    Exit
EndIf

If Not FileExists($SettingsPath) Then
    _CreateIniFile()
EndIf

If FileExists($SettingsPath) Then
  ;  Smart IniFile just incase I decide to add new ini settings, this will update the ini
   
    $Error = "Error"
    $ReadIni[0] = IniRead($SettingsPath , $Section , $KeyRun , $Run);Run Once
    $ReadIni[0] = IniRead($SettingsPath , $Section , $KeyNFOCol , $Error);NFO Background Color
    $ReadIni[1] = IniRead($SettingsPath , $Section , $KeyTextCol , $Error);NFO Text Color
    $ReadIni[2] = IniRead($SettingsPath , $Section , $KeyTrans , $Error);NFO Transparent
    $ReadIni[3] = IniRead($SettingsPath , $Section , $KeyOnTop , $Error);NFO on Top
    $Ini = 0
    Do
        If $ReadIni[$Ini] = $Error Then
            _CreateIniFile()
            ExitLoop
        EndIf
        $Ini = $Ini +1
    Until $Ini = 5 ;ReadIni[X] +1
EndIf

If IniRead($SettingsPath , $Section , $KeyRun , $Run) = 0 Then
    FileCopy(@AutoItExe , $MainPath)
    IniWrite($SettingsPath , $Section , $KeyRun , 1)
EndIf

$NFO = GUICreate("Mercenary NFO Viewer", $Width, $Height, Default , Default , Default , $WS_EX_TOOLWINDOW + $WS_EX_ACCEPTFILES)
;File Functions Start
$File = GUICtrlCreateMenu("File")
$Open = GUICtrlCreateMenuItem("Open" , $File)
GUICtrlCreateMenuItem("", $File)
$Exit = GUICtrlCreateMenuItem("Exit" , $File)
;File Functions End
;Options Functions Start
$Options = GUICtrlCreateMenu("Options")
$Font = GUICtrlCreateMenu("Font" , $Options)
$FontRed = GUICtrlCreateMenuItem("Red" , $Font)
$FontBlue = GUICtrlCreateMenuItem("Blue" , $Font)
$FontBlack = GUICtrlCreateMenuItem("Black" , $Font)
$FontWhite = GUICtrlCreateMenuItem("White" , $Font)
$FontGreen = GUICtrlCreateMenuItem("Green" , $Font)
$FontPurple = GUICtrlCreateMenuItem("Purple" , $Font)
$FontYellow = GUICtrlCreateMenuItem("Yellow" , $Font)
GUICtrlCreateMenuItem("" , $Font)
$FontChoose = GUICtrlCreateMenuItem("Choose..." , $Font)
$Background = GUICtrlCreateMenu("Background" , $Options)
$BackgroundRed = GUICtrlCreateMenuItem("Red" , $Background)
$BackgroundBlue = GUICtrlCreateMenuItem("Blue" , $Background)
$BackgroundBlack = GUICtrlCreateMenuItem("Black" , $Background)
$BackgroundWhite = GUICtrlCreateMenuItem("White" , $Background)
$BackgroundGreen = GUICtrlCreateMenuItem("Green" , $Background)
$BackgroundPurple = GUICtrlCreateMenuItem("Purple" , $Background)
$BackgroundYellow = GUICtrlCreateMenuItem("Yellow" , $Background)
GUICtrlCreateMenuItem("" , $Background)
$BackgroundChoose = GUICtrlCreateMenuItem("Choose..." , $Background)
$Screen = GUICtrlCreateMenuItem("Full Screen" , $Options)
GUICtrlSetState($Trans, $GUI_UNCHECKED)
$Trans = GUICtrlCreateMenuItem("Transparent" , $Options)
GUICtrlSetState($Trans, $GUI_UNCHECKED)
$OnTop = GUICtrlCreateMenuItem("Always on Top" , $Options)
GUICtrlSetState($Trans, $GUI_UNCHECKED)
;Options Functions Start
;Register Options Functions Start
$RegMenu = GUICtrlCreateMenu("Register")
$Reg = GUICtrlCreateMenuItem("Register" , $RegMenu)
$UnReg = GUICtrlCreateMenuItem("Un-Register" , $RegMenu)
;Register Options Functions End
$Dummy = GUICtrlCreateEdit($Greet , 0 , 0 , $Width , $Height -20)
GUICtrlSetState($Dummy, $GUI_HIDE)
If $Buffer = "" Then
    $Text = GUICtrlCreateEdit($Greet , 0 , 0 , $Width , $Height -20 , $ES_READONLY + $WS_VSCROLL)
Else
    $Text = GUICtrlCreateEdit($Buffer , 0 , 0 , $Width , $Height -20 , $ES_READONLY + $WS_VSCROLL)
EndIf
;Tray Functions Start
$TrayOpen = TrayCreateItem("Open NFO")
$TrayState = TrayCreateItem("Hide")
$TrayExit = TrayCreateItem("Exit")
;Tray Functions End
GUICtrlSetState($Text, $GUI_DROPACCEPTED)
GUICtrlSetColor($Text , $TextCol)
GUICtrlSetBkColor($Text , $NFOCol)
GUICtrlSetFont($Text, 6, 300, -1, "Terminal")
GUICtrlSetState($Text, $GUI_NOFOCUS)
GUISetState()
TraySetState()

If IniRead($SettingsPath , $Section , "Trans" , 0) = 1 Then
    WinSetTrans($NFO , "" , 200)
    GUICtrlSetState($Trans, $GUI_CHECKED)
Else
    WinSetTrans($NFO , "" , 255)
    GUICtrlSetState($Trans, $GUI_UNCHECKED)
EndIf

If IniRead($SettingsPath , $Section , "Always on Top" , 0) = 1 Then
    WinSetOnTop($NFO , "" , 1)
    GUICtrlSetState($OnTop, $GUI_CHECKED)
Else
    WinSetOnTop($NFO , "" , 0)
    GUICtrlSetState($OnTop, $GUI_UNCHECKED)
EndIf

GUICtrlSetColor($Text , IniRead($SettingsPath , $Section , "TextCol" , $TextCol))
GUICtrlSetBkColor($Text , IniRead($SettingsPath , $Section , "NFOCol" , $NFOCol))

$Tray = 0

While 1
    $GGM = GUIGetMsg()
    $TGM = TrayGetMsg()
    Switch $GGM
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GUI_EVENT_DROPPED
            $Buffer = GUICtrlRead($Text)
            $SetData = @GUI_DragFile
            $SetData = StringReplace($SetData,@CR,"")
            $SetData = StringReplace($SetData,@LF,"")
            If StringTrimLeft($SetData , StringLen($SetData) -4) = ".NFO" Then
                GUICtrlSetData($Text , FileRead($SetData))
            Else
                If IniRead($SettingsPath , $Section , "Always on Top" , 0) = 1 Then
                    WinSetOnTop($NFO , "" , 0)
                    GUICtrlSetData($Text, StringReplace($Buffer, @GUI_DragFile, ""))
                    MsgBox(16 , "Error" , "This isn't a NFO File!")
                    WinSetOnTop($NFO , "" , 1)
                Else
                    GUICtrlSetData($Text, StringReplace($Buffer, @GUI_DragFile, ""))
                    MsgBox(16 , "Error" , "This isn't a NFO File!")
                EndIf
            EndIf
        Case $Open
            $FileOP = FileOpenDialog("NFO Viewer" , "" , "NFO File (*.NFO)")
            If Not @Error Then
                FileOpen($FileOP , 0)
                GUICtrlSetData($Text , FileRead($FileOP))
                FileClose($FileOP)
            EndIf
        Case $Exit
            Exit
        Case $Trans
            If BitAND(GUICtrlRead($Trans) , $GUI_CHECKED) = $GUI_CHECKED Then
                WinSetTrans($NFO , "" , 255)
                GUICtrlSetState($Trans, $GUI_UNCHECKED)
                IniWrite($SettingsPath , $Section , "Trans" , 0)
            Else
                WinSetTrans($NFO , "" , 200)
                GUICtrlSetState($Trans, $GUI_CHECKED)
                IniWrite($SettingsPath , $Section , "Trans" , 1)
            EndIf
        Case $FontRed
            GUICtrlSetColor($Text , $Red)
            IniWrite($SettingsPath , $Section , "TextCol" , $Red)
        Case $FontBlue
            GUICtrlSetColor($Text , $Blue)
            IniWrite($SettingsPath , $Section , "TextCol" , $Blue)
        Case $FontBlack
            GUICtrlSetColor($Text , $Black)
            IniWrite($SettingsPath , $Section , "TextCol" , $Black)
        Case $FontWhite
            GUICtrlSetColor($Text , $White)
            IniWrite($SettingsPath , $Section , "TextCol" , $White)
        Case $FontGreen
            GUICtrlSetColor($Text , $Green)
            IniWrite($SettingsPath , $Section , "TextCol" , $Green)
        Case $FontPurple
            GUICtrlSetColor($Text , $Purple)
            IniWrite($SettingsPath , $Section , "TextCol" , $Purple)
        Case $FontYellow
            GUICtrlSetColor($Text , $Yellow)
            IniWrite($SettingsPath , $Section , "TextCol" , $Yellow)
        Case $FontChoose
            $Color = _ChooseColor(2)
            If Not @Error Then
                GUICtrlSetColor($Text , $Color)
                IniWrite($SettingsPath , $Section , "TextCol" , $Color)
            EndIf
        Case $BackgroundRed
            GUICtrlSetBkColor($Text , $Red)
            IniWrite($SettingsPath , $Section , "NFOCol" , $Red)
        Case $BackgroundBlue
            GUICtrlSetBkColor($Text , $Blue)
            IniWrite($SettingsPath , $Section , "NFOCol" , $Blue)
        Case $BackgroundBlack
            GUICtrlSetBkColor($Text , $Black)
            IniWrite($SettingsPath , $Section , "NFOCol" , $Black)
        Case $BackgroundWhite
            GUICtrlSetBkColor($Text , $White)
            IniWrite($SettingsPath , $Section , "NFOCol" , $White)
        Case $BackgroundGreen
            GUICtrlSetBkColor($Text , $Green)
            IniWrite($SettingsPath , $Section , "NFOCol" , $Green)
        Case $BackgroundPurple
            GUICtrlSetBkColor($Text , $Purple)
            IniWrite($SettingsPath , $Section , "NFOCol" , $Purple)
        Case $BackgroundYellow
            GUICtrlSetBkColor($Text , $Yellow)
            IniWrite($SettingsPath , $Section , "NFOCol" , $Yellow)
        Case $BackgroundChoose
            $Color = _ChooseColor(2)
            If Not @Error Then
                GUICtrlSetBkColor($Text , $Color)
                IniWrite($SettingsPath , $Section , "NFOCol" , $Color)
            EndIf
        Case $Screen
            BlockInput(1)
            If BitAND(GUICtrlRead($Screen) , $GUI_CHECKED) = $GUI_CHECKED Then
                WinSetState($NFO , "" , @SW_RESTORE)
                GUICtrlSetState($Screen, $GUI_UNCHECKED)
            Else
                WinSetState($NFO , "" , @SW_MAXIMIZE)
                GUICtrlSetState($Screen, $GUI_CHECKED)
            EndIf
            BlockInput(0)
        Case $OnTop
            If BitAND(GUICtrlRead($OnTop) , $GUI_CHECKED) = $GUI_CHECKED Then
                WinSetOnTop($NFO , "" , 0)
                GUICtrlSetState($OnTop, $GUI_UNCHECKED)
                IniWrite($SettingsPath , $Section , "Always on Top" , 0)
            Else
                WinSetOnTop($NFO , "" , 1)
                GUICtrlSetState($OnTop, $GUI_CHECKED)
                IniWrite($SettingsPath , $Section , "Always on Top" , 1)
            EndIf
        Case $Reg
            If _MainMerc() = 1 Then ExitLoop
            _Reg()
            $WarTitle = "Warning!"
            $Warning = "Mercenary would just like to let you know that it needs to restart explorer.exe in order to take effect."
            $RegTitle = "Completed!"
            $RegMessage = "Mercenary should now be able to work with NFO files."
            If IniRead($SettingsPath , $Section , "Always on Top" , 0) = 1 Then
                WinSetOnTop($NFO , "" , 0)
                MsgBox(16 , $WarTitle , $Warning)
                _ProcessRestart()
                MsgBox(0 , $RegTitle , $RegMessage)
                WinSetOnTop($NFO , "" , 1)
            Else
                MsgBox(16 , $WarTitle , $Warning)
                _ProcessRestart()
                MsgBox(0 , $RegTitle , $RegMessage)
            EndIf
        Case $UnReg
            _UnReg()
            $WarTitle = "Warning!"
            $Warning = "Mercenary would just like to let you know that it needs to restart explorer.exe in order to take effect."
            $UnRegTitle = "Completed!"
            $UnRegMessage = "Mercenary is now fully uninstalled but will add itself to desktop incase you want to reinstall it at a later time."
            If IniRead($SettingsPath , $Section , "Always on Top" , 0) = 1 Then
            WinSetOnTop($NFO , "" , 0)
            MsgBox(16 , $WarTitle , $Warning)
            _ProcessRestart()
            MsgBox(0 , $UnRegTitle , $UnRegMessage)
            WinSetOnTop($NFO , "" , 1)
        Else
            MsgBox(16 , $WarTitle , $Warning)
            _ProcessRestart()
            MsgBox(0 , $UnRegTitle , $UnRegMessage)
        EndIf
    EndSwitch

    Switch $TGM
        Case $TrayOpen
            $FileOP = FileOpenDialog("NFO Viewer" , "" , "NFO File (*.NFO)")
            If Not @Error Then
                FileOpen($FileOP , 0)
                GUICtrlSetData($Text , FileRead($FileOP))
                FileClose($FileOP)
            EndIf

            If $Tray = 1 Then
                GUISetState(@SW_SHOW , $NFO)
                TrayItemSetText($TrayState , "Hide")
                $Tray = 0
            EndIf
        Case $TrayState
            If $Tray = 0 Then
                GUISetState(@SW_HIDE , $NFO)
                TrayItemSetText($TrayState , "Show")
                $Tray = 1
            ElseIf $Tray = 1 Then
                GUISetState(@SW_SHOW , $NFO)
                TrayItemSetText($TrayState , "Hide")
                $Tray = 0
            EndIf
        Case $TrayExit
            Exit
    EndSwitch
WEnd

Func _Reg()
    RegWrite("HKCR\.NFO", "", "REG_SZ", "")
    RegWrite("HKCR\.NFO" , "" , "REG_SZ" , "NFOFile")
    RegWrite("HKCR\.NFO", "", "REG_SZ", "Mercenary NFO Viewer")
    RegWrite("HKCR\.NFO\Shell", "", "REG_SZ", "")
    RegWrite("HKCR\.NFO\Shell\Open", "", "REG_SZ", "")
    RegWrite("HKCR\.NFO\Shell\Open\Command" , "" , "REG_SZ" , @AutoItExe & " %1")
    RegWrite("HKCR\.NFO\DefaultIcon", "", "REG_SZ", @AutoItExe & ',0')
EndFunc

Func _UnReg()
    FileCopy(@AutoItExe , @DesktopDir)
    RegDelete("HKCR\.NFO")
    DirRemove($MainPath , 1)
EndFunc

Func _ProcessRestart()
    $Process = "Explorer.exe"
    If ProcessExists($Process) Then
        Do
            ProcessClose($Process)
        Until Not ProcessExists($Process)
    ShellExecute($Process)
EndIf
EndFunc

Func _MainMerc()
    If FileExists($MainPath & $Executable) And @AutoItExe <> $MainPath & $Executable Then
        RegDelete("HKCR\.NFO")
        RegWrite("HKCR\.NFO", "", "REG_SZ", "")
        RegWrite("HKCR\.NFO" , "" , "REG_SZ" , "NFOFile")
        RegWrite("HKCR\.NFO", "", "REG_SZ", "Mercenary NFO Viewer")
        RegWrite("HKCR\.NFO\Shell", "", "REG_SZ", "")
        RegWrite("HKCR\.NFO\Shell\Open", "", "REG_SZ", "")
        RegWrite("HKCR\.NFO\Shell\Open\Command" , "" , "REG_SZ" , $MainPath & $Executable & " %1")
        RegWrite("HKCR\.NFO\DefaultIcon", "", "REG_SZ", $MainPath & $Executable & ',0')
        If @Compiled = 1 Then
            _SelfDelete()
        EndIf
        _ProcessRestart()
        Return 1
    EndIf
EndFunc

Func _SelfDelete($iDelay = 0)
    Local $sCmdFile
    FileDelete(@TempDir & "\scratch.bat")
    $sCmdFile = 'ping -n ' & $iDelay & '127.0.0.1 > nul' & @CRLF _
            & ':loop' & @CRLF _
            & 'del "' & @ScriptFullPath & '"' & @CRLF _
            & 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _
            & 'del ' & @TempDir & '\scratch.bat'
    FileWrite(@TempDir & "\scratch.bat", $sCmdFile)
    Run(@TempDir & "\scratch.bat", @TempDir, @SW_HIDE)
EndFunc

Func _CreateIniFile()
    FileDelete($SettingsPath)
    DirCreate($MainPath)
    IniWrite($SettingsPath , $Section , $KeyRun , $Run);Run Once
    IniWrite($SettingsPath , $Section , $KeyNFOCol , $NFOCol);NFO Background Color
    IniWrite($SettingsPath , $Section , $KeyTextCol , $TextCol);NFO Text Color
    IniWrite($SettingsPath , $Section , $KeyTrans , $Trans) ;NFO Transparent
    IniWrite($SettingsPath , $Section , $KeyOnTop , $AlwaysOnTop) ;NFO on Top
EndFunc

;Func _Exit()
    #cs
    The Purpose of making sure the Process exists is just incase a Antivirus trys to stop the
    programming from running and I want make sure they have access to explorer.exe.
    #CE
    ;$Process = "Explorer.exe"
    ;If Not ProcessExists($Process) Then
    ;   ShellExecute($Process)
    ;EndIf
;EndFunc
Edited by FriendsFade

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