Use "Encoding > Convert to ..." as a macro in Notepad++ - encoding

I tried to record the action of Encoding > Convert to ANSI and save it as a macro so that I can copy and add the its code to another macro.
This is the recorded code:
<Macro name="convert to ANSI" Ctrl="no" Alt="no" Shift="no" Key="0">
<Action type="0" message="2004" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2179" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2025" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2422" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2325" wParam="0" lParam="0" sParam="" />
</Macro>
If I run it in a file, the output is the code itself (or a few lines from another macro saved in shortcuts.xml), just overwrites the original contents of the file.
Anybody knows how to fix it?

If you are comfortable using the NppExec plugin available from the PluginManager, then you could use this simple NppExec Script:
NPP_MENUCOMMAND Encoding/Convert to ANSI
Just use Plugins -> NppExec -> Execute... , enter the script, either hit OK or save it for later reuse. (The script is saved in the file npes_saved.txt . You find this file in the plugins\Config subdirectory either in your users Notepad++ path or in the installation directory of Notepad++).
Create a keyboard shortcut for the script
You can save the script with the Save... button in the dialog: .
Once the script has a name, you can go to the Plugins -> NppExec -> Advanced Options Dialog and associate the script name with an Item name and add the Item name to the menu, see the lower left part in this picture. .
Restart Notepad++
Now you find the Item name in the Settings -> Shortcut Mapper... Dialog somewhere on the plugins panel. Here you can connect the script with a keyboard shortcut for easy access.

Related

Notepad++ | Show macro script

Is it possible to show the script of a macro to learn what it actually does?
Where are the macros stored so I can inspect the files, maybe they are human readable.
Once macro is saved, and Notepad++ is closed, macro will be saved to:
%USERPROFILE%\AppData\Roaming\Notepad++\shortcuts.xml
(c:\Users\%your user%\AppData\Roaming\Notepad++\shortcuts.xml)
Into <Macros> tag. It's sort of human readable: as each step is an <Action> tag, so steps could be deleted/copy-pasted, but to create a new steps it's much easier to record a new macro.
The default path of shortcuts.xml is C:\Users\%YOUR USERNAME%\AppData\Roaming\Notepad++ Here’s an simple RegEx replacement example of some of mine:
<Macro name="SO-Test" Ctrl="yes" Alt="no" Shift="yes" Key="112">
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="(.+)" />
<Action type="3" message="1625" wParam="0" lParam="2" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\1 \1" />
<Action type="3" message="1702" wParam="0" lParam="768" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
</Macro>
There are 2 locations that the shortcuts.xml file resides in. Notepad++ could be using either one, depending on how it was installed. Try the C:\Program Files\Notepad++ folder or C:\Program Files (x86)\Notepad++ folder.
Depending on whether you installed the 32bit or 64bit Notepad++ program it could be in either of the 2 Program Files folders (you can only install 64bit version if Windows is also 64bit).

Controlling the sequence of events in a Wixtoolset (.msi) installer

I am creating a Microsoft Installer (.msi file) using the Wixtoolset (Windows Installer XML). This installer must automate the installation of an existing .exe program (named installer.exe below) and copy a custom configuration file (named settings.conf below) to the target directory. In addition the installer must modify the configuration file using the InstallFiles command below. But the timing of events is critical. If the executable installer runs too early, it fails or exhibits strange behavior. And if the executable installer run too late in the install sequence, it overwrites my modified configuration file with the generic values. I believe this can be done by assigning a string to the Before or After property value. What Before or After property assignment will allow the executable to run properly but not overwrite the configuration file I moved by the CopyFile element? Here is my Wixtoolset XML code.
<Property Id="CONFIGFOLDER" Value="C:\acme\config" >
<Feature
Id="ConfigurationFile"
Title="Configuration File"
Level="1"
<ComponentRef Id="CMP_ACME_Config_File" />
</Feature>
<DirectoryRef Id="TARGETDIR">
<Component Id="CMP_ACME_Config_File" Guid="">
<File
Id="ACME_Config"
Source="MySettings.conf"
KeyPath="yes"
<CopyFile Id="Copy_ACME_Config"
DestinationProperty="CONFIGFOLDER"
DestinationName="settings.conf" />
</File>
</Component>
</DirectoryRef>
<Binary
Id="InstallerEXE"
SourceFile="installer.exe" />
<CustomAction
Id="Launch_Installer"
BinaryKey="InstallerEXE"
Impersonate="yes"
Execute="deferred"
ExeCommand=""
Return="check" />
<InstallExecuteSequence>
<Custom Action="Launch_Installer"
Before="InstallFiles">
</Custom>
</InstallExecuteSequence>
</Property>
I can't explain exactly why this works but assigning "InstallFiles" to the "After" property in the "Custom" element seems to do the trick.
<InstallExecuteSequence>
<Custom Action="Launch_Installer"
After="InstallFiles">
</Custom>
</InstallExecuteSequence>

WiX Bootstrapper: How do I set burn variables from the command line?

Using WiX 3.7 and .NET 4.0.
How does one set burn variables when running a WiX bootstrapper EXE from the command line?
First of all, the burn variables that you wish to set need to be set as Overridable. To do this you must include the follow namespace in your WXS: xmlns:bal="http://schemas.microsoft.com/wix/BalExtension" and if you're using Visual Studio like me you need to include WixBalExtension.dll in your project references. Next you need to add the following attribute to all of the burn variables that you want to set via the command line: bal:Overridable="yes".
Now you can set the variables via the command line in this fashion:
BootstrapperSetup.exe /i /passive MyBurnVariable1=1 MyBurnVariable2=2
Below is an example of a WXS file that satifies all of the conditions described above:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
<Bundle Name="MyProduct" Version="1.0.0" Manufacturer="MyManufacturer" UpgradeCode="PUT-UPGRADE-CODE-HERE">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.HyperlinkLicense">
<bal:WixStandardBootstrapperApplication LicenseUrl="MyLicense.htm" ThemeFile="MyThemeFile.xml" LocalizationFile="MyLocFile.wxl" />
</BootstrapperApplicationRef>
<Variable Name="MyBurnVariable1" bal:Overridable="yes" Type="numeric" Value="0" />
<Variable Name="MyBurnVariable2" bal:Overridable="yes" Type="numeric" Value="0" />
<Chain>
<MsiPackage Id="MyFirstMsiPackage"
SourceFile="first.msi"
InstallCondition="MyBurnVariable1 = 1" />
<MsiPackage Id="MySecondMsiPackage"
SourceFile="second.msi">
<MsiProperty Name="MY_PROPERTY" Value="[MyBurnVariable2]" />
</MsiPackage>
</Chain>
</Bundle>
</Wix>

Using text input parameter on cruisecontrol dashboard

In my Cruisecontrol task, I wish to xcopy code from a folder name, specified by the user on the dashboard. Is there a way to show a text input box on my CC dashboard along my project, which can be used in the ccnet.config file during xcopy? Or is this too wishful?
It turns out that CruiseControl.net has now added support for parameters.
A configuration similar to below needs to be added to the node of your ccnet.config:
<parameters>
<selectParameter>
<name>TargetSite</name>
<allowedValues>
<value name="DEV">DEV</value>
<value name="AT">AT</value>
</allowedValues>
</selectParameter>
<selectParameter>
<name>Operation</name>
<allowedValues>
<value name="start">start</value>
<value name="stop">stop</value>
</allowedValues>
</selectParameter>
</parameters>
Doing so would show up these as input parameters when you do a force start!
These parameters, can then be used as variables in the such as $[TargetSite]

How do I deploy registry keys and values using WiX 3.0?

If I want to create the registry key
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\MyApp
with the string value
EventMessageFile : C:\Path\To\File.dll
how do I define this in my WiX 3.0 WXS file? Examples of what the XML should look like is much appreciated.
You seem to want to create an event log source. If that is the case, you should take a look at the <EventSource> element in the util extension.
Check out this page. An example would be:
<registry action="write"
root"HKLM" key="SYSTEM\CurrentControlSet\Services\Eventlog\Application\MyApp"
type="string" value="EventMessageFile : C:\Path\To\File.dll" />
I went with this:
<Component Id="EventLogRegKeys" Guid="{my guid}">
<RegistryKey Id="Registry_EventLog" Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\Eventlog\Application\MyApp" Action="create">
<RegistryValue Id="Registry_EventLog_EventSourceDll" Action="write" KeyPath="yes" Name="EventMessageFile" Type="string" Value="C:\Path\To\File.dll" />
</RegistryKey>
</Component>
It would be better to refer to File.dll using file reference syntax, to ensure that the actual path it's installed to is used. Use [#filekey], where filekey is the Id of the File element describing the file.
Use the following under DirectoryRef --> Directory...
<Component Id="RegisterAddReferencesTab32" Guid="D9D01248-8F19-45FC-B807-093CD6765A60"> <RegistryValue Action="write" Id="RegInstallDir32" Key="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\MyApp" Root="HKLM" Type="string" Value="C:\Path\To\File.dll" /></Component>