Vbs Enables automatic QQ reminders for jobs

Source: Internet
Author: User

In practical work, most software projects are process-based and version-based. Each person's work and tasks must be handled in a timely manner so that the work can be carried out efficiently. To this end, we thought of using vbs to implement the automatic QQ reminder function for work tasks. Its working principle is very simple: using ADO to achieve database connection, to query the status of related work tasks in different links, through the establishment of QQ temporary session to notify relevant personnel for processing. In this way, you can avoid manual query of work tasks and make the work more efficient.

The following is the source code of the program. Save the following code as a vbs script file for example: automatic_icationication.vbs.

''' Configuration information ''''''''''''''''' '''
Dim logo_six
Logo_six = "sg186" REM project name Configuration
Dim item_code
Item_code = "330" REM stage name settings
Dim state
State = "0" REM ticket handling status settings
Dim at_emp_no
At_emp_no = "32557" REM specifies the handler settings
Dim qq_id
Qq_id = "420363096" REM creates the QQ number of the session
Dim msg
MSG = "you have a job. Please handle it in time! Ticket No.: "REM sends message content
Dim data_source
Data_source = "brt170"
'''''''''''''''''''''''''''''''''''''''' '''''''''''
Dim res, CMD, SQL
Set res = Createobject ("ADODB. recordset ")
Set cmd = Createobject ("ADODB. Command ")
Rem Connection database

Dim connstring
Connstring = "provider = oraoledb. oracle.1; Password = query; persist Security info = true; user id = query; Data Source =" & data_source & "; server = 172.19.201.170"
Cmd. activeconnection = connstring

Rem query statement
SQL = "select wm_concat (app_no) app_no from sp_issue A where substr (. comp_code, 0, 4) in (select B. code_value from sp_code B where B. logo_six = '"& logo_six &"') and exists (select 1 from sp_process c Where C. item_code = '"& item_code &"' and C. state = '"& State &"' and C. at_emp_no = '"& at_emp_no &"' and C. app_no =. app_no )"

Cmd. commandtext = SQL
Dim returnapp_no
Set res = cmd. Execute ()
If res. EOF and res. bof then
Res. Close
Else
If res (0) <> "then
Returnapp_no = CSTR (RES (0 ))
On Error resume next
STR = "" & MSG & "& returnapp_no &""
Set wshshell = wscript. Createobject ("wscript. Shell ")
Wshshell. run "MSHTA VBScript: clipboardData. setdata ("+" + "text" + "+", "+" & STR & "+") (close) ", 0
Wshshell. Run "Tencent: // message /? Menu = Yes & uin = "& qq_id &" & Site = & service = 200 & sigt = success ", 0, true
Wscript. Sleep 1000
Wshshell. sendkeys "^ V"
Wshshell. sendkeys "% s"
Wshshell. sendkeys "{enter }"
Returnapp_no = CSTR (RES (0 ))
End if
End if
Set res = nothing
Set cmd. activeconnection = nothing
Set cmd = nothing

You can configure test. vbs as follows:

A. You can configure database connection in connstring.

B. Set the query statement in SQL. The wm_concat function converts multiple rows into one row to make the program more efficient. logo_six indicates the project number, item_code indicates the current link, and State indicates the ticket processing status.

The expected output information can be configured in C. Str.

D. uin is the QQ number of the specified temporary session to receive messages.

The program function is implemented. The problem is that we cannot manually execute automatic_icationication.vbs every moment. Therefore, batch processing is required. The following two versions of batch processing are available.

Version 1: vbs Batch Processing

set os = createobject("wscript.shell")
do
os.run "Automatic_notification.vbs"
wscript.sleep 3000*60
loop

Version 2: bat batch processing implementation

@echo off
:start
start Automatic_notification.vbs
ping 127.1 -n 2000 >nul
goto start

Save the code in the preceding two methods as run. vbs, run. bat, run directly. vbs or run. bat, where run. vbs, run. you can set the message sending interval in bat.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.