How can I save a web page to a certain folder

P

PP

I have a work to save some webpages to folders named by date. Now I can
invagate to these pages but can't save them.
I have found this part of codes,Unfortunally it can't work as I have
supposed. Can anyone help me to check this codes or give me some
information about the use of Win32API
Thanks and best regars
The codes are as follows:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class SaveWebPage
require 'Win32API'

def initialize
@KEYEVENTF_KEYUP = 0x2
@SW_HIDE = 0
@SW_SHOW = 5
@SW_SHOWNORMAL = 1
@VK_CONTROL = 0x11
@VK_F4 = 0x73
@VK_MENU = 0x12
@VK_RETURN = 0x0D
@VK_SHIFT = 0x10
@VK_SNAPSHOT = 0x2C
@VK_TAB = 0x09
end

# Use IE's "save page as" menu selection (Alt, F, A, S)
def save_page
keybd_event = Win32API.new("user32", "keybd_event",
['I','I','L','L'],
'V')
vkKeyScan = Win32API.new("user32", "VkKeyScan", ['I'], 'I')

keybd_event.Call(@VK_MENU, 1, 0, 0)
keybd_event.Call(vkKeyScan.Call(?F), 1, 0, 0)
keybd_event.Call(vkKeyScan.Call(?A), 1, 0, 0)
keybd_event.Call(vkKeyScan.Call(?S), 1, 0, 0)
end
end
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top