I'm not 100% sure what an AD Group is.... if you can give me a little more light on that subject, I can probably help you out. As for retrieving the Day of the Week (say, Sunday - Saturday), I have written a function that returns the day of the week from the current day. Here is that function, just stick it at the very very bottom of your script (like, after wscript.quit):
public function ReturnDay
RawDate = FormatDateTime(Now(), 1)
Parts = split(RawDate, ",")
ReturnDay = Parts(0)
end function
And you can call that function like this:
TheDay = ReturnDay()
You would probably use it like so:
TheDay = ReturnDay()
if Theday = "Friday" then
' /* Do Stuff Here For Friday */
else
' /* Do Stuff Here For Every Other Day */
end if
If you can get me a little more info on "AD", I'll see what I can do about retrieving the Group that the user belongs to.
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
"file://cih_data\IT\Public\CIHStaffNews.htm"
You Have a mapped drive called cih_data?
dim oIE
Set oIE = WScript.CreateObject("InternetExplorer.Application")
TheDay = ReturnDay()
if Theday = "Tuesday" then
oIE.Navigate "file://cih_data\IT\Public\CIHStaffNews.htm"
oIE.Show
set oIE = nothing
else
end if
WScript.Quit
public function ReturnDay
RawDate = FormatDateTime(Now(), 1)
Parts = split(RawDate, ",")
ReturnDay = Parts(0)
end function
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
Yes, I'm pretty sure that IE has no idea what that share is. If it was assigned a drive letter, that might be a different story... but because it's not, I'm willing to bet that IE has no clue what it's looking at. If you could assign the share a drive letter, it should probably work.
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
Oops. Just replace:
oIE.Show
with:
oIE.Visible = True
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
Have you tried replacing file://G:\CIHStaffNews.htm with an actual URL? Such as google or yahoo, to see if it actually loads a web page? After changing .show to .visible did the IE window actually show up, and now you are getting a different error?
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
dim oIE
Set oIE = WScript.CreateObject("InternetExplorer.Application")
TheDay = ReturnDay()
if Theday = "Wednesday" then
oIE.Navigate "www.google.com"
oIE.Visible = True
else
end if
set oIE = Nothing
WScript.Quit
public function ReturnDay
RawDate = FormatDateTime(Now(), 1)
Parts = split(RawDate, ",")
ReturnDay = Parts(0)
end function
This works perfectly fine on my machine. It spawns IE and loads google with no problem. Try to copy and paste the code I have posted here, into a document, and see if it works.
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
I just double click on the icon and it runs. I'm guessing perhaps your version of windows doesn't have the latest IE installed, or the latest WSH installed, if at all (thought it should). That said, try it the first way:
TheDay = ReturnDay()
if Theday = "Wednesday" then
shell ("C:\progra~1\intern~1\iexplore.exe file://G:\CIHStaffNews.htm")
else
end if
WScript.Quit
public function ReturnDay
RawDate = FormatDateTime(Now(), 1)
Parts = split(RawDate, ",")
ReturnDay = Parts(0)
end function
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
I certainly appreciate you posting the working code and solution. This way others have the ability to learn from what we had just struggled with. Good Job, and Congrats :)
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215