How to create a user-defined language in Notepad++ based on an existing language? - syntax-highlighting

I frequently work with files that have an extension of .ebs. This is a language based on vbscript with a number of new keywords.
Currently I set notepad++ to just use the built-in vb highlighting for files with extension .vbs. Works ok, but the custom keywords do not get highlighted.
I would like to create a user-defined language for the .ebs files but base it off of the built-in vb language.
Is this possible? I searched but the built-in languages do not have an associated .xml file to copy and change.

All highlights are situated in \langs.model.xml and \stylers.model.xml.
Copy the one xml you want to base on and edit it the way you like.

The previous answers are correct and very helpful. Here is a slight update.
In Notepad++ 6.6.9 the xml files are called "stylers.xml" and "langs.xml" and are located in C:\Users\MyUserName\AppData\Roaming\Notepad++ (at least on Windows 7 computer).

Related

Replace text by focus on enable code by ifdef

Does it exist any way to replace only text that is enabled by C preprocessor macro like #if/#ifdef in Visual Studio?
If you're asking whether such a capability is built in, the answer is "no."
If you're asking whether it's possible to create a way to do it, then depending on how hard you're willing to work, the answer is "maybe." Obviously the editor knows what code is enabled by the preprocessor in a source file, because a scanner runs on it, using the current project settings to find out which preprocessor symbols are defined. That information is used by a colorizer to color the source file. The standard search and replace function, however, ignores that information (and anything else that's not the base text). If you want to badly enough, you can use the Visual Studio SDK to write an extension that implements your own search and replace function, and have it use the scanner output (or possibly, the collection of text adornments created by the colorizer) to guide which parts of the source file to do the search and replace in. That would be a lot of work, probably a lot more than any manual search and replace process. On the other hand, maybe you could sell the resulting extension in the VS Gallery.
The easiest way to do what you want is to do the search and replace with the existing tool, one search at a time (F3 is your friend here), and to make the change only if the text is the "enabled" color.

Editing Info.plist of Xcode project using AppleScript?

How can I edit info.plist file of xcode project? I have tried searching a lot but nothing specific.
An info.plist file can be considered 2 ways. One, it's just a specially formatted text file so thinking that way you can manipulate the text directly. Applescript can read text files, manipulate text, and write text files. Two, it's a basic xml file formatted with apple's tags to create a "plist" file. So you could use xml tools on the file as well. System Events has xml tools. There's also a unix command line program called "defaults" that can work on them as well.
So there's several tools. You need to think about what you want to do, how complicated the task is, and then decide which tool will best fit your requirements.
After you figure out those basics, try some things and come back and ask specific questions.

How to variables from a textfile into a C# script

I need to create a text file for a game designer to edit variables in my C# script. I would like to be able to write the variable in the text file and the designer can put in a value and hten it would change in my script.
However, after much searching I have not been able to find a solution to my problem and was hoping someone with some experience in this method could help me.
I'm using Visual Studio for writing my scripts and the designer would require Notepad.
Thanks,
Chris
You can try using this class that will allow you to use ini files to hold your configuration.
I'm assuming your designer wouldn't like to use XML (which is the .NETy way of doing things); making humans edit XML is a form of torture anyway.
Here's the link to the CodeProject page: An INI file handling class using C#.
You can also use some other (relatively simple) format like JSON if ini files are too flat for you.

Visual Studio Solution -- Any way to create a "special" folder?

Basically, I want one of my folders to appear above the other folders as a type of "special folder", similar to how Properties has it's own special place even though it's a folder, same with App_Data, etc.
Is this possible?
By default, Visual Studio doesn't support adding special project folders. The Properties folder is hard-coded to behave the way that it does.
However, anything is possible with code. You could build an extension to do this, but it wouldn't be simple. You'd probably need to mess around with the IVsHierarchy or even implement a project subtype.
Basically, I want one of my folders to
appear above the other folders as a
type of "special folder", similar to
how Properties has it's own special
place even though it's a folder, same
with App_Data, etc.
Is this possible?
Yes:
Do it manually through the IDE
Write your own script to
generate/modify your *.sln/*.vcproj
For (1) "manual" on solutions in the IDE: Solution Explorer, right-click on Solution node==>Add==>New Solution Folder.
While typically the folders are sorted alphabetically (I'd insert a leading underscore to force your special folder to the top), solution folders inserted manually on my MSVS2008 leave the new folder "at the top", even though it should have bumped down when alphabetically sorted. However, folders under a Project (which are called "Filters") are always sorted alphabetically, and added similarly from the right-click, and then you can modify their "filter properties" with file name globs for what you want in there (e.g., add a filter glob for "*.MY_EXTENSION1;*.MY_EXTENSION2").
We chose (2), and we generate our own *.sln and *.vcproj, adding our own folders/filters. I've not seen any utilities on the web to help with that (so we had to write our own). The formats are not too hard to reverse engineer, but it's largely undocumented XML, so you have to experiment. There are only a couple good web articles explaining what's in the file, like this one:
http://tim.oreilly.com/pub/a/dotnet/excerpt/vshacks_chap1/index.html?page=4
On the "bright side", the files are only XML, so in developing our scripts we merely made changes through the IDE, saved, and compared the "diffs" for what change we want. Those changes are what our scripts insert when we modify our files. So, if you modify the file manually, you can similarly just "diff" the file to see what changed, and make your own script. (IMHO, this is the fastest and easiest route, since tools generally do not exist to manipulate these files.)
Tools like CMake and QMake generate *.vcproj/*.sln, but don't really do the folder customization thing like you're talking. However, we look at their output too, because, "there's more than one way to do things" in these files, and the files seem to have many undocumented features for doing different clever things that somehow these tools have "discovered" (so you can try to copy their generated output).
We found the .NET APIs to work with these files as too much work, and not really designed for that type of manipulation, but YMMV.
VS 2012 has a feature that I just found, and it solved this problem for me. It may not be new to VS.
Create a folder under the project with a leading "_" (to get it sorted first).
On the folder's properties set "Namespace Provider" to false.
VS (or ReSharper?) code analysis then does not complain that "the namespace does not match file location", which was the source of irritation for me that would otherwise have kept me from going this route.
Although there is no easy way to add Custom Folder, there is an easy way to "steal" Properties custom folder.
Add a regular folder to the project. For example MyCustomerFolder.
Open proj file xml. Find line
<AppDesignerFolder>Properties</AppDesignerFolder>
replace with
<AppDesignerFolder>MyCustomFolder</AppDesignerFolder>
Reload the project.
Now you've got a custom folder, that will always stick to the top.

How to search Jar files using Windows Search?

I believe back when we were on Win2K, Windows Search would search through Jar files to locate specific classes but this doesn't appear to work in XP. Does anyone know how to enable this in XP?
Note, to do the search in Win2K we just entered *.jar for the files and "ClassABC" for the search text string and the search would return any jar files containing class files where the title contained "ClassABC".
Add this to a text file, save file, change the extension to .reg, double click to add to registry and you should be ok...you can search on file name or content and it should show jars that have class names
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.jar\PersistentHandler]
#="{5e941d80-bf96-11cd-b579-08002b30bfeb}"
The only thing left is to logout and log back into windows and it should work fine for you, see http://support.microsoft.com/kb/309173 for more details
I would also recommend total commander. It is a great file management tool with great search functionality which can easily look inside jar files.
If it was removed it was likely due to the Sun-Microsoft Java dispute that was going on around the time XP was developed. It's unlikely to have a way of re-enabling it.
You might find this helpful instead: http://jarbrowser.sourceforge.net/
Just use FindClassInJars util, it's a simple swing program, but useful.
You can check source code or download jar file at http://code.google.com/p/find-class-in-jars/
I made another version of FindClassInJars here. It is the same look but searches a little better and smarter. Click the "Raw button here:
https://github.com/Oxvalley/FindClassInJars/blob/master/lib/findclassinjars-2.0.0.jar
According to this MSDN Channel 9 article, adding an appropriate IFilter will do it. Since .jar files are the same as .zip files, one of the four ZIP file IFilters they list might work (unless they are all extension-based).
From Brenden Anstey's Blog:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.jar]
"Content Type"="application/x-zip-compressed"
"PerceivedType"="compressed"
#="CompressedFolder"
[HKEY_CLASSES_ROOT\.jar\CompressedFolder]
[HKEY_CLASSES_ROOT\.jar\CompressedFolder\ShellNew]
"Data"=hex:50,4b,05,06,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
[HKEY_CLASSES_ROOT\.jar\OpenWithProgids]
"CompressedFolder"=""
[HKEY_CLASSES_ROOT\.jar\PersistentHandler]
#="{098f2470-bae0-11cd-b579-08002b30bfeb}"
[HKEY_CLASSES_ROOT\.war]
"Content Type"="application/x-zip-compressed"
"PerceivedType"="compressed"
#="CompressedFolder"
[HKEY_CLASSES_ROOT\.war\CompressedFolder]
[HKEY_CLASSES_ROOT\.war\CompressedFolder\ShellNew]
"Data"=hex:50,4b,05,06,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
[HKEY_CLASSES_ROOT\.war\OpenWithProgids]
"CompressedFolder"=""
[HKEY_CLASSES_ROOT\.war\PersistentHandler]
#="{098f2470-bae0-11cd-b579-08002b30bfeb}"
[HKEY_CLASSES_ROOT\.ear]
"Content Type"="application/x-zip-compressed"
"PerceivedType"="compressed"
#="CompressedFolder"
[HKEY_CLASSES_ROOT\.ear\CompressedFolder]
[HKEY_CLASSES_ROOT\.ear\CompressedFolder\ShellNew]
"Data"=hex:50,4b,05,06,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
[HKEY_CLASSES_ROOT\.ear\OpenWithProgids]
"CompressedFolder"=""
[HKEY_CLASSES_ROOT\.ear\PersistentHandler]
#="{098f2470-bae0-11cd-b579-08002b30bfeb}"
I know that it's not Windows Search, but I have long used Agent Ransack for this: it is very quick and searches through all the various java archive formats (jar, war, ear) as well as zip.
A feature that I particularly like and use a lot is saving a search: you can save the criteria (so that you can repeat that search easily) or the results.. So when I am working on a project, I will often want to search through the project directory tree for a file (or a file within a jar/zip). I perform the search once and save the criteria as a .srf file, which I can open quickly to perform similar searches afterwards.
As suggested by #iubing, the FindClassInJars code works fairly well, but the author must have botched the packaging.
I've forked the FindClassInJars util from google code, you can get a built copy here that works. Just click the "raw" button.
a while back I developed this: https://github.com/javalite/jar-explorer just for the occasion. works even on windows :)

Resources