insignia96 Posted June 18, 2009 Share Posted June 18, 2009 (edited) Okay, This is a really simple script i wrote that copies a UDF .au3 file to your autoIt directory's "Include" Folder. The app lets you set which directory to copy to and adds a shell option so that when you right click on any .au3 file there is an option to /Include Script. Once the settings are set, whick you only have to do once, it copies the file. Installation Process! 1. Download my compiled .exe file. (you can compile it yourself also.) 2. Run it, it will detect that it is the first run and allow you to set some options, then it will register the Include option and copy itself to your Windows Directory then exit. 3. Now when you right-click on any .au3 file there should be an option called "Include Script". Click this and it will ask you for your AutoIt Directory. It should be correctly auto detected. If not change it. Now it should be all ready for quick including! NOTE: It will overwrite existing files, so make sure if you have another UDF of the same name to rename the file you wish to copy! NOTE: Pressing Ctrl+Shift+X will reset the first run setting and the AU3 dir setting, so they can be reset if youre autoit dir changes. Thats all for now folks! Source Code: expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=..\..\..\Program Files\AutoIt3\Aut2Exe\Icons\AutoIt_Old1.ico #AutoIt3Wrapper_outfile=Include Script.exe #AutoIt3Wrapper_Res_Comment=Used for including .au3 files to the AutoIt 3 "Include" Directory. #AutoIt3Wrapper_Res_Description=Installs .au3 files #AutoIt3Wrapper_Res_Fileversion=1.1.0.0 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** If HotKeySet( "^+X", "Reset" ) = 0 Then TrayTip( "Reset Hot-Key Unavailible!", "The hot-key Ctrl+Shift+X is in use and could not be registered!", 5000 ) Else HotKeySet( "^+X" ) TrayTip( "Reset Hot-Key!", "The hot-key Ctrl+Shift+X will reset all settings at any time!", 5000 ) HotKeySet( "^+X", "Reset" ) EndIf If NOT @Compiled Then MsgBox( 16, "Not Compiled!", "This script needs to be compiled to work properly!" ) Exit EndIf If RegRead( "HKLM\SOFTWARE\AutoIt v3", "IncludeScriptFirstRun" ) = "" Then RegWrite( "HKLM\SOFTWARE\AutoIt v3", "IncludeScriptFirstRun", "REG_SZ", "1" ) EndIf If RegRead( "HKLM\SOFTWARE\AutoIt v3", "IncludeScriptFirstRun" ) = "1" Then MsgBox( 64, "First Run!", "This is the first time you have run this script!" ) $install = MsgBox( 36, "First Run!", "Would you like to install the shell options?" ) switch $install case 6 _InstallFunctionality() RegWrite( "HKLM\SOFTWARE\AutoIt v3", "IncludeScriptFirstRun", "REG_SZ", "0" ) MsgBox( 64, "All Done!", "The ""Include Script"" option has been added to all .au3 files!" ) MsgBox( 64, "All Done!", "You may delete the runing .exe file. It has been copied to """ & @WindowsDir & """ for simple access." ) Exit Case 7 MsgBox( 48, "Fatal error", "This program will not function properly until functionality is installed!" ) MsgBox( 48, "Fatal error", "Exiting Immediately!" ) RegWrite( "HKLM\SOFTWARE\AutoIt v3", "IncludeScriptFirstRun", "REG_SZ", "1" ) Exit EndSwitch EndIf $au3_exe = @autoItExe $def_dir = RegRead( "HKLM\SOFTWARE\AutoIt v3\AutoIt", "InstallDir" ) If $def_dir = "" Then $def_dir = "C:\Program Files\AutoIt3" EndIf If RegRead( "HKLM\SOFTWARE\AutoIt v3", "IncludeScriptAutoItDir" ) = "" Then $au3_dir = InputBox( "Auto It Directory", "Please enter the path of your AutoIt Directory! (do not include a trailing backslash!)", $def_dir ) RegWrite( "HKLM\SOFTWARE\AutoIt v3", "IncludeScriptAutoItDir", "REG_SZ", $au3_dir ) Else $au3_dir = RegRead( "HKLM\SOFTWARE\AutoIt v3", "IncludeScriptAutoItDir" ) EndIf If $au3_dir = "" Or Not FileExists( $au3_dir ) Then MsgBox( 16, "No Dir Specified!", "The directory was not found or the field was blank. Exiting..." ) Exit EndIf FileCopy( $cmdline[1], $au3_dir & "\Include\" ) Switch MsgBox( 68, "File Copy Sucessful!", "Successfully copied file: "&$cmdline[1]&@CRLF&"to directory: "&$au3_dir & "\Include\"&@CRLF&"Would you like to open the Include directory?" ) Case 6 Run( "explorer " &$au3_dir & "\Include\" ) Exit Case 7 Exit EndSwitch Exit Func _InstallFunctionality() FileCopy( @AutoItExe, @WindowsDir & "\include.exe", 1 ) RegWrite ("HKCR\AutoIt3Script\Shell\Include", "", "REG_SZ", "Include Script") RegWrite ("HKCR\AutoIt3Script\Shell\Include\Command", "", "REG_SZ", "include.exe ""%1""") RegWrite ("HKLM\Software\Classes\AutoIt3Script\Shell\Include", "", "REG_SZ", "Include Script") RegWrite ("HKLM\Software\Classes\AutoIt3Script\Shell\Include\Command", "", "REG_SZ", "include.exe ""%1""") EndFunc Func Reset() RegWrite( "HKLM\SOFTWARE\AutoIt v3", "IncludeScriptFirstRun", "REG_SZ", "1" ) RegDelete( "HKLM\SOFTWARE\AutoIt v3", "IncludeScriptAutoItDir" ) MsgBox( 64, "Settings have been reset", "On next run the app will think it is the first." ) Exit EndFunc Update v1.1: Added: A quick thing I forgot, lets you open the include directory after it copies the file. Edited June 18, 2009 by insignia96 Visit my website to see all my finished releases!Releases here:UDFs:GUI ResizingColor List (Web Colors)GUIFade_NearestPower Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now