我是AutoHotKey的新手,到目前为止,我认为自己很幸运能够创建一个脚本来自动化窗口中大约90%的数据输入.我现在正试图将其提升一个档次,并在我的数据输入脚本中添加警告/警告GUI.我想暂停正在运行的脚本并打开一个GUI,它会提醒我查看已输入的内容,如果某个特定条目看起来没问题,只需一个按钮即可继续操作,另一个按钮可以转出GUI和如果条目不正确,则为脚本的剩余部分.
这是我提出的一些代码,与一些伪代码混合以帮助显示我想要做的事情.
(Previous data entry script executes to this point)
Stop the script
Gui, New
Gui, Add, Text, 'n Check Authorization Number to be sure it is A1234 (FY 15). ; Wraps text
Gui, Add, Button, Default, Continue
Gui, Add, Button, Quit
Gui, Show, IMPORTANT!
If Continue button is clicked
----Continue with script
If Abort button is clicked
----Close the GUI
----Exit the entire script
(Resume where I left off with rest of the data entry script)
我已经阅读了AHK帮助文件并且难以理解如何使这些按钮工作,以及如果我点击继续,如何正确地从GUI返回到脚本,或者如果我发现问题就退出整个事情.我可以调整GUI的大小和按钮位置等内容; 最重要的是获得正确的GUI代码.有人可以帮助代码吗?(我上次的编程课程是在2003年,所以我忘了很多!)
我试图在一个大字符串中找到字符串"\ r \n"(基本上换行和返回)的所有索引.
我需要这样做,因为我必须逐行将大字符串写入PDF文件(我必须在写完前一行后调用我正在使用的dll的换行符API).
这是代码的简短版本: -
string fileContents = "abc\r\n\r\ndef\r\nghi";
int pos = -1;
int start = 0;
while ((pos = fileContents.IndexOf("\r\n", start)) != -1)
{
//extract string
//write string to PDF
//call newline API
start = pos + 1;
}
Run Code Online (Sandbox Code Playgroud)
fileContents变量中"\ r \n"的预期位置是3,7和14.但是,在调试代码时,pos变量中的值是3,5和10.
我的indexOf()调用似乎有什么问题?
我有一个像这样的字符串:
var report = 'Verifying Wireless Interface is present and state is Disconnected:PASSED<br>Verify Profile not present on the Client:PASSED<br>Add Profile to the Client:PASSED<br>Verify Profile Added Present on the Client:PASSED<br>Connecting to Access Point:PASSED<br>Verify the State is Connected:PASSED<br>Disconnecting from Access Point:PASSED<br>Verify the State is Disconnected:PASSED<br>ReConnecting to Access Point:PASSED<br>Verify the State is Connected:PASSED<br>Verify Ping to the Gateway (Access point):PASSED<br>Verify Signal Strength Greater than 75%:PASSED<br>Verify Round Trip Time not greater than 30 millieseconds:PASSED<br>Disconnecting from Access Point:PASSED<br>Verify the State is Disconnected:PASSED<br>Delete Profile to the Client:PASSED<br>Verify …Run Code Online (Sandbox Code Playgroud) 我正在制作一个游戏的审查程序.我无法弄清楚如何做到这一点.我有一个单词和句子的字符串[].我发现了如何过滤单词并阻止消息.现在我正在尝试将*替换为与单词长度相同的单词.例如,如果有人说"他妈的那个愚蠢的屁股"就会出现**** that stupid ***.以下是我正在使用的代码
public void Actionfor(ServerChatEventArgs args)
{
var player = TShock.Players[args.Who];
if (!args.Text.ToLower().StartsWith("/") || args.Text.ToLower().StartsWith("/w") || args.Text.ToLower().StartsWith("/r") || args.Text.ToLower().StartsWith("/me") || args.Text.ToLower().StartsWith("/c") || args.Text.ToLower().StartsWith("/party"))
{
foreach (string Word in config.BanWords)
{
if (player.Group.HasPermission("caw.staff"))
{
args.Handled = false;
}
else if (args.Text.ToLower().Contains(Word))
{
switch (config.Action)
{
case "kick":
args.Handled = true;
TShock.Utils.Kick(player, config.KickMessage, true, false);
break;
case "ignore":
args.Handled = true;
player.SendErrorMessage("Your message has been ignored for saying: {0}", Word);
break;
case "censor":
args.Handled = false;
var wordlength …Run Code Online (Sandbox Code Playgroud) 如果没有办法将您的C文件转换为.app macintosh可执行文件,那么您如何创建任何mac应用程序?
更新:这是因为我没有安装GCC.