The following script continues on from the other days post on scripting with OMA, I've been playing around with this a bit more and although its a bit funny in the way it responds I've come up with the following script which will logon to OMA navigate though all the menus to the OOF section and then change the OOF status. (kind of a lot like batch answer file scripting). I thought I would be cool to come up with a single button oof flipper application for a smart phone.
ObjxmlHttp = CreateObject("Microsoft.XMLHTTP")
ObjxmlHttp.Open "get", "http://server/oma/(cvlbrraeffpq1xu5c013j055)/oma.aspx?", False, "domain\user", "password"
ObjxmlHttp.setRequestHeader "Accept-Language:", "en-us"
ObjxmlHttp.setRequestHeader "Content-type:", "application/x-www-UTF8-encoded"
ObjxmlHttp.setRequestHeader "Content-Length:", Len(xmlstr)
ObjxmlHttp.Send()
Wscript.echo ObjxmlHttp.responseText
slen = instr(ObjxmlHttp.responseText,"ufps") + 5
ufps = mid(ObjxmlHttp.responseText,slen,6)
fexe = navoma("__EVENTTARGET=c06&__EVENTARGUMENT=c0&__V_ViewStateKey=0",ufps)
slen = instr(fexe,"ufps") + 5
ufps = mid(fexe,slen,6)
if instr(fexe,"Change Password") then
fexe1 = navoma("__EVENTTARGET=c16&__EVENTARGUMENT=c1&__V_ViewStateKey=1",ufps)
else
fexe1 = navoma("__EVENTTARGET=c15&__EVENTARGUMENT=c1&__V_ViewStateKey=1",ufps)
end if
slen = instr(fexe1,"ufps") + 5
ufps = mid(fexe1,slen,6)
fexe2 = navoma("__EVENTTARGET=c20&__EVENTARGUMENT=c2&__V_ViewStateKey=2",ufps)
slen = instr(fexe2,"ufps") + 5
ufps = mid(fexe2,slen,6)
fexe3 = navoma("__EVENTTARGET=c22&__EVENTARGUMENT=c2&__V_ViewStateKey=3",ufps)
slen = instr(fexe3,"ufps") + 5
ufps = mid(fexe3,slen,6)
fexe4 = navoma("",ufps)
Set ObjxmlHttp = nothing
function navoma(szXml,ufps)
ostring = "http://server/oma/(cvlbrraeffpq1xu5c013j055)/oma.aspx?__ufps=" & ufps
ObjxmlHttp.Open "post",ostring , False
ObjxmlHttp.setRequestHeader "Accept-Language:", "en-us"
ObjxmlHttp.setRequestHeader "Content-type:", "application/x-www-form-urlencoded"
ObjxmlHttp.setRequestHeader "Referer:", ostring1
ObjxmlHttp.setRequestHeader "Content-Length:", Len(szXml)
ObjxmlHttp.Send szXml
Wscript.echo ObjxmlHttp.responseText
if instr(ObjxmlHttp.responseText,"Outlook(R) Mobile Access is returning you to
the main menu") then reset(ObjxmlHttp.responseText)
navoma = ObjxmlHttp.responseText
end function
function reset(response)
slen = instr(response,"ufps") + 5
ufps = mid(response,slen,6)
wscript.echo "start at " & ufps
slen = instr(response,"Out of Office:") + 15
szXml = "__EVENTTARGET=c01&__EVENTARGUMENT=c0&__V_ViewStateKey=1"
ostring = "http://server/oma/(cvlbrraeffpq1xu5c013j055)/oma.aspx?__ufps=" & ufps
ObjxmlHttp.Open "post",ostring , False
ObjxmlHttp.setRequestHeader "Accept-Language:", "en-us"
ObjxmlHttp.setRequestHeader "Content-type:", "application/x-www-form-urlencoded"
ObjxmlHttp.setRequestHeader "Referer:", ostring1
ObjxmlHttp.setRequestHeader "Content-Length:", Len(szXml)
ObjxmlHttp.Send szXml
slen = instr(ObjxmlHttp.responseText,"ufps") + 5
ufps = mid(ObjxmlHttp.responseText,slen,6)
Wscript.echo ObjxmlHttp.responseText
fexe = navoma("__EVENTTARGET=c06&__EVENTARGUMENT=c0&__V_ViewStateKey=0",ufps)
slen = instr(fexe,"ufps") + 5
ufps = mid(fexe,slen,6)
if instr(fexe,"Change Password") then
fexe1 = navoma("__EVENTTARGET=c16&__EVENTARGUMENT=c1&__V_ViewStateKey=1",ufps)
else
fexe1 = navoma("__EVENTTARGET=c15&__EVENTARGUMENT=c1&__V_ViewStateKey=1",ufps)
end if
slen = instr(fexe1,"ufps") + 5
ufps = mid(fexe1,slen,6)
end function
ObjxmlHttp = CreateObject("Microsoft.XMLHTTP")
ObjxmlHttp.Open "get", "http://server/oma/(cvlbrraeffpq1xu5c013j055)/oma.aspx?", False, "domain\user", "password"
ObjxmlHttp.setRequestHeader "Accept-Language:", "en-us"
ObjxmlHttp.setRequestHeader "Content-type:", "application/x-www-UTF8-encoded"
ObjxmlHttp.setRequestHeader "Content-Length:", Len(xmlstr)
ObjxmlHttp.Send()
Wscript.echo ObjxmlHttp.responseText
slen = instr(ObjxmlHttp.responseText,"ufps") + 5
ufps = mid(ObjxmlHttp.responseText,slen,6)
fexe = navoma("__EVENTTARGET=c06&__EVENTARGUMENT=c0&__V_ViewStateKey=0",ufps)
slen = instr(fexe,"ufps") + 5
ufps = mid(fexe,slen,6)
if instr(fexe,"Change Password") then
fexe1 = navoma("__EVENTTARGET=c16&__EVENTARGUMENT=c1&__V_ViewStateKey=1",ufps)
else
fexe1 = navoma("__EVENTTARGET=c15&__EVENTARGUMENT=c1&__V_ViewStateKey=1",ufps)
end if
slen = instr(fexe1,"ufps") + 5
ufps = mid(fexe1,slen,6)
fexe2 = navoma("__EVENTTARGET=c20&__EVENTARGUMENT=c2&__V_ViewStateKey=2",ufps)
slen = instr(fexe2,"ufps") + 5
ufps = mid(fexe2,slen,6)
fexe3 = navoma("__EVENTTARGET=c22&__EVENTARGUMENT=c2&__V_ViewStateKey=3",ufps)
slen = instr(fexe3,"ufps") + 5
ufps = mid(fexe3,slen,6)
fexe4 = navoma("",ufps)
Set ObjxmlHttp = nothing
function navoma(szXml,ufps)
ostring = "http://server/oma/(cvlbrraeffpq1xu5c013j055)/oma.aspx?__ufps=" & ufps
ObjxmlHttp.Open "post",ostring , False
ObjxmlHttp.setRequestHeader "Accept-Language:", "en-us"
ObjxmlHttp.setRequestHeader "Content-type:", "application/x-www-form-urlencoded"
ObjxmlHttp.setRequestHeader "Referer:", ostring1
ObjxmlHttp.setRequestHeader "Content-Length:", Len(szXml)
ObjxmlHttp.Send szXml
Wscript.echo ObjxmlHttp.responseText
if instr(ObjxmlHttp.responseText,"Outlook(R) Mobile Access is returning you to
the main menu") then reset(ObjxmlHttp.responseText)
navoma = ObjxmlHttp.responseText
end function
function reset(response)
slen = instr(response,"ufps") + 5
ufps = mid(response,slen,6)
wscript.echo "start at " & ufps
slen = instr(response,"Out of Office:") + 15
szXml = "__EVENTTARGET=c01&__EVENTARGUMENT=c0&__V_ViewStateKey=1"
ostring = "http://server/oma/(cvlbrraeffpq1xu5c013j055)/oma.aspx?__ufps=" & ufps
ObjxmlHttp.Open "post",ostring , False
ObjxmlHttp.setRequestHeader "Accept-Language:", "en-us"
ObjxmlHttp.setRequestHeader "Content-type:", "application/x-www-form-urlencoded"
ObjxmlHttp.setRequestHeader "Referer:", ostring1
ObjxmlHttp.setRequestHeader "Content-Length:", Len(szXml)
ObjxmlHttp.Send szXml
slen = instr(ObjxmlHttp.responseText,"ufps") + 5
ufps = mid(ObjxmlHttp.responseText,slen,6)
Wscript.echo ObjxmlHttp.responseText
fexe = navoma("__EVENTTARGET=c06&__EVENTARGUMENT=c0&__V_ViewStateKey=0",ufps)
slen = instr(fexe,"ufps") + 5
ufps = mid(fexe,slen,6)
if instr(fexe,"Change Password") then
fexe1 = navoma("__EVENTTARGET=c16&__EVENTARGUMENT=c1&__V_ViewStateKey=1",ufps)
else
fexe1 = navoma("__EVENTTARGET=c15&__EVENTARGUMENT=c1&__V_ViewStateKey=1",ufps)
end if
slen = instr(fexe1,"ufps") + 5
ufps = mid(fexe1,slen,6)
end function