473,597 Members | 2,076 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to call basic browser functions?

I think this is a very basic question, so feel free to direct me to a
FAQ or other resource to go and get myself educated, if that's the best
answer.

Can I perform web browser functions from a script, for example, doing
file downloads, if I can construct the file URL within my script? As an
example, suppose there's a file I download periodically, but its URL
changes with the current date. If I can write a script that will
automatically generate the URL, can it then go and fetch the file for me?

thanks in advance,
Bruce
Nov 5 '05 #1
2 1325
BLElliott wrote:
I think this is a very basic question, so feel free to direct me to a
FAQ or other resource to go and get myself educated, if that's the best
answer.

Can I perform web browser functions from a script, for example, doing
file downloads, if I can construct the file URL within my script? As an
example, suppose there's a file I download periodically, but its URL
changes with the current date. If I can write a script that will
automatically generate the URL, can it then go and fetch the file for me?


Yes, you can definitely do that. Look for examples of using "urllib" or
"urllib2". There should be many that are close to the sort of thing you
want. Or you could simply use a command line utility such as "wget" to
accomplish much the same thing and avoid almost any programming.

(Note that if in addition to downloading the actual contents of the
page, you will require more sophisticated features of a real browser,
such as Javascript or Java execution, you'll need capabilities far
beyond what urllib2 can provide. And you probably don't want to go
there right now.)

-Peter
Nov 5 '05 #2
Great! I've never looked in to the urllibs before, but it sounds like
they're just what I need. And no, I'm not thinking of anything so
sophisticated as executing applets or anything -- just those "Save * as
...." functions, where * might be "page", "image", "link target" etc.

I also hadn't known about wget, so that's good to know, too.

thanks!
- bruce

Peter Hansen wrote:
BLElliott wrote:
I think this is a very basic question, so feel free to direct me to a
FAQ or other resource to go and get myself educated, if that's the
best answer.

Can I perform web browser functions from a script, for example, doing
file downloads, if I can construct the file URL within my script? As
an example, suppose there's a file I download periodically, but its
URL changes with the current date. If I can write a script that will
automatically generate the URL, can it then go and fetch the file for me?

Yes, you can definitely do that. Look for examples of using "urllib" or
"urllib2". There should be many that are close to the sort of thing you
want. Or you could simply use a command line utility such as "wget" to
accomplish much the same thing and avoid almost any programming.

(Note that if in addition to downloading the actual contents of the
page, you will require more sophisticated features of a real browser,
such as Javascript or Java execution, you'll need capabilities far
beyond what urllib2 can provide. And you probably don't want to go
there right now.)

-Peter

Nov 5 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
5169
by: Bruce W...1 | last post by:
I'm a PHP newbie coming from experience with ASP.NET. I want to have a separate PHP file to support each HTML PHP page. This would be the equivalent of an ASP.NET code-behind file but using PHP. For one page to do a variety of different things I need to call different methods (or functions) in the PHP code file that is dedicated to this purpose. How do you do this? How do you call just one method? Thanks for your help.
9
6822
by: glm | last post by:
I'm a web developer (cold fusion, php, access, mySQL). A client would like for me to build a windows based app for him. I have suggested that he keep it web-based but he insists that it be available on unconnected desktops. (It is catalogue of items. Selecting an item will display information regarding that item. -- It does get fairly involved but that is the essence of project.) -- The app will need to tie into a database. Access would...
5
2670
by: Sue | last post by:
After finishing up my first quarter JavaScript on 12/12/03, I decided to improve character checking on my project. In my project I only had to do very basic validation. Therefore, I only had one function to verify the name fields, age, email and gender. My question is: if I create a function for each field like the code below, what would be the best way to organize the functions and call them? Would I need one main function and place...
13
1567
by: Mike Qin | last post by:
Hi there, Now I'm writing code mainly in C++. And some existing c code will call some functions which are in a C++ class. I read the basic techniques introduced from a SUN's web site. Basically 1. we can add extern "C" keyword, or 2. use the object in C++ code as struct in C.
39
6507
by: Randell D. | last post by:
Folks, I'm sure this can be done legally, and not thru tricks of the trade - I hope someone can help. I'm writing a 'tool' (a function) which can be used generically in any of my projects. When it completes, it can call a success, or a failure function. The names of these success, or failure functions will differ, and I'd like to know how I can pass the name of a function to my tool, and how my tool can call the function, using that...
7
5886
by: Tim ffitch | last post by:
Hi I have created a VB dll file that contains common functions I use across various projects in VB, Access and Excel. Rather than have to code the functions in each I decided to use the dll route. The problem being that I can't call these functions from the query designer in Access. I decided that I would try the route of declaring the functions from the dll file the same way you would for the Windows API. Access then complains that...
13
3017
by: usenet | last post by:
How and where can one find out about the basics of VB/Access2003 syntax? I am a died in the wool C/C++/Java Linux/Unix programmer and I am finding it difficult to understand the program format for accessing objects, controls, etc. in VB/Access2003. In particular where will I find explanations of:- Actions, Functions, Methods, Properties - I'm understand the
46
3819
by: Steven T. Hatton | last post by:
I just read §2.11.3 of D&E, and I have to say, I'm quite puzzled by what it says. http://java.sun.com/docs/books/tutorial/essential/concurrency/syncrgb.html <shrug> -- NOUN:1. Money or property bequeathed to another by will. 2. Something handed down from an ancestor or a predecessor or from the past: a legacy of religious freedom. ETYMOLOGY: MidE legacie, office of a deputy, from OF, from ML legatia, from L legare, to depute, bequeath....
19
1725
by: Prisoner at War | last post by:
Okay, Folks, I guess my real burning concern all along is a "high-level" one: just how does JavaScript interact with CSS? Right now, my newbie self only knows JavaScript and CSS to *co- exist*...but I'm beginning to get the sense that they actually interact -- or, perhaps more precisely, JavaScript acts upon CSS...but how, exactly??
0
7965
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7884
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8270
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8258
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6683
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5423
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3922
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2394
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1230
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.