Advertisement
TheVideoVolcano

Cursor Hider Script - Toggle ON/OFF

Feb 15th, 2014
777
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 3.20 KB | None | 0 0
  1. #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
  2. #AutoIt3Wrapper_Icon=Visualpharm-Icons8-Metro-Style-Very-Basic-Cursor.ico
  3. #AutoIt3Wrapper_Res_Description=Hides Cursor (CTRL+F5)
  4. #AutoIt3Wrapper_Res_Fileversion=1.0.0.0
  5. ;Copyright RGSOFTWARE
  6. ;RICCARDO FRANCESCO GERACI
  7.  
  8. #AutoIt3Wrapper_Res_LegalCopyright=RGSoftware
  9. #AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator
  10. #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
  11. ;HotKeySet('{Esc}', 'End')
  12. $Hotkey = "CTRL+F5"
  13. HotKeySet("^{F5}", "exe")
  14. #include <TrayConstants.au3>
  15. #include <FileConstants.au3>
  16. #include <File.au3>
  17. #include <misc.au3>
  18.  
  19. Global Const $USER32 = DllOpen("user32.dll")
  20. Global Const $cDir = 'C:\Windows\Cursors' ; Cursor Dir for vista and win7
  21.  
  22. Global Const $Cursor = $cDir & '\blank.cur' ;Cursor that it will change to
  23. Global Const $CursorBack = $cDir & '\aero_arrow.cur'
  24.  
  25. Global $bOn = False
  26. Global $Installed = False
  27. Global $addedToStartup = False
  28.  
  29. checkFileExists()
  30. AddToStartUp()
  31.  
  32. TrayTip("Hide Cursor Tip", "When you want to hide/unhide cursor, just press " & $Hotkey, 5)
  33.  
  34. If _Singleton("Hide Cursor", 1) = 0 Then
  35.     MsgBox(0, "Warning", "You may only run one instance at a time!" & @CRLF & "-Ric")
  36.     Exit
  37. EndIf
  38.  
  39. func GetFilename($psFilename)
  40.     local $szDrive, $szDir, $szFName, $szExt
  41.     _PathSplit($psFilename, $szDrive, $szDir, $szFName, $szExt)
  42.     return $szFName
  43. EndFunc
  44.  
  45. func GetExtension($psFilename)
  46.     local $szDrive, $szDir, $szFName, $szExt
  47.     _PathSplit($psFilename, $szDrive, $szDir, $szFName, $szExt)
  48.     return $szExt
  49. EndFunc
  50.  
  51. Func AddToStartUp()
  52.     If FileExists(@ScriptFullPath) Then
  53.         $fileloc = "C:\Users\" & @UserName & "\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
  54.         If FileExists($fileloc) Then
  55.             FileCopy(@ScriptFullPath, $fileloc & "\" & GetFilename(@ScriptFullPath) & GetExtension(@ScriptFullPath))
  56.             $addedToStartup = True
  57.         EndIf
  58.  
  59.     EndIf
  60. EndFunc   ;==>AddToStartUp
  61.  
  62. Func checkFileExists()
  63.     Local $curfolder = "C:\Windows\Cursors"
  64.     If FileExists($curfolder) then
  65.     If Not FileExists($curfolder & "\blank.cur") Then
  66.         If FileExists(@ScriptDir & "\blank.cur") Then
  67.             FileCopy(@ScriptDir & "\blank.cur", $curfolder & "\blank.cur")
  68.             $Installed = True
  69.         Else
  70.             MsgBox(0, "Cursor Error", "Blank Cursor Cannot Be Located!")
  71.             $Installed = False
  72.             exit
  73.         EndIf
  74.     Else
  75.         $Installed = True
  76.     EndIf
  77. Else
  78.     MsgBox(0,"","Cursors folder cannot be located in " & $curfolder)
  79.     endif
  80. EndFunc   ;==>checkFileExists
  81.  
  82. Func exe()
  83.     $bOn = Not $bOn
  84.     If $bOn And $Installed = True Then
  85.         MouseSetCursor($Cursor) ;Set Cursor
  86.         TrayTip("Cursor Hidden", "You Have Hidden The Cursor. Press " & $Hotkey & " To Unhide", 5)
  87.     Else
  88.         MouseSetCursor($CursorBack)
  89.         TrayTip("Cursor Visible", "Your Cursor Is Visible. Press " & $Hotkey & " To Hide", 5)
  90.     EndIf
  91. EndFunc   ;==>exe
  92.  
  93. While 1
  94.     Sleep(10)
  95. WEnd
  96.  
  97. Func MouseSetCursor($nCursor)
  98.     ;Load
  99.     $cDll = DllCall($USER32, "hwnd", "LoadCursorFromFile", "str", $nCursor)
  100.     If @error <> 0 Then Return
  101.     ;Change
  102.     DllCall($USER32, "int", "SetSystemCursor", "int", $cDll[0], "int", 32512)
  103.     If @error <> 0 Then Return
  104. EndFunc   ;==>MouseSetCursor
  105.  
  106. ;Func End()
  107. ;MouseSetCursor($CursorBack)
  108. ;Exit
  109. ;EndFunc   ;==>End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement