AndyS19 Posted April 25, 2020 Posted April 25, 2020 I have saved a session to a .session file on my desktop and when I double click it, it opens a SCiTE session with the actual .session file as the file being edited. I want to open SCiTE, editing the files named in the session file. Is there a file association that I could associate with a .session file?
Developers Jos Posted April 25, 2020 Developers Posted April 25, 2020 (edited) Try this : SciTE "-loadsession:path/project.session" so the shortcut something like: SciTE "-loadsession:%1" Jos Edited April 25, 2020 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
AndyS19 Posted April 25, 2020 Author Posted April 25, 2020 (edited) I need this to be a default file type association. I tried this: Quote assoc .session="C:\Program Files (x86)\AutoIt3\SciTE\scite.exe" "-loadsession:%1" I get this result: Quote assoc | findstr session .session=C:\Program Files (x86)\AutoIt3\SciTE\scite.exe -loadsession:%1 When I double click on the shortcut on my desktop. it opens SCiTE session with the actual .session file as the file being edited. I think I need an 'assoc' MSDOS command with the correct syntax to do what I wanted. Edited April 25, 2020 by AndyS19
TheXman Posted April 25, 2020 Posted April 25, 2020 (edited) 1 hour ago, AndyS19 said: "C:\Program Files (x86)\AutoIt3\SciTE\scite.exe" "-loadsession:%1" The problem with the syntax above is that if the path (%1) contains backslashes (\), they have to be escaped by using double backslashes (\\). For example: scite "-loadession:c:\abc\def\efg.session" would need to be scite "-loadession:c:\\abc\\def\\efg.session" I'm not sure how you would do that in a file association other than running an external script or cmd that does the translation and execution for you. For example, the file association command could be something like: myscript.exe "%1" where myscript.exe takes the path parameter, escapes it and the executes the scite command with the escaped path. Edited April 25, 2020 by TheXman CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman
careca Posted April 25, 2020 Posted April 25, 2020 When i do that in registry files it goes like this example: @="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" \"%1\"" So i assume that if there are quotes and backlashes it'll be fine passing the full path, whatever it may be. 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
TheXman Posted April 25, 2020 Posted April 25, 2020 @careca I think you may have misunderstood the issue. There is no issue with the double quotes. The issue is with backslashes when the %1 value gets resolved. CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman
careca Posted April 25, 2020 Posted April 25, 2020 I see what you mean, but wouldn't that be true only in the case of importing a reg file? It seems the OP is trying to use a cmd, in a cmd window, i didn't think you needed double backlashes on those!? 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
TheXman Posted April 25, 2020 Posted April 25, 2020 (edited) 13 minutes ago, careca said: It seems the OP is trying to use a cmd, in a cmd window, i didn't think you needed double backlashes on those!? No, the OP is trying to create an extension association in the registry that will open .session files in scite. Obviously you haven't run the command to see how it works. I have. Otherwise I wouldn't be offering my advice. Edited April 25, 2020 by TheXman CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman
careca Posted April 25, 2020 Posted April 25, 2020 You're right, i didn't. Thanks for the advice. 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
TheXman Posted April 25, 2020 Posted April 25, 2020 (edited) The following small script will work: Const $SCITE_EXE = "C:\Portable Apps\AutoIt3\SciTe\SciTE.exe" ;<== Change to your location ;If no parameter passed, then exit If $CmdLine[0] = 0 Then Exit ;Load session using escaped parameter $sCmd = StringFormat('"%s" "-loadsession:%s"', $SCITE_EXE, StringReplace($CmdLine[1], "\", "\\")) Run($sCmd) If you compile it and execute it like below, it should work. it works for me. So make the following replacement in your registry command: Replace "C:\Program Files (x86)\AutoIt3\SciTE\scite.exe" "-loadsession:%1" with <compiled script path> "%1" Here's my registry export that implements the association: (I called my script A3OpenSession.exe) Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\AutoIt3Session] [HKEY_CLASSES_ROOT\AutoIt3Session\Shell] @="Open" [HKEY_CLASSES_ROOT\AutoIt3Session\Shell\Open] [HKEY_CLASSES_ROOT\AutoIt3Session\Shell\Open\Command] @="\"C:\\Projects\\Personal\\AutoIt\\Misc\\A3OpenSession.exe\" \"%1\"" [HKEY_CLASSES_ROOT\.session] @="AutoIt3Session" Edited April 25, 2020 by TheXman CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman
AndyS19 Posted April 26, 2020 Author Posted April 26, 2020 I tried setting the file association via MSDOS's ASSOC command, but it didn't work. However, when I right click the .session file and select properties, then click on Change, then browse to the compiled RunSessionFile.exe and select it, then every time I double click on the .session file, it loads the session correctly. However, when I set the file association via MSDOS's ASSOC command, to a bogus file (ASSOC .session="abc.exe"), I still get the session loaded when I double click on the .session file. It looks like the ASSOC setting is ignored.
TheXman Posted April 26, 2020 Posted April 26, 2020 (edited) 1 hour ago, AndyS19 said: assoc .session="C:\Program Files (x86)\AutoIt3\SciTE\scite.exe" "-loadsession:%1" It looks like the ASSOC setting is ignored. Your ASSOC command is not correct. The ASSOC command should point to the FTYPE. The FTYPE should define the command. Example: ASSOC .session=AutoIt3Session FTYPE Autoit3session="C:\Portable Apps\AutoIt3\AutoIt3_x64.exe" "C:\Projects\Personal\AutoIt\Misc\A3OpenSession.au3" "%1" Those are the 2 CMD console commands to do the association at the command prompt. That should give you basically the same registry entries as I posted above. NOTE: I am executing the au3 script instead of the exe, but the concept is the same. Edited April 26, 2020 by TheXman CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman
Developers Jos Posted April 26, 2020 Developers Posted April 26, 2020 Just had some time to test and this solution is working fine for me: ; Script to open Scite.Session files with a double click ; 1. Store this script in: "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\OpenSession.au3" ; 2. Open Regedit and assosicate the Open action for ".session" with this definition: ; "C:\Program Files (x86)\AutoIt3\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\OpenSession.au3" "%1" Global $Sessionfile = "" If $CmdLine[0] > 0 Then $Sessionfile = StringReplace($cmdline[1], "\", "\\") Run(@ScriptDir & '\..\SciTE.exe "-loadsession:' & $Sessionfile & '"') Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
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