Where are the recorded macros stored in Notepad++? - file

I have recorded a macro that I want to share with my work colleague.
In what location are these recorded macros saved, so that I can add it to his machine?
If interested, the macro is for taking a list of values and adding quotes and comma so that it can be used in the WHERE clause of of an SQL query (WHERE x IN ('value1','value2','value3')).

In Windows the macros are saved at %AppData%\Notepad++\shortcuts.xml
(Windows logo key + E and copy&paste %AppData%\Notepad++\)
Or:
In Windows < 7 (including Win2008/R2) the macros are saved at C:\Documents and
Settings\%username%\Application Data\Notepad++\shortcuts.xml
In Windows 7|8|10
C:\Users\%username%\AppData\Roaming\Notepad++\shortcuts.xml
Note: You will need to close Notepad++ if you have any new macros you want to 'export'.
Here is an example:
<NotepadPlus>
<InternalCommands />
<Macros>
<Macro name="Trim Trailing and save" Ctrl="no" Alt="yes" Shift="yes" Key="83">
<Action type="2" message="0" wParam="42024" lParam="0" sParam="" />
<Action type="2" message="0" wParam="41006" lParam="0" sParam="" />
</Macro>
<Macro name="abc" Ctrl="no" Alt="no" Shift="no" Key="0">
<Action type="1" message="2170" wParam="0" lParam="0" sParam="a" />
<Action type="1" message="2170" wParam="0" lParam="0" sParam="b" />
<Action type="1" message="2170" wParam="0" lParam="0" sParam="c" />
</Macro>
</Macros>
<UserDefinedCommands>....
I added the 'abc' macro as a proof-of-concept.

For Windows 7 macros are stored at C:\Users\Username\AppData\Roaming\Notepad++\shortcuts.xml.

Hit F6
Insert::
npp_open $(PLUGINS_CONFIG_DIR)\..\..\shortcuts.xml
Click OK
You now have the file opened in your editor.
Before altering things checkout the related docs:
Task automation with macros | Notepad++ User Manual
Configuration Files Details | Notepad++ User Manual (section about the <macros> tag)

On Vista with virtualization on, the file is here. Note that the AppData folder is hidden. Either show hidden folders, or go straight to it by typing %AppData% in the address bar of Windows Explorer.
C:\Users\[user]\AppData\Roaming\Notepad++\shortcuts.xml

You can find the shortcuts.xml in AppData\Roaming\Notepad++\ path only when using the default settings. If you have backup configured, you can find and set the path in Preferences -> Backup -> Backup path.
When these settings are applied, files in AppData directory won't be used.

If you install Notepad++ on Linux system by wine (In my case desktop Ubuntu 14.04-LTS_X64) the file "shortcuts.xml" is under :
$/home/[USER-NAME]/.wine/drive_c/users/[USER-NAME]/My Documents/.wine/drive_c/Program Files (x86)/Notepad++/shortcuts.xml
Thanks to Harrison and all that have suggestions for that isssue.

Notepad++ will forget your macros unless you map them to hotkeys via Settings - Shortcut mapper - Macros before exiting Notepad++ (as per https://superuser.com/questions/332481/how-can-i-add-a-macro-in-notepad. Tested with Notepad v6.8.3 on Windows7.)

Go to %appdata%\Notepad++ folder.
The macro definitions are held in shortcuts.xml inside the <Macros> tag. You can copy the whole file, or copy the tag and paste it into shortcuts.xml at the other location.
In the latter case, be sure to use another editor, since N++ overwrites shortcuts.xml on exit.

Related

How to set default opener [duplicate]

How can I set TextMate as default text editor on Mac OS X?
I've tried it with
ln -s /Applications/TextMate.app/Contents/Resources/mate ~/bin/mate
export EDITOR='mate -w'
but that doesn't work.
Just right (or control) click a file of the type you want to change and:
"Get Info" -> "Open with:" -> (Select TextMate) -> "Change All"
The method through Finder is not practical. If you're a developer, your files likely include .profile, .gitconfig, .bashrc, .bash_profile, .htdocs, etc.
The best way to do this is in Bash (for Sublime Text 3):
defaults write com.apple.LaunchServices LSHandlers -array-add '{LSHandlerContentType=public.plain-text;LSHandlerRoleAll=com.sublimetext.3;}'
For other text editors, I assume you can replace 'com.sublimetext.3' with the proper string. You could probably Google for your text editor's name + "LSHandlerContentType=public.plain-text" to figure out what your app's string would be.
For me, this changed the defaults for both Finder, and
$ open ~/.bashrc
Have you modified your shell PATH environment variable to include ~/bin? That directory is usually not included in PATH by default on OS X. It might be simpler to create the symlink in /usr/local/bin which is usually included in PATH. Try:
echo $PATH
This worked for me on OS X v10.11 (El Capitan):
defaults write com.apple.LaunchServices/com.apple.launchservices.secure LSHandlers -array-add \
'{LSHandlerContentType=public.plain-text;LSHandlerRoleAll=com.macromates.textmate.preview;}'
For TextMate 2:
defaults write com.apple.LaunchServices LSHandlers -array-add '{LSHandlerContentType=public.plain-text;LSHandlerRoleAll=com.macromates.TextMate;}'
And you need to restart after that.
To change the default text editor across the board, use the aforementioned method (i.e., "Get Info" → "Open with:" → (editor of choice) → "Change All") on .txt files. Then it will be used as the default editor for any text-based file that doesn't yet have an application preference for its extension.
For instance, if you use the terminal, the command open -t will use your preferred text editor, which is whatever application is associated with .txt files. By default this is (you guessed it) TextEdit, unless you explicitly specify otherwise.
I found Replace Text Edit as the default text editor on apple.stackexchange which works really well.
For developer-type files like .gitignore, use the last option provided:
duti -s com.macromates.TextMate public.data all
Substitute your editor's CFBundleIdentifier as needed. To find it, locate the application file, right-click and choose Show Package Contents, then open Info.plist in the Contents folder. CFBundleIdentifier should be near the top...
This work on Catalina. I'll update my answer if/when I update my OS.

MSBuild add file to primary output

How can i add some custom file created by MSBuild to project output?
i.e. I have blank .csproj, I add Exec task to Target that generates some file.txt and now i want to include this file into "primary output" or "content files".
Thanks,
Marek
Generally, you just need to include the output files you have and then copy them to the output directory.
<CreateItem Include="$(SourcePath)\file.txt">
<Output ItemName="FilesToCopy" TaskParameter="Include" />
</CreateItem>
<Copy SourceFiles="#(FilesToCopy)" DestinationFolder="$(OutDir)" />
There's also a variable $(OutputDirectory) for the immediate project. There are many other properties you may find useful also:
https://msdn.microsoft.com/en-us/library/ms164309.aspx
https://msdn.microsoft.com/en-us/library/ms164313.aspx

Concatenating Files - Including files in folders

I currently have this command:
copy /b *.txt newfile.txt
But I want to include all files with folders as well.
How can I do this? Is it possible to add this to Apache Ant as well?
I also consider doing this to minify JS files.
Im using windows and would like a command to run or batch file but having issues.
Is there anyway to remove lines as well?
Is there a better command to use than the one I am currently using?
UPDATE:
<target name="concatenate" description="Concatenate all js files">
<concat destfile="build/application.js">
<fileset dir="js" includes="*.js" />
</concat>
</target>
<target name="compress" depends="concatenate" description="Compress application.js to application-min.js">
<apply executable="java" parallel="false">
<filelist dir="build" files="application.js" />
<arg line="-jar" />
<arg path="C:\yuicompressor-2.4.7\build\yuicompressor-2.4.7.jar" />
<srcfile />
<arg line="-o" />
<mapper type="glob" from="*.js" to="build/*-min.js" />
<targetfile />
</apply>
Now i am using the above code but cant get it to include files within folders
As oers pointed out in the comment, Ant patterns use ** to recursively match directories. Here is the relevant Patterns section from the Ant manual:
To make things a bit more flexible, we add one extra feature, which makes it possible to match multiple directory levels. This can be used to match a complete directory tree, or a file anywhere in the directory tree. To do this, ** must be used as the name of a directory. When ** is used as the name of a directory in the pattern, it matches zero or more directories. For example: /test/** matches all files/directories under /test/, such as /test/x.java, or /test/foo/bar/xyz.html, but not /xyz.xml.
There is one "shorthand": if a pattern ends with / or \, then ** is appended. For example, mypackage/test/ is interpreted as if it were mypackage/test/**.
The "concatenate" target above would be:
<target name="concatenate" description="Concatenate all js files">
<concat destfile="build/application.js">
<fileset dir="js" includes="**/*.js" excludes="**/*.min.js" />
</concat>
</target>

File diff in MSBuild?

How do I diff two files in MSBuild? I cannot find any specific task to do it.
If possible, is it also possible to exclude certain rows, or patterns in the files eg.
2009-12-09T10:03:07.6888125+02:00
You're gonna have to write your own MSBuild task which wraps some difftool commandline app. For commandline apps, you can inherit from the ToolTask class, which provides quite a bit of command line plumbing.
<Target Name="CheckFileSyncStatus" BeforeTargets="Build" Inputs="#(FilesToSync -> '..\..\..\folder1\folder2\%(Filename)%(Extension)')" Outputs="#(FilesToSync)">
<Exec Command="FC "%(FilesToSync.Filename)%(FilesToSync.Extension)" "..\..\..\folder1\folder2\%(FilesToSync.Filename)%(FilesToSync.Extension)"">
<Output TaskParameter="ExitCode" PropertyName="FCExitCode" />
</Exec>
<Error Text="[HP.OneDriver.Win10S.DriverProperties]:Files out of sync from source: %(FilesToSync.Filename)%(FilesToSync.Extension)" Condition="FCExitCode == 1" />

How do I work with spaces in my wix source path?

wxs file the File tag Source attribute; the path has a space in it.
<File Id="_uploads.UserImport.EDS_UserImport.xls" Name="EDS_UserImport.xls" Source="C:\Documents and Settings\kle\Desktop\OspreyMSIGenerator\OspreyMSIGenerator\Published\EDSContainer\uploads\UserImport\EDS_UserImport.xls"></File>
I get this error
candle.exe : error CNDL0103 : The system cannot find the file 'and' with type 'Source'.
I can't be sure that my paths won't have spaces in it. How do I support spaces in the Source path?
Try upgrading to the latest stable wix release. I tested this with Wix 3.0.5419.0 and file paths with spaces are accepted without errors.
On a related note: File elements should not contain absolute paths like in your example, because you would only be able to build the setup on a single developer's PC. Use paths relative to the location of the wxs file instead, like this:
<File Source="..\bin\foo.exe" />
Or make use of a variable that contains the location of the files like this:
<File Source="$(var.BinFolder)foo.exe" />
You can then pass the location of the bin folder by invoking candle like this:
candle.exe -dBinFolder=c:\someFolder\bin\ foo.wxs
edit: as shown by Rob in his own answer, you can also use the light.exe -b switch to specify one or more base directories where the files to install can be found.
#wcoenen provides one mechanism. However, I prefer to use the light.exe -b switch. Then your code can look like:
<File Id="_uploads.UserImport.EDS_UserImport.xls" Name="EDS_UserImport.xls" Source="SourceDir\Published\EDSContainer\uploads\UserImport\EDS_UserImport.xls"></File>
and your command-line to light.exe would have:
-b "C:\Documents and Settings\kle\Desktop\OspreyMSIGenerator\OspreyMSIGenerator"
You can have multiple -b switches and greatly reduce the complexity of your Source attribute.
Also, the File/#Id and File/#Name can be left off if you are fine with them defaulting to the file name (in this case, "EDS_UserImport.xls").

Resources