Jump to content

FriendsFade

Members
  • Posts

    13
  • Joined

  • Last visited

FriendsFade's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Very Nice
  2. Nice, but I have a question. Why do we have the sleep hard-coded into Autoit anyways, if it isn't helping anything, shouldn't we toss the sleep and increase Autoit's performance speed wise. Unless this sleep somehow makes it more accurate.
  3. I don't plan on working on this script anymore it was just made to pass the time...It does need a few improvements Anyways ill post the source now and hopefully I will get some more feed back #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=Icon.ico #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <File.au3> #include <Misc.au3> #Include <WinAPI.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $Text , $Word , $Hang, $Blanks , $Letter[100] , $Labels[100] $Hang = 0 $Width = 864 $Height = 500 $Font_Size = 20 $Font_Name = "Jokerman" $Resource = @ScriptDir & "\Resources" _Singleton(@ScriptName) $Hangman = GUICreate("Hangman", $Width , $Height , Default, Default, $WS_POPUP + $WS_THICKFRAME);, $WS_EX_TOPMOST) GUISetBkColor(0xD0BE68, $Hangman) $Background = GUICtrlCreatePic($Resource & "\Background.bmp" , 0, 0, $Width, $Height) $Exit = GUICtrlCreatePic($Resource & "\Exit.bmp" , $Width -40, 0, 40, 40) $Head = GUICtrlCreatePic("" , 115, 180, 100, 64) $Torso = GUICtrlCreatePic("" , 145, 244, 40, 61) $Left_Arm = GUICtrlCreatePic("" , 127, 250, 18, 41) $Right_Arm = GUICtrlCreatePic("" , 185, 250, 18, 41) $Pants = GUICtrlCreatePic("" , 147, 305, 36, 20) $Left_Leg = GUICtrlCreatePic("" , 139, 325, 25, 35) $Right_Leg = GUICtrlCreatePic("" , 166, 325, 25, 35) ;$Text = GUICtrlCreateLabel("" , 0 , 50 , $Width, 50, $SS_CENTER) ;GUICtrlSetFont($Text, $Font_Size, 800, 0, $Font_Name) ;GUICtrlSetBkColor($Text, $GUI_BKCOLOR_TRANSPARENT) $Label_X = 0 $Label_Y = 50 For $i = 1 To StringLen($Word) Step +1 $Labels[$i] = GUICtrlCreateLabel("_" , $Label_X , $Label_Y , 50, 50) GUICtrlSetFont($Labels[$i], $Font_Size, 800, 0, $Font_Name) GUICtrlSetBkColor($Labels[$i], $GUI_BKCOLOR_TRANSPARENT) $Label_X += 50 Next $Word_Count = GUICtrlCreateLabel("" , 0 , 145, 180, 25, $SS_CENTER) GUICtrlSetFont($Word_Count, 12, 800, 0, $Font_Name) ;12 GUICtrlSetColor($Word_Count, 0x00FF00) GUICtrlSetBkColor($Word_Count, $GUI_BKCOLOR_TRANSPARENT) $Gold = GUICtrlCreateLabel("$100" , 0 , 370, 265, 30, $SS_CENTER) GUICtrlSetFont($Gold, $Font_Size, 800, 0, $Font_Name) GUICtrlSetColor($Gold, 0x00FF00) GUICtrlSetBkColor($Gold, $GUI_BKCOLOR_TRANSPARENT) $Letter_X = 0 $Letter_Y = $Height -32 For $i = 65 To 90 Step +1 $Letter[$i] = GUICtrlCreatePic($Resource & "\" & Chr($i) & ".bmp", $Letter_X, $Letter_Y, 32, 32) $Letter_X += 32 Next $Hint = GUICtrlCreatePic($Resource & "\Hint.bmp" , $Width -32 , $Letter_Y, 32, 32) GUICtrlSetColor($Hint, 0x000000) GUICtrlSetBkColor($Hint, 0xD0BE68) GUISetState(@SW_HIDE) GUICtrlSetState($Background , $GUI_DISABLE) _New_Game() GUIRegisterMsg($WM_SETCURSOR, "_Cursor") $Cur = DllCall("user32.dll", "int", "LoadCursorFromFile", "str", $Resource & "\Skull.cur") DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $Hangman, "int", 1000, "long", 0x00080000) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_NCHITTEST, "_No_Resize") While 1 $Msg = GUIGetMsg() Switch $Msg Case $Exit DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $Hangman, "int", 1000, "long", 0x00090000) Exit Case $Letter[65] ;To $Letter[90] _Use_Letter(65 , $Word) Case $Letter[66] _Use_Letter(66 , $Word) Case $Letter[67] _Use_Letter(67 , $Word) Case $Letter[68] _Use_Letter(68 , $Word) Case $Letter[69] _Use_Letter(69 , $Word) Case $Letter[70] _Use_Letter(70 , $Word) Case $Letter[71] _Use_Letter(71 , $Word) Case $Letter[72] _Use_Letter(72 , $Word) Case $Letter[73] _Use_Letter(73 , $Word) Case $Letter[74] _Use_Letter(74 , $Word) Case $Letter[75] _Use_Letter(75 , $Word) Case $Letter[76] _Use_Letter(76 , $Word) Case $Letter[77] _Use_Letter(77 , $Word) Case $Letter[78] _Use_Letter(78 , $Word) Case $Letter[79] _Use_Letter(79 , $Word) Case $Letter[80] _Use_Letter(80 , $Word) Case $Letter[81] _Use_Letter(81 , $Word) Case $Letter[82] _Use_Letter(82 , $Word) Case $Letter[83] _Use_Letter(83 , $Word) Case $Letter[84] _Use_Letter(84 , $Word) Case $Letter[85] _Use_Letter(85 , $Word) Case $Letter[86] _Use_Letter(86 , $Word) Case $Letter[87] _Use_Letter(87 , $Word) Case $Letter[88] _Use_Letter(88, $Word) Case $Letter[89] _Use_Letter(89 , $Word) Case $Letter[90] _Use_Letter(90 , $Word) Case $Hint SoundPlay($Resource & "\Hint.ogg") _Hint($Word) EndSwitch WEnd Func _Gen_Word() $Return_Word = FileReadLine($Resource & "\Word List.txt" , Random(1 , _FileCountLines($Resource & "\Word List.txt") , 1)) Return $Return_Word EndFunc Func _Use_Letter($Use_Letter, $Use_Word) GUICtrlSetState($Letter[$Use_Letter] , $GUI_DISABLE) GUICtrlSetImage($Letter[$Use_Letter] , $Resource & "\Blank.bmp") $Gen_Length = StringLen($Use_Word) $Find_Letter = StringInStr($Use_Word, Chr($Use_Letter)) If $Find_Letter Then $Letter_Count = 0 Do $Letter_Count = $Letter_Count +1 $Replace_Letter = StringInStr($Use_Word, Chr($Use_Letter), Default, $Letter_Count) GUICtrlSetData($Labels[$Replace_Letter], Chr($Use_Letter)) Until $Letter_Count = $Gen_Length _Check_Win() Else _Hang() GUISetState(@SW_SHOW, $Hangman) EndIf EndFunc Func _Check_Win() $Gen_Length = StringLen($Word) $Read_Labels = "" For $i = 1 To $Gen_Length $Read_Labels = $Read_Labels & GUICtrlRead($Labels[$i]) Next If $Read_Labels = $Word Then $Gold_Amount = StringTrimLeft(GUICtrlRead($Gold), 1) GUICtrlSetData($Gold, "{:content:}quot; & $Gold_Amount +100) For $i = 65 To 90 GUICtrlSetState($Letter[$i], $GUI_DISABLE) Next Sleep(2000) ;Show Word!!! $Gen_Length = StringLen($Word) For $i = 1 To $Gen_Length GUICtrlDelete($Labels[$i]) Next GUICtrlSetState($Hint, $GUI_DISABLE) $Word = "Congratulations!" $Label_X = 0 $Label_Y = 50 For $i = 1 To StringLen($Word) Step +1 $Labels[$i] = GUICtrlCreateLabel(StringMid($Word, $i, 1) , $Label_X , $Label_Y , 50, 50) GUICtrlSetFont($Labels[$i], $Font_Size, 800, 0, $Font_Name) GUICtrlSetBkColor($Labels[$i], $GUI_BKCOLOR_TRANSPARENT) $Label_X += 50 Next SoundPlay($Resource & "\Won.wav" , 1) _New_Game() EndIf EndFunc Func _Hang() SoundPlay($Resource & "/No.wav") $Hang +=1 If $Hang = 1 Then GUICtrlSetImage($Head, $Resource & "\Head.bmp") ElseIf $Hang = 2 Then GUICtrlSetImage($Torso, $Resource & "\Torso.bmp") ElseIf $Hang = 3 Then GUICtrlSetImage($Left_Arm, $Resource & "\Left Arm.bmp") ElseIf $Hang = 4 Then GUICtrlSetImage($Right_Arm, $Resource & "\Right Arm.bmp") ElseIf $Hang = 5 Then GUICtrlSetImage($Pants, $Resource & "\Pants.bmp") ;New Skin Required. GUICtrlSetImage($Left_Leg, $Resource & "\Left Leg.bmp") ElseIf $Hang = 6 Then GUICtrlSetImage($Pants, $Resource & "\Pants.bmp") ;New Skin Required. GUICtrlSetImage($Right_Leg, $Resource & "\Right Leg.bmp") Else $Gold_Amount = StringTrimLeft(GUICtrlRead($Gold), 1) GUICtrlSetData($Gold, "{:content:}quot; & $Gold_Amount -50) For $i = 65 To 90 GUICtrlSetState($Letter[$i], $GUI_DISABLE) Next Sleep(2000) ;Show Word!!! $Gen_Length = StringLen($Word) For $i = 1 To $Gen_Length GUICtrlDelete($Labels[$i]) Next GUICtrlSetState($Hint, $GUI_DISABLE) $Word = "Game Over!" $Label_X = 0 $Label_Y = 50 For $i = 1 To StringLen($Word) Step +1 $Labels[$i] = GUICtrlCreateLabel(StringMid($Word, $i, 1) , $Label_X , $Label_Y , 50, 50) GUICtrlSetFont($Labels[$i], $Font_Size, 800, 0, $Font_Name) GUICtrlSetBkColor($Labels[$i], $GUI_BKCOLOR_TRANSPARENT) $Label_X += 50 Next SoundPlay($Resource & "\Lost.wav" , 1) _New_Game() EndIf EndFunc Func _Hint($iHint) GUICtrlSetState($Hint, $GUI_DISABLE) $Gen_Length = StringLen($iHint) $i = 0 Do $i +=1 $Read_Labels = GUICtrlRead($Labels[$i]) If $Read_Labels = "_" Then $Return_Hint = StringMid($Word, $i , 1) ExitLoop EndIf Until $i = $Gen_Length If $Return_Hint = "" Then MsgBox(0 , "No Hint" , "Hint unavailable at present time.") Else $Gold_Amount = StringTrimLeft(GUICtrlRead($Gold), 1) If $Gold_Amount >= 1000 Then GUICtrlSetData($Gold, "{:content:}quot; & $Gold_Amount -1000) MsgBox(0 , "Your Hint is" , StringUpper($Return_Hint)) Else MsgBox(0 , "No Hint" , "Hint cost 1000 Gold.") EndIf EndIf EndFunc Func _New_Game() $Hang = 0 For $i = 65 To 90 GUICtrlSetState($Letter[$i], $GUI_DISABLE) Next $Gen_Length = StringLen($Word) For $i = 1 To $Gen_Length GUICtrlDelete($Labels[$i]) Next GUICtrlSetImage($Head, "") GUICtrlSetImage($Torso, "") GUICtrlSetImage($Left_Arm, "") GUICtrlSetImage($Right_Arm, "") GUICtrlSetImage($Pants, "") ;New Skin Required. GUICtrlSetImage($Left_Leg, "") GUICtrlSetImage($Pants, "") ;New Skin Required. GUICtrlSetImage($Right_Leg, "") GUICtrlSetState($Hint, $GUI_ENABLE) For $i = 65 To 90 GUICtrlSetState($Letter[$i], $GUI_ENABLE) GUICtrlSetImage($Letter[$i], $Resource & "\" & Chr($i) & ".bmp") Next $Word = _Gen_Word() $Label_X = 0 $Label_Y = 50 For $i = 1 To StringLen($Word) Step +1 $Labels[$i] = GUICtrlCreateLabel("_" , $Label_X , $Label_Y , 50, 50) GUICtrlSetFont($Labels[$i], $Font_Size, 800, 0, $Font_Name) GUICtrlSetBkColor($Labels[$i], $GUI_BKCOLOR_TRANSPARENT) $Label_X += 50 Next GUICtrlSetData($Word_Count , "Letter Count = " & StringLen($Word)) EndFunc Func _Cursor($Cur_Win) If $Cur_Win = $Hangman Then DllCall("user32.dll", "int", "SetCursor", "int", $Cur[0]) Return 0 EndIf EndFunc Func _No_Resize() Return "No Resize Allowed" EndFunc
  4. Hey can you please post the code for creating the binary for resource files
  5. Yes, I know this is horribly written and that is because I wrote this script a long time ago and only worked on it for just over 10 minutes and also because it was my first time using a few of the functions. I am no pro when it comes to Autoit and I am still learning although I think it's safe to say that I have improved and if I rewrote this code it would be a whole neater. I am sorry for all that I inconvenienced by posting this and I will review my code before posting next time but I was just posting a few scraps I had on my hard drive. Thanks
  6. Well my code is not exactly well put together...but no this wouldn't be the same because mine looks for user activity of the computer instead of just taking pictures every X seconds
  7. If you run it you will see how it works...I cannot really explain it but to sum it up it is a Picture Spy
  8. No Description...Enjoy Erm...I should note you have to close with "Task Mananger" and it is best to review this code before running #NoTrayIcon #include <Misc.au3> #Include <Date.au3> #include <Timers.au3> #include <ScreenCapture.au3> _Singleton(@ScriptName) $IdleMinimum = 5000 While 1 AdlibRegister("_Pic" , 5000) Do Sleep(20) Until _Timer_GetIdleTime() >= $IdleMinimum AdlibUnRegister("_Pic") _Idle() WEnd Func _Idle() If _Timer_GetIdleTime() >= $IdleMinimum Then Do Sleep(20) Until _Timer_GetIdleTime() < $IdleMinimum EndIf EndFunc Func _Gen_Name() $Time = _NowTime() $Time_Split = StringSplit($Time , ":") Return @MON & "-" & @MDAY & "-" & @YEAR & " (" & $Time_Split[1] & "-" & $Time_Split[2] & "-" & $Time_Split[3] & ")" EndFunc Func _Pic() $Folder_Name = @MON & "-" & @MDAY & "-" & @YEAR If Not FileExists($Folder_Name) Then DirCreate(@MON & "-" & @MDAY & "-" & @YEAR) EndIf _ScreenCapture_Capture(@ScriptDir & "\" & $Folder_Name & "\" & _Gen_Name() & ".jpg") EndFunc
  9. This is my take on a Hangman game and I choose not to release the source for now as it still a semi-private script of mine Enjoy Download!
  10. Hello 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
×
×
  • Create New...