Photo Gallery
Member List
Search
Calendars
FAQ
Ticket List
Log Out
Forums
Register
Login
My Profile
Inbox
Address Book
My Subscription
My Forums
saving
Logged in as: Guest
arrSession:exec spGetSession 2,2,64150
Active Users: There are
0
members and
0
guests.
Users viewing this topic: none
Printable Version
All Forums
>>
[Scripting]
>>
WSH & Client Side VBScript
>> saving
Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page:
[1]
Login
Message
<< Older Topic
Newer Topic >>
saving -
9/9/2008 8:55:17 AM
seakip
Posts: 6
Score: 0
Joined: 8/14/2008
Status:
offline
Hi everyone, I am trying to save the source code of a page to a text file whereever the user wants...the code i have so far is:
function Http() dim rsp, sauce, file, fso, oHTTP Set oHTTP = CreateObject("MSXML2.XMLHTTP") Set fso = wscript.CreateObject("scripting.filesystemobject") url = inputbox("Enter the website URL:" & vbcrlf & vbcrlf & "Example: [link=http://www.google.com%22,%22HTTP%22%29]www.google.com","HTTP")[/link] url = "http://" & url oHTTP.open "GET", url, False oHTTP.send msgbox"Status: " & oHTTP.status & VbCrLf & "All Headers: " & oHTTP.getAllResponseHeaders & "",64,"Website Info" rsp = msgbox("Do you want to save the source code of the page?",36,"Source") if rsp = vbNo then wscript.quit() else sauce = oHTTP.ResponseText Set txtfolder = app.browseForFolder _ (0, "Select a folder:", 0, "Desktop") Set ffolder = txtfolder.Self pathfortxt = ffolder.Path set tfile = fso.CreateTextFile(pathfortxt & "\" & url & "_source.txt", true) tfile.Write sauce tfile.Close end if end function
the first part works fine,but if i click save source, nothing happens :(
thx in advance for any help on the subject =)
< Message edited by
seakip
--
9/9/2008 8:56:56 AM
>
_____________________________
[ Seakip ]
Post #: 1
RE: saving -
9/9/2008 9:42:40 AM
dm_4ever
Posts: 2670
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status:
offline
You never specify what app should be....then the url will have invalid characters for a file name.... this may help.....
Function Http() Dim rsp, sauce, file, fso, oHTTP Set oHTTP = CreateObject("MSXML2.XMLHTTP") Set fso = wscript.CreateObject("scripting.filesystemobject") url = inputbox("Enter the website URL:" & vbcrlf & vbcrlf & "Example: www.google.com","HTTP") url = "http://" & url oHTTP.open "GET", url, False oHTTP.send ' MsgBox "Status: " & oHTTP.status & VbCrLf & "All Headers: " & oHTTP.getAllResponseHeaders & "",64,"Website Info" rsp = msgbox("Do you want to save the source code of the page?",36,"Source") If rsp = vbNo then wscript.quit() Else sauce = oHTTP.ResponseText Dim app : Set app = CreateObject("Shell.Application") Set txtfolder = app.browseForFolder _ (0, "Select a folder:", 0, "Desktop") Set ffolder = txtfolder.Self pathfortxt = ffolder.Path Dim RegEx : Set RegEx = New RegExp RegEx.Pattern = "[^A-Z0-9_]" RegEx.IgnoreCase = True RegEx.Global = True Set tfile = fso.CreateTextFile(pathfortxt & "\" & RegEx.Replace(url, "_") & "_source.txt", true) tfile.Write sauce tfile.Close End If End Function
_____________________________
dm_4ever
My philosophy:
K.I.S.S - Keep It Simple Stupid
Read Me:
http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff:
http://www.visualbasicscript.com/m_47117/tm.htm
(in reply to
seakip
)
Post #: 2
RE: saving -
9/9/2008 10:18:54 AM
seakip
Posts: 6
Score: 0
Joined: 8/14/2008
Status:
offline
thank you a lot, it works perfectly!
_____________________________
[ Seakip ]
(in reply to
dm_4ever
)
Post #: 3
If you found our site useful please link to us
<a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>
.
All Forums
>>
[Scripting]
>>
WSH & Client Side VBScript
>> saving
Page:
[1]
Jump to:
Select a Forum
All Forums
----------------------
[Welcome]
- - Forum Rules
- - Test Posting Messages
- - New Member Area/Introduction
[Scripting]
- - WSH & Client Side VBScript
- - WSH & Client Side VBScript Tutorial
- - Post a VBScript
- - Windows PowerShell
- - ASP
- - ASP.NET
- - Windows Script Components
[General Forum]
- - Other Programming/Scripting Languages
- - Suggestions & Feedback
- - Off-Topic Lounge
New Messages
No New Messages
Hot Topic w/ New Messages
Hot Topic w/o New Messages
Locked w/ New Messages
Locked w/o New Messages
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
Forum Software ©
ASPPlayground.NET
Advanced Edition
2.5.5 ANSI