Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use vbs to realize the automatic message sending function of Wechat

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces how to use vbs to achieve Wechat automatic sending messages related knowledge, the content is detailed and easy to understand, simple and fast operation, has a certain reference value, I believe that after reading this article on how to use vbs to achieve Wechat automatic sending messages will have a harvest, let's take a look at it.

1. Wechat automatically replies to messages.

Wechat, as the hottest and hottest social software a few days ago, should be a household name. Young people, the elderly and even children are using mobile phones to play Wechat. For office workers, the computer version of Wechat is probably the most used. We manually input, send or reply to all kinds of Wechat messages every day, and we will inevitably encounter some situations where we need computers to automatically send messages to the designated person. We can do it with the script of vbs in windows. Let's first take a look at vbs.

Vbs, whose full name is Microsoft Visual Basic Script Edition, is a Visual Basic-based scripting language developed by Microsoft, which can be opened directly on windows.

In vbs, we can easily simulate and send all kinds of buttons and text through sendkeys, but sending Chinese characters directly will cause confusion, so we need to put the Chinese characters to be sent on the clipboard and then take the content out of the clipboard and send it. In cmd, we can connect echo and clip.exe to put the content on the clipboard.

Echo test | clip.exe enter the above command in the cmd command line window, you will find that the two characters "test" are put into the clipboard. In vbs, we only need to call this command to implement the operation of putting the content on the clipboard ws.Run "cmd.exe / c echo test | clip.exe", 0, True now we know how to send a message, but also know how to send Chinese But to send messages to Wechat, we also need to know how to wake up Wechat in any interface, in general applications, we can activate the window through appActivate, of course, we can also use keyboard shortcuts to wake up some software or perform specific operations, such as in Wechat, we can wake up Wechat through Ctrl+Alt+W and find friends with Ctrl+F.

The final code to send a message through the shortcut key to wake up Wechat:

Dim name,Msg Num 'define variables and allocate memory' Inputbox () function to enter name=Inputbox ("Please enter who you want to send a message to") Msg=Inputbox ("Please enter the content of the message you send") num=Inputbox ("Please enter how many messages you send repeatedly") set ws=wscript.createobject ("wscript.shell") 'create shell object for Windows Open shell window' execute cmd.exe / c echo & Name & in the shell window of Windows "| clip.exe" copy name to clipboard ws.Run "cmd.exe / c echo" & Name & "| clip.exe" 0mshta Truews.Run "mshta _ javascript:window.execScript ('window.close','vbs')", 0MagneTruews.sendKeys "^% w"' Open Wechat wscript.sleep 500ws.sendKeys "^ f" through the Ctrl+Alt+W shortcut key execute ctrl + F shortcut in the Wechat window to wake up the search function wscript.sleep 500ws.sendKeys "^ v" 'paste the namewscript.sleep 500ws.sendKeys "{ENTER}"to search' press the enter key of the keyboard Go to the name contact window wscript.sleep 500 'and execute cmd.exe / c echo "& Name &" | clip.exe "in the shell window of Windows to copy the contents of the message sent to the clipboard ws.Run" cmd.exe / c echo "& Msg &" | clip.exe ", 0 True wscript.sleep 500for iTunes 1 to num 'loop sends num times ws.sendKeys "^ v"' paste the contents of the msg message to be sent wscript.sleep 500ws.sendKeys "{ENTER}" 'press the enter key to send next

The final code to send the message by executing WeChat.exe Wake up Wechat:

Dim program1,name Msg 'define variables and allocate memory' Inputbox () function to enter name=Inputbox ("Please enter who you want to send a message to") Msg=Inputbox ("Please enter the content of the message you send") num=Inputbox ("Please enter how many times to send the message") 'program1 indicates the location of the WeChat.exe' program1= "D:\ other-systems\ WeChat\ WeChat.exe" 'program1= "D:\ other-systems\ QQ\ Bin\ QQ.exe" program1=Inputbox (" Please enter the storage location of WeChat.exe or QQ.exe ") set wshshell=CreateObject (" wscript.shell ") 'create shell object for Windows to open shell window' execute cmd.exe / c echo" & Name & "| clip.exe" copy name to the clipboard wshshell.Run "cmd.exe / c echo" & Name & "| clip.exe" in the shell window of Windows 0ENTER Trueshell.Run "mshta _ javascript:window.execScript ('window.close','vbs')", 0MagneTrueTrue' Open Wechat window set oexec=wshshell.exec (program1) True500' stay 500ms wshshell.sendKeys "^ f" execute ctrl + F Shortcut in Wechat window Wake up search function wscript.sleep 500wshshell.sendKeys "^ v" 'paste the namewscript.sleep 500wshshell.sendKeys "{ENTER}" to search by pressing the enter key of the keyboard Go to the name contact window wscript.sleep 500 'and execute cmd.exe / c echo "& Name &" | clip.exe "in the shell window of Windows to copy the contents of the message sent to the clipboard wshshell.Run" cmd.exe / c echo "& Msg &" | clip.exe ", 0 Truewscript.sleep 500for iTunes 1 to num 'loop sends num times wshshell.sendKeys "^ v"' paste the contents of the msg message to be sent wscript.sleep 500wshshell.sendKeys "{ENTER}" 'press the enter key to send nextwscript.quit

Of course, in addition to sending messages to Wechat, you can also send messages to qq. The basic idea is to copy and paste and search for contacts by pressing various keyboard shortcuts, and to send them by pressing the enter key.

2. How the vbs script runs

If you don't have any editors installed on your computer, it doesn't matter, use the notepad that comes with your computer to write scripts, right-> New-> text documents, write vbs scripts in the new text documents, rename them after writing, change the suffix to .vbs, appear the following prompt, choose Yes.

Double-click to run the vbs script.

This is the end of the article on "how to use vbs to automatically send messages on Wechat". Thank you for reading! I believe that everyone has a certain understanding of the knowledge of "how to use vbs to achieve Wechat automatic message sending function". If you want to learn more knowledge, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report