- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
现在,使用以下命令从命令行执行UltraEdit脚本:
uedit64.exe /s="J:\SkyDrive\work\ue-script\newFile.js"
uedit64.exe /s="J:\SkyDrive\work\ue-script\newFile.js" /pars="parameter1=value1,parameter2=value2"
parameter1=value1
中获取
parameter2=value2
和
newFile.js
。
最佳答案
UltraEdit脚本通常从命令行执行,以完全重新格式化一个或多个文本文件,而无需用户交互且不依赖于参数。或者,用户可以使用getString
和/或getValue
从用户在UltraEdit中手动启动UltraEdit脚本,而无需或只需进行很少的用户交互。有许多脚本语言和脚本解释器可以根据VBScript,PowerShell,Perl,Python等参数来执行某些操作。
在UltraEdit的命令行上无法为UltraEdit宏/脚本指定其他自定义参数。命令行参数由uedit64.exe
或uedit32.exe
解释,并且UltraEdit宏和脚本无权访问可执行文件的参数列表。
在启动UltraEdit并执行脚本之前,我知道三种将字符串(参数)从另一个进程传递给UltraEdit脚本的可能性:
通过剪贴板,或
通过文本文件,或
通过在执行前修改脚本。
1.通过剪贴板将参数传递给UltraEdit / UEStudio脚本
第一个解决方案易于实现。但是它有一个很大的缺点,即Windows剪贴板上的内容在启动时会被修改,并且在脚本读取参数及其值之前,没有其他进程可以将某些内容复制到剪贴板上。如果应在后台执行UltraEdit来执行脚本,则这些缺点非常成问题。
必须在命令行或批处理文件中执行以下两个命令:
echo parameter1=value1,parameter2=value2 | %SystemRoot%\System32\clip.exe
uedit64.exe /fni /s="J:\SkyDrive\work\ue-script\newFile.js"
clip.exe
。但是Windows XP上没有
clip.exe
。但是,Windows Server 2003中的
clip.exe
也可以在Windows XP上使用。
/fni
(强制新实例),以在默认情况下未选中配置设置“允许多个实例”时从命令行执行脚本。有关为什么在从命令行运行UltraEdit宏/脚本时为什么在命令行上将
/fni
用作命令行的第一个参数的信息,请阅读UltraEdit论坛中的主题
Always get error message when running a macro/script via command line parameter (solved)。
// Copy content of system (Windows/Mac/Linux) clipboard to a variable.
UltraEdit.selectClipboard(0);
var sParameterList = UltraEdit.clipboardContent;
// For safety check if the first parameter string begins with "parameter1".
if (sParameterList.indexOf("parameter1") == 0)
{
// Remove trailing withspaces from parameter list
var sParameterList = sParameterList.replace(/\s+$/,"");
// Split up the parameters list using comma as delimiter.
var asParameterList = sParameterList.split(',');
// For demonstration just open a message box listing the read
// parameters with their values without splitting them up further.
var sMessageText = "The parameter";
if (asParameterList.length > 1)
{
sMessageText += "s are:\n";
}
else
{
sMessageText += " is:\n";
}
for (var nParameter = 0; nParameter < asParameterList.length; nParameter++)
{
sMessageText += '\n "' + asParameterList[nParameter] + '"';
}
UltraEdit.messageBox(sMessageText,"List of parameters");
}
> C:\Temp\ParameterList.tmp echo parameter1=value1,parameter2=value2
start "" /wait uedit64.exe /fni /s="J:\SkyDrive\work\ue-script\newFile.js"
del C:\Temp\ParameterList.tmp
C:\Temp\ParameterList.tmp
,然后启动UltraEdit以在单独的进程中运行脚本,并暂停批处理,直到退出UltraEdit。最后,从命令行删除临时文本文件。
// Define the name of the file with the parameters with full path.
// The usage of environment variables in file name is not possible.
var sParameterListFile = "C:\\Temp\\ParameterList.tmp";
// Remember document index of active document which requires UltraEdit for
// Windows v16.00 or UEStudio v10.00. It would be possible to use code to
// get document index of active document on using an even older version of
// UltraEdit or UEStudio.
var nActiveDocIndex = UltraEdit.activeDocumentIdx;
// Open the parameter list file. This file should not be opened already
// before running this script. Otherwise additional code would be needed
// to search first in list of opened files for this file and read the
// parameters from already opened file and keep the file open instead
// of opening it and closing it after reading the first line.
UltraEdit.open(sParameterListFile);
// Test with a case-sensitive string comparison if the file could be really
// opened successfully in which case the parameter list file is the active
// file whose path property is the full name of the file with path.
if (UltraEdit.activeDocument.path == sParameterListFile)
{
// Define environment for this script.
UltraEdit.insertMode();
UltraEdit.columnModeOff();
// Read from the parameter list file just the first line without
// the line terminating character(s) and split up the parameters
// list using comma as delimiter before closing the file.
UltraEdit.activeDocument.startSelect();
UltraEdit.activeDocument.key("END");
UltraEdit.activeDocument.endSelect();
var asParameterList = UltraEdit.activeDocument.selection.split(',');
UltraEdit.closeFile(UltraEdit.activeDocument.path,2);
// For safety check if the first parameter string begins with "parameter1".
if (asParameterList[0].indexOf("parameter1") == 0)
{
// For demonstration just open a message box listing the read
// parameters with their values without splitting them up further.
var sMessageText = "The parameter";
if (asParameterList.length > 1)
{
sMessageText += "s are:\n";
}
else
{
sMessageText += " is:\n";
}
for (var nParameter = 0; nParameter < asParameterList.length; nParameter++)
{
sMessageText += '\n"' + asParameterList[nParameter] + '"';
}
UltraEdit.messageBox(sMessageText,"List of parameters");
}
// Make the previously active document again the active
// document if there was any document opened before at all.
if (nActiveDocIndex >= 0)
{
UltraEdit.document[nActiveDocIndex].setActive();
}
}
> "%TEMP%\Any File Name.txt" echo parameter1=value1,parameter2=value2
start "" /wait uedit64.exe /fni "%TEMP%\Any File Name.txt" /s="J:\SkyDrive\work\ue-script\newFile.js"
del "%TEMP%\Any File Name.txt"
if (UltraEdit.document.length > 0) // Is any file opened?
{
// Define environment for this script.
UltraEdit.insertMode();
UltraEdit.columnModeOff();
// Move caret to top of first opened file which should
// be the file with the parameters for the script.
UltraEdit.document[0].top();
// Read from the parameter list file just the first line without the
// line terminating character(s) and split up the parameters list
// using comma as delimiter. The parameter list file remains opened.
UltraEdit.document[0].startSelect();
UltraEdit.document[0].key("END");
UltraEdit.document[0].endSelect();
var asParameterList = UltraEdit.document[0].selection.split(',');
// For safety check if the first parameter string begins with "parameter1".
if (asParameterList[0].indexOf("parameter1") == 0)
{
// For demonstration just open a message box listing the read
// parameters with their values without splitting them up further.
var sMessageText = "The parameter";
if (asParameterList.length > 1)
{
sMessageText += "s are:\n";
}
else
{
sMessageText += " is:\n";
}
for (var nParameter = 0; nParameter < asParameterList.length; nParameter++)
{
sMessageText += '\n"' + asParameterList[nParameter] + '"';
}
UltraEdit.messageBox(sMessageText,"List of parameters");
}
}
echo var asParameterList = [ "value1", "value2" ];>"%TEMP%\ParameterList.tmp"
copy /B "%TEMP%\ParameterList.tmp" + "J:\SkyDrive\work\ue-script\newFile.js" "%TEMP%\TempScript.js" >nul
start "" /wait uedit64.exe /fni /s="%TEMP%\TempScript.js"
del "%TEMP%\ParameterList.tmp" "%TEMP%\TempScript.js"
// For demonstration just open a message box listing the parameter
// values as defined at top of the script from outside UltraEdit.
var sMessageText = "The parameter value";
if (asParameterList.length > 1)
{
sMessageText += "s are:\n";
}
else
{
sMessageText += " is:\n";
}
for (var nParameter = 0; nParameter < asParameterList.length; nParameter++)
{
sMessageText += '\n"' + asParameterList[nParameter] + '"';
}
UltraEdit.messageBox(sMessageText,"List of parameter values");
// include parameters.js
,并且在命令行上动态创建文件
parameters.js
(具有完整路径或不具有路径),该命令行包含将JavaScript语言中的参数定义为JavaScript变量的行。
关于javascript - 如何从命令行将参数传递给UltraEdit脚本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41421314/
我想缩短大文本中的长引号。我的台词: 'Az ital miatt lettem szerelmes, A szerelem miatt pedig adósságba futottam, És bá
我有下面的代码来查找 %hostname 之后的正则表达式,它正确地替换了 #hostname 的所有文本。 我如何为 %Location 和 #Location 复制这一点。我似乎无法让复制工作于多
UltraEdit 中是否有允许我查看文件编码的设置? 最佳答案 在 UltraEdit 中,用于显示文件的编码显示在右侧某处的状态栏中,以及正在使用的行尾类型,例如“U8-UNIX”。您还可以手动设
有人对如何设置 UltraEdit-32(我使用的是 8.10a 版)作为 Java 编辑器有什么建议吗? 具体来说,我希望能够根据可配置的编码风格自动格式化源代码。 例如,如果我在方法定义(同一行)
带有光标的线条以淡海蓝 gem 色突出显示。 有没有一种配置方法可以改变这种颜色? 有没有配置方法可以关闭它? 最佳答案 如果它的版本小于 20,请在菜单 View - Set Colors... 中
在 http://www.ultraedit.com/downloads/extras/wordfiles.html我没有找到 Docker 的 wordfile。 http://www.ultrae
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引起辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the he
我想知道 Perl 是否是一个很好的(易于使用和学习)工具: 我想对我的 C/C++ 源代码进行一些自定义预处理。基本上,这是为了允许我将自己的自定义注释插入到源代码中并基于它生成新代码。所需的处理主
背景 使用 UltraEdit,您可以选择正确格式化 XML 内容: View > View as (Highlighting file type) > XML 改变颜色,使标签、属性和内容更易读。
为了删除后面的“NSString *” NSString * todayDate; NSString * conditionStatus; NSString * ftemp; NSString * c
我有一个结合使用 JavaScript 和 UltraEdit 脚本的程序。该程序有一个要在文件/选项卡中搜索的字符串数组。如果找到,它将相应的行移动到新文件/选项卡。当使用精确匹配时,效果很好。 但
我目前正在使用配备了 Ctags 的 UltraEdit 来编辑 C++ 文件 (.cpp)。它的 Ctags 支持在我打字时自动自动完成符号——但它不能正确地将自己限制在一个类的成员中,这太盲目
我刚开始使用 UltraEdit 在 Mac 上编写 HTML 和 CSS 代码。 (我是 HTML 的新手,我在 Windows 上的 Notepad++ 中只做过一点。) 问题是我不能将我的 CS
我很难让 Ultraedit 正则表达式在 C/C++ 代码中工作。我知道为 /w 添加额外的 / 但它仍然不起作用。 #include #include int main() { int
我是一名优秀的程序员,十分优秀!