Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] [+Matrix1Utils] Basic Make and Open Scripts in Notepad++

Author
Message
MonoCoder
18
Years of Service
User Offline
Joined: 4th Dec 2005
Location: england
Posted: 23rd Jun 2009 20:32 Edited at: 23rd Jun 2009 23:52
Use this to open files in Notepad++. I'm using this to edit LUA scripts, but you can edit it for any sort of file, and any program. If the target folder doesn't exist, it will create it and every missing parent folder up to it. It will then create the script files if they don't yet exist and open Notepad++ to edit them. These command line arguments can be passed.

Useful for quickly hopping out of your editor program to edit an object's script or properties.
Parameters
patha - The left part of the path whose folders should all exist. (ie. "C:\Users\Your Name\Documents\Scripts")
pathb - The right part of the path whose folders may or may not exist.
cl - the command line arguments to pass.
file - the name of the file(s) to make/open. Seperate them with a single space.
w - sets the wait flag in execute file.

notes: As filenames contain the absolute path of the file (because Notepad++'s root isn't the same as the program's root), you probably won't be able to open more than two at a time. In most cases though, one should be fine. (this is assuming there's some sort of limit on the length of the command line string, like 255 characters - correct me if I'm wrong).
To specify the current folder as the root, pass ".\" as patha.
As filenames are seperated with spaces, make sure the file paths don't have spaces inside them.
You'll obviously need Notepad++ otherwise the files will be created but not opened.

Example Here is a .zip containing the program and the dll's you'll need. Extract and run and it will create two files inside two folders. Note - I left some debug bits in the attached program by mistake - just press a key to step it through.



Uncommented version


Any queries, tell.
edit: damn thing keeps nicking my backslashes. >_>

Login to post a reply

Server time is: 2024-11-22 02:04:46
Your offset time is: 2024-11-22 02:04:46