Inpho Posted January 9, 2020 Share Posted January 9, 2020 (edited) Updated: ClipToScript is my attempt at saving some finger effort. I often copy a bunch of code to the clipboard, right click desktop, click New -> AutoIt v3 Script, Ctrl+A to select template text, then finally paste. Now, I can right-click anywhere and just select "ClipToScript" and will invoke the script below to present me with a SciTE window with your code pasted in. Old: Hi All, Guinness made some fantastic functions which I'm using to modify my Windows context menus. But I've come across an issue which I can't solve myself. The functions: _ShellFile _ShellFolder _ShellAll Give the ability to add an item to the right-click menu when selecting a file or folder. What I want is to add options to the context menu displayed when nothing is selected (e.g. you want to make a New Folder in the current directory so you don't select a file or folder - see image below). This would allow me to have a context menu item called "Clip To Script" which creates a new .au3 file in the current directory, executes (edits) it, then pastes the current contents of the clipboard into SciTE. Can anyone point me towards some clues on adding items to the Windows context menu when neither a file or folder is selected please? Edited January 9, 2020 by Inpho Link to comment Share on other sites More sharing options...
KaFu Posted January 9, 2020 Share Posted January 9, 2020 This Reg-Key works for me (in Explorer and on Desktop): [HKEY_CLASSES_ROOT\Directory\Background\shell\Open Notepad\command] @="notepad.exe" Inpho 1 OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Inpho Posted January 9, 2020 Author Share Posted January 9, 2020 @KaFu Thankyou so much; another few clicks saved. #include <WinAPIFiles.au3> #include <WinAPIHObj.au3> If UBound($CmdLine) < 1 Then $sError = "" For $i = 1 To UBound($CmdLine) - 1 If $CmdLine[$i] = "" Then $sError &= "NONE" & @CRLF Else $sError &= $CmdLine[$i] & @CRLF EndIf Next _Error("This script requires a total of 1 parameters; the params you supplied:" & @CRLF & @CRLF & $sError) EndIf Func _Error($sMsg) ;ConsoleWrite($sMsg & @CRLF) MsgBox(0, "", $sMsg) Exit 1 EndFunc $sRandom = String(Random(11111, 99999, 1)) $sFile = "New script_" & $sRandom & ".au3" $hFile = _WinAPI_CreateFile($sFile, 0, 4, 0) _WinAPI_CloseHandle($hFile) FileWrite($sFile, ClipGet()) ShellExecute($sFile) Will post this "ClipToScript" in my examples/libraries at some point 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