-- 作者:zk7777777
-- 发布时间:2012/7/27 19:13:56
-- [求助请阿火详细说明一下代码的使用?
通过飞信给自己发短信的VBA代码
以下红色部分要变动,千万不要跟我说复制黏贴后就想发短信
Set fs=CreateObject("Microsoft.XMLHTTP") num="13900***688" \'这里输入开通飞信的手机号 pwd="iloveweistock" \'这里请输入飞信密码 dm="http://f.10086.cn/im/" url=dm&"login/inputpasssubmit1.action" dat="&pass="&pwd&"&m="&num fs.Open "POST",url,False fs.SetRequestHeader "content-type","application/x-www-form-urlencoded;charset=utf-8" fs.Send dat
sub fsfx() msg="股指开多" fs.Open "POST",dm&"user/sendMsgToMyselfs.action",False fs.SetRequestHeader "content-type","application/x-www-form-urlencoded;charset=utf-8" fs.Send "msg="&msg End Sub
把以上部分复制到Macro地下,输入开通飞信的手机号码和飞信密码输入,后按alt+F8,输入宏名 fsfx 即可收到“股指开多”的短信
把Sub过程换成Function函数,就可以通过自定义函数,根据条件实时地给自己发送短信
比如:
runmode:0;
Globalvariable: tvo=0; If buycond and Tvo<>barpos and islastbar Then Begin fs(1);//1是参数
tvo:=barpos; End
自定义函数可以这样写:
Function fs(Formula,trend) \'系统会在逐K线模式解释公式时的每个周期都会调用此函数一遍,因此设计时应该注重程序的执行效率,不要重复的执行一些没必要的代码 if trend=1 then msg="股指开多" end if if trend=2 then msg="股指平多" end if if trend=3 then msg="股指开空" end if if trend=4 then msg="股指平空" end if if trend=5 then msg="股指平空开多" end if if trend=6 then msg="股指平多开空" end if fs.Open "POST",dm&"user/sendMsgToMyselfs.action",False fs.SetRequestHeader "content-type","application/x-www-form-urlencoded;charset=utf-8" fs.Send "msg="&msg fs=1 End Function
|