用于查找和替换文本的Visual Basic过程 [英] Visual Basic procedure to find and replace text

查看:86
本文介绍了用于查找和替换文本的Visual Basic过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个黑暗中的镜头,但我很确定VB可以做到这一点。我先介绍一下这个问题的背景。

我在赌场工作,我们使用压花机为玩家打印卡片。我们目前有3种不同的压花器可以切换到打印不同的卡片。我们有一个程序运行,要求简单的A,B或C切换它。不幸的是,我们不知道是谁创建了原始文件,但我们弄明白它的作用。基本上它会进入我们的Oasis.ini文件,并搜索说明这一行的行:

[卡]

embossprinter = \\acijpnt32 \ ACIJPPRN103

最后一个数字可以是3,4或5.我们试图将这些压纹器移动到我们的新打印服务器上,但为了这样做,我们必须重新创建一个可以去的程序进入Oasis.ini文件,搜索上面提到的行,并更改代码的最后部分。新线需要看起来像这样:

[卡]

embossprinter = \\acijpnt30 \ACIJPPRN090


最后一个可以是091,092,093,094或095(我们计划添加几个压花器,所以我们包括了它的范围)。

我的一个朋友看了一些东西,并说我们可以将第一部分设置为它寻找的常量,并将最后一部分设置为我们可以改变的变量。不幸的是,我发现的任何编码都没有帮助。如果有人对此有一些见解,那就太棒了。


谢谢!

This is a shot in the dark, but I''m pretty sure VB can do this. I''ll give some background on the problem first.
I work at a casino and we use embossers to print cards for players. We currently 3 different embossers that can be switched to in order to print different cards. We have a program that is run that asks a simple A, B or C to switch it. Unfortunately, we don''t know who created the original file, but we figured out what it does. Basically it goes into our Oasis.ini file and searches for the line that says this:
[Card]
embossprinter=\\acijpnt32\ACIJPPRN103

The last number can either be a 3, 4, or 5. We are attempting to move these embossers to our new print server, but to do so, we have to recreate a program that can go into the Oasis.ini file, search for the above mentioned line, and change the last part of the code. The new line would need to look something like this:
[Card]
embossprinter=\\acijpnt30\ACIJPPRN090

the last can be 091, 092, 093, 094 or 095 (we are planning to add a few embossers in as well so we are including the range for that).
A friend of mine looked some stuff up and said that we could set the first part as the constant that it looks for and set the last part as the variable that we can change. Unfortunately, any of the coding I''ve found hasn''t helped at all in doing this. If anyone has some insights on this, that''d be great.

Thanks!

推荐答案

只需将其全部粘贴进入单词并按下ctrl H并键入你想要找到的内容以及你想要替换它的内容。


(我认为这就是你的要求)
Just paste it all into word and press ctrl H and type what you want to find and what you want to replace it with.

(I think thats what your asking anyways)

不,不完全。我们知道如何手动更改线路,但我们正在设置的人员不是。该程序将在他们不知道的情况下进入并更改该行。基本上,他们打开应用程序,单击一个带有他们想要的打印机名称的按钮,并在后台(没有他们看到发生的任何事情)它进入文件,并将行更改为正确的打印机。那会更有意义吗?
No, not quite. we know how to change the line manually, but the people we''re setting this up for don''t. The program will go in and change the line without them knowing. basically, they open the app, click a button with the name of the printer they want, and in the background (without them seeing anything that happens) it goes into the file, and changes the line to the correct printer. does that make more sense?



不,不完全。我们知道如何手动更改线路,但我们正在设置的人员不是。该程序将在他们不知道的情况下进入并更改该行。基本上,他们打开应用程序,单击一个带有他们想要的打印机名称的按钮,并在后台(没有他们看到发生的任何事情)它进入文件,并将行更改为正确的打印机。那更有意义吗?
No, not quite. we know how to change the line manually, but the people we''re setting this up for don''t. The program will go in and change the line without them knowing. basically, they open the app, click a button with the name of the printer they want, and in the background (without them seeing anything that happens) it goes into the file, and changes the line to the correct printer. does that make more sense?



您好,hiattech!


以下是Google搜索结果的链接:

http://www.google.com/search?q=Using+a+VB+program+to+find+and+replace+te xt ++ in + .ini + file& rls = com.microsoft:en-us:IE-SearchBox& ie = UTF-8& oe = UTF-8& sourceid = ie7& rlz = 1I7SUNA


我在.ini中没有做任何事情所以我无法帮助你。我有一个代码,用于替换文本文件中的字符(.txt)。让我知道它是否有用。


祝你好运项目!

Hello, hiattech!

Here is a link to Google results:

http://www.google.com/search?q=Using+a+VB+program+to+find+and+replace+te xt++in+.ini+file&rls=com.microsoft:en-us:IE-SearchBox&ie=UTF-8&oe=UTF-8&sourceid=ie7&rlz=1I7SUNA

I have not done anything in .ini so I cannot help you there. I do have a code that replaces characters in a text file though (.txt). Let me know if it can be helpful.

Good luck with the project!


这篇关于用于查找和替换文本的Visual Basic过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆