careca Posted August 20, 2018 Share Posted August 20, 2018 (edited) Many times i copied to clipboard some code to test and i had to create a new au3 file, open it and paste the code in, with this script that's automatic. #include <FileConstants.au3> $NewAu3Path = @DesktopDir & '\NewAu3' & '.' & @HOUR & '.' & @MIN & '.' & @SEC & '.au3' $NewAu3 = FileOpen($NewAu3Path, 2) FileWrite($NewAu3, ClipGet()) FileClose($NewAu3) Added current time to ensure the file has unique filename. Edited August 20, 2018 by careca coffeeturtle and Xandy 2 Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
BrewManNH Posted August 20, 2018 Share Posted August 20, 2018 I wouldn't open it in Append mode, otherwise your "new script" will get written to the end of whatever is in that file already. Also, you could probably do a ShellExecute on your new script to open it in SciTE. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted August 20, 2018 Moderators Share Posted August 20, 2018 Just a suggestion; this might do better under the "Snippets" thread - it is the very definition of "short, reusable pieces of code" "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Simpel Posted August 20, 2018 Share Posted August 20, 2018 (edited) Hi. This is my version. It starts with a hotkey in another tool I always have running: #include <File.au3> ; define your pathes Local $sDestinationPath = @DesktopDir Local $sPathSciTE = ; FILL IN YOUR PATH HERE ; find the last test file Local $aTestFiles = _FileListToArray($sDestinationPath, "test*.au3", $FLTA_FILES) ; search existing test*.au3 Local $sTestFiles = _ArrayToString($aTestFiles) ; make a string of it $aTestFiles = StringRegExp($sTestFiles, "(?i)test(\d+)\.au3", $STR_REGEXPARRAYGLOBALMATCH) ; search all test*-files with digits between test and extension au3 For $i = 0 To UBound($aTestFiles) -1 $aTestFiles[$i] = Number($aTestFiles[$i]) ; make them all to numbers Next _ArraySort($aTestFiles) ; sort them Local $iLastNumber = $aTestFiles[UBound($aTestFiles) - 1] ; that is the highest number ; create the next test file Local $sNewFile = $sDestinationPath & "\test" & $iLastNumber + 1 & ".au3" ; adding 1 to the last file Local $File = FileOpen($sNewFile, $FO_OVERWRITE) ; open the file in overwrite mode FileWrite($File, ClipGet()) ; put the clipboard inside FileClose($File) ; close the file ; open the test file in SciTE If Not WinExists("[CLASS:SciTEWindow]") Then ShellExecute($sPathSciTE) ; so all last opened tabs are opened too While Not WinExists("[CLASS:SciTEWindow]") Sleep(100) WEnd RunWait('"' & $sPathSciTE & '" "' & $sNewFile & '"', $sDestinationPath, @SW_HIDE) My test.au3 files are counted. This way I get the next file. And as @BrewManNH said it is opening SciTE directly. Simpel Edited August 20, 2018 by Simpel code edited for "open test file" masvil 1 SciTE4AutoIt = 3.7.3.0 AutoIt = 3.3.14.2 AutoItX64 = 0 OS = Win_10 Build = 19044 OSArch = X64 Language = 0407/german H:\...\AutoIt3\SciTE H:\...\AutoIt3 H:\...\AutoIt3\Include (H:\ = Network Drive) Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. Link to comment Share on other sites More sharing options...
careca Posted August 20, 2018 Author Share Posted August 20, 2018 Thanks for input, i thought about snippets, but somehow it felt better here, but feel free to move it @JLogan3o13 @BrewManNH, yes, makes sense, now i added the current time in the filename to make it unique, thus not overwriting or appending anything, each file is unique in theory. Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
Simpel Posted August 25, 2018 Share Posted August 25, 2018 Hi, I added another feature. If there are testX.au3 files (X is are digits) that is empty it will use this one: #include <File.au3> ; define your pathes Local $sDestinationPath = ; your path where these test files should be Local $sPathSciTE = ; your path to SciTE ; find the last test file Local $aTestFiles = _FileListToArray($sDestinationPath, "test*.au3", $FLTA_FILES) ; search existing test*.au3 Local $sTestFiles = _ArrayToString($aTestFiles) ; make a string of it $aTestFiles = StringRegExp($sTestFiles, "(?i)test(\d+)\.au3", $STR_REGEXPARRAYGLOBALMATCH) ; search all test*-files with digits between test and extension au3 For $i = 0 To UBound($aTestFiles) -1 $aTestFiles[$i] = Number($aTestFiles[$i]) ; make them all to numbers Next _ArraySort($aTestFiles) ; sort them ; find first empty file or get the last number + 1 Local $iNextNumber For $i = 0 To UBound($aTestFiles) -1 If FileGetSize($sDestinationPath & "\test" & $aTestFiles[$i] & ".au3") = 0 Then $iNextNumber = $aTestFiles[$i] ExitLoop EndIf Next If Not IsNumber($iNextNumber) Then $iNextNumber = $aTestFiles[UBound($aTestFiles) -1] + 1 ; that is the highest number + 1 ; create the next test file Local $sNewFile = $sDestinationPath & "\test" & $iNextNumber & ".au3" Local $File = FileOpen($sNewFile, $FO_OVERWRITE) ; open the file in overwrite mode FileWrite($File, ClipGet()) ; put the clipboard inside FileClose($File) ; close the file ; open the test file in SciTE If Not WinExists("[CLASS:SciTEWindow]") Then ShellExecute($sPathSciTE) ; that's for re-opening current opened files too before While Not WinExists("[CLASS:SciTEWindow]") Sleep(100) WEnd RunWait('"' & $sPathSciTE & '" "' & $sNewFile & '"', $sDestinationPath, @SW_HIDE) ; now open that file Simpel masvil and careca 2 SciTE4AutoIt = 3.7.3.0 AutoIt = 3.3.14.2 AutoItX64 = 0 OS = Win_10 Build = 19044 OSArch = X64 Language = 0407/german H:\...\AutoIt3\SciTE H:\...\AutoIt3 H:\...\AutoIt3\Include (H:\ = Network Drive) Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. Link to comment Share on other sites More sharing options...
Danyfirex Posted August 25, 2018 Share Posted August 25, 2018 Hello. Proably you could also add a hotkey and detect topic name etc to organize all better. Maybe You can get interested in this. Probably I'll develop a firefox version too. Saludos careca, kcvinu and Simpel 3 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
kcvinu Posted August 26, 2018 Share Posted August 26, 2018 (edited) Well, that's a very helpful program from the great talented programmer Danyfirex. Thanks a lot man. Its actually a blend of JavaScript & AutoIt. Superb ! Edited August 26, 2018 by kcvinu Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only) Link to comment Share on other sites More sharing options...
Simpel Posted September 1, 2018 Share Posted September 1, 2018 Just another small update: #include <File.au3> ; define your pathes Local $sDestinationPath = ; your path where these test files should be Local $sPathSciTE = ; your path to SciTE ; find the last test file Local $aTestFiles = _FileListToArray($sDestinationPath, "test*.au3", $FLTA_FILES) ; search existing test*.au3 Local $sTestFiles = _ArrayToString($aTestFiles) ; make a string of it $aTestFiles = StringRegExp($sTestFiles, "(?i)test(\d+)\.au3", $STR_REGEXPARRAYGLOBALMATCH) ; search all test*-files with digits between test and extension au3 For $i = 0 To UBound($aTestFiles) -1 $aTestFiles[$i] = Number($aTestFiles[$i]) ; make them all to numbers Next _ArraySort($aTestFiles) ; sort them ; find first empty file or get the last number + 1 Local $iNextNumber For $i = 0 To UBound($aTestFiles) -1 If FileGetSize($sDestinationPath & "\test" & $aTestFiles[$i] & ".au3") = 0 Then $iNextNumber = $aTestFiles[$i] ExitLoop EndIf Next If Not IsNumber($iNextNumber) Then $iNextNumber = $aTestFiles[UBound($aTestFiles) -1] + 1 ; that is the highest number + 1 ; create the next test file Local $sNewFile = $sDestinationPath & "\test" & $iNextNumber & ".au3" Local $File = FileOpen($sNewFile, $FO_OVERWRITE) ; open the file in overwrite mode Local $sCheck = "#AutoIt3Wrapper_AU3Check_Parameters=;-q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7" ; commenting out all predefined checks inside ini FileWrite($File, $sCheck & @CRLF & @CRLF & ClipGet()) ; put the clipboard inside FileClose($File) ; close the file ; open the test file in SciTE If Not WinExists("[CLASS:SciTEWindow]") Then ShellExecute($sPathSciTE) ; that's for re-opening current opened files too before While Not WinExists("[CLASS:SciTEWindow]") Sleep(100) WEnd RunWait('"' & $sPathSciTE & '" "' & $sNewFile & '"', $sDestinationPath, @SW_HIDE) ; now open that file If you have defined AU3Check_Parameter in AutoIt3Wrapper.ini then often you are confronted with a lot of AU3Check error messages (e.g. "variable not declared"). But often I only want to test the script and maybe adopt it later. So here I insert "#AutoIt3Wrapper_AU3Check_Parameters=;-q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7" on top of the new file (look for the semicolon in the string). So no error messages of these types are fired. For further development delete the ";" inside that string or delete the whole line to go back to your own settings. Simpel SciTE4AutoIt = 3.7.3.0 AutoIt = 3.3.14.2 AutoItX64 = 0 OS = Win_10 Build = 19044 OSArch = X64 Language = 0407/german H:\...\AutoIt3\SciTE H:\...\AutoIt3 H:\...\AutoIt3\Include (H:\ = Network Drive) Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. Link to comment Share on other sites More sharing options...
Simpel Posted September 14, 2018 Share Posted September 14, 2018 @Danyfirex, I tried your chrome extension and it worked like charme. I modified the AutoItCodeRunner this way: expandcollapse popup#include <String.au3> #include <File.au3> ; define your pathes Local $sDestinationPath = ; where do you want putted the files to - no trailing \ Local $sPathSciTE = ; path to SciTE Local $sFileName = "CCR_" ; ChromeCodeRunner Local $aFilename = _StringBetween(ClipGet(), ";Title: ", " - AutoIt ") If IsArray($aFilename) Then $sFileName &= StringRegExpReplace($aFilename[0], '[ /:*?"<>|]', '_') ConsoleWrite($sFileName & @CRLF) Else ; find the last test file Local $aTestFiles = _FileListToArray($sDestinationPath, "test*.au3", $FLTA_FILES) ; search existing test*.au3 Local $sTestFiles = _ArrayToString($aTestFiles) ; make a string of it $aTestFiles = StringRegExp($sTestFiles, "(?i)test(\d+)\.au3", $STR_REGEXPARRAYGLOBALMATCH) ; search all test*-files with digits between test and extension au3 For $i = 0 To UBound($aTestFiles) -1 $aTestFiles[$i] = Number($aTestFiles[$i]) ; make them all to numbers Next _ArraySort($aTestFiles) ; sort them ; find first empty file or get the last number + 1 Local $iNextNumber For $i = 0 To UBound($aTestFiles) -1 If FileGetSize($sDestinationPath & "\test" & $aTestFiles[$i] & ".au3") = 0 Then $iNextNumber = $aTestFiles[$i] ExitLoop EndIf Next If Not IsNumber($iNextNumber) Then $iNextNumber = $aTestFiles[UBound($aTestFiles) -1] + 1 ; that is the highest number + 1 $sFileName &= "test" & $iNextNumber ConsoleWrite($sFileName & @CRLF) EndIf ; create the file Local $sNewFile = $sDestinationPath & "\" & $sFileName & ".au3" Local $File = FileOpen($sNewFile, $FO_OVERWRITE) ; open the file in overwrite mode Local $sCheck = "#AutoIt3Wrapper_AU3Check_Parameters=;-q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7" ; for all those cases variables are not declared etc. FileWrite($File, $sCheck & @CRLF & @CRLF & ClipGet()) ; put the clipboard inside FileClose($File) ; close the file ; open the file in SciTE If Not WinExists("[CLASS:SciTEWindow]") Then ShellExecute($sPathSciTE) ; that's for re-opening current opened files too before While Not WinExists("[CLASS:SciTEWindow]") Sleep(100) WEnd RunWait('"' & $sPathSciTE & '" "' & $sNewFile & '"', $sDestinationPath, @SW_HIDE) ; now open that file Regards, Simpel Danyfirex 1 SciTE4AutoIt = 3.7.3.0 AutoIt = 3.3.14.2 AutoItX64 = 0 OS = Win_10 Build = 19044 OSArch = X64 Language = 0407/german H:\...\AutoIt3\SciTE H:\...\AutoIt3 H:\...\AutoIt3\Include (H:\ = Network Drive) Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 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