No.
But, there two ways to do this I think:
1. way to work around this limitation would be to setup Apache and your hosts file so that http://your-file.lan/your-file.txt for example. This req's that you're able to setup Apache on your machine however.
2. Setup an FTP server on your machine and use that address.
Erik
--Hello all,
Is it possible to open a local file from GM script? I want to read a text file which is locally stored on my machine.
- Jyothi
You received this message because you are subscribed to the Google Groups "greasemonkey-users" group.
To post to this group, send email to greasemon...@googlegroups.com.
To unsubscribe from this group, send email to greasemonkey-us...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/greasemonkey-users?hl=en.
--
You received this message because you are subscribed to the Google Groups "greasemonkey-users" group.
To post to this group, send email to greasemon...@googlegroups.com.
To unsubscribe from this group, send email to greasemonkey-us...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/greasemonkey-users?hl=en.
I have already referred to this link. But my doubt is how do I get the value that is loaded in the other tab (which is my local file) ?
I hope you got my doubt.
On Tue, May 25, 2010 at 6:35 PM, Anthony Lieuallen <aran...@gmail.com> wrote:
On 05/25/10 02:29, jyothi panidarapu wrote:
. how to use GM_setValue()..
http://wiki.greasespot.net/GM_setValue
-- cc | pseudonymous | <http://carlclark.mp/>
--
You received this message because you are subscribed to the Google Groups "greasemonkey-users" group.
To post to this group, send email to greasemon...@googlegroups.com.
To unsubscribe from this group, send email to greasemonkey-us...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/greasemonkey-users?hl=en.
The steps are roughly as follows:
1) Write a script that runs on a given page (or http://* for that
matter) and the file:
@include http://www.mysite.org/*
@include file:///d:/some/folder/filename.txt
2) Load the file into a tab. The script runs by virtue of the second @include
3) The scripts checks the url is running on; since it is 'file:...' it
proceeds to read the content of the page:
var valueFromFile = document.body.innerHTML (or similar)
and stores the value as a preference
GM_setValue ('MyValue', valueFromFile)
4) When you load a page from www.mysite.org, the script also runs. In
this case, upon having checked that the url is not that of the second
include, the sripts loads the value:
var storedValue = GM_getValue ('MyValue')
This is the basic mechanism. Now come the details:
a) you must check and update the stored value periodically, that means
that you have to reload the file:/// url every X seconds; I suggested
doing that by firing a self-callable function via setTimeout; you have
to do this when the url is file:///; after reloading the file, the
above logic would apply again and the new value would be written to
the preference.
b) you must also periodically check whether you have to reload the
non-file page because of a changed IP. To this end, after having
checked that the url is not the second @include and read the stored
value, the scripts decides based on the value whether a page reload is
necessary. If yes, it causes a reload (use
document.location.reload(true) to reload from the server);
There are still a number of details to solve, as to whether to open
the file url manually or via GM_openInTab, and to check if a reload
has been just triggered in order to prevent an infinite reload loop.
These are left as an exercise to the reader ;-)
http://groups.google.com/group/greasemonkey-users/browse_thread/thread/21ad5af3c7cc4b00
Here you can find some inspiration:
http://groups.google.com/group/greasemonkey-users/browse_thread/thread/21ad5af3c7cc4b00
--
You received this message because you are subscribed to the Google Groups "greasemonkey-users" group.
To post to this group, send email to greasemon...@googlegroups.com.
To unsubscribe from this group, send email to greasemonkey-us...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/greasemonkey-users?hl=en.
Healthcare.com : Request Health Insurance Quotes Leading Health Insurance Providers
http://click.lavabit.com/?r=MTYyNjA5
I have installed and tried it. There was no affect after installation. Can somebody tell me what's wrong with it?
On Wed, May 26, 2010 at 6:23 PM, jyothi panidarapu <jyothi.p...@gmail.com> wrote:
I am including the script that I have written, please tell me if something is wrong. I haven't installed yet, before that I have read up how to test it.
// ==UserScript==
// @key value
// @name : Reload the page if there is any change in Ip address of the system
// namespace
// @Description:
// @include http://*
// @include file://*
// ==/UserScript==
window.setInterval("checkIpChange()",2000); // Call the function every 2 seconds
var protocol= location.protocol;
var pattern= file:
function checkIpChange()
{
protocol= location.protocol;
if( protocol.match(pattern)
{
window.location.reload();
}
else
{
GM_xmlhttpRequest(
{
method: 'GET',
url: 'http://localhost/readValue.txt', // file which contains the value
headers:
{
'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey',
'Accept': 'application/atom+xml,application/xml,text/xml',
},
onload: function(responseDetails) //My text file entry would be either '0' or '1'
{
/*alert('Request for Atom feed returned ' + responseDetails.status + ' ' + responseDetails.statusText + '\n\n' +
'Feed data:\n' + responseDetails.responseText);*/
change= responseDetails.responseText ;
if(change==1)
{
window.location.reload();
}
else
{
//Do Nothing
}
}
}
);
}
}
Thanks
Jyoti
On Wed, May 26, 2010 at 12:11 PM, cc <carl...@lavabit.com> wrote:
Give it a go, it should work. (Also, in general: it's often faster just to try a naive test, and if it works, you're golden; asking the group takes longer and more of our time.)
On 2010-05-25 23:35, jyothi panidarapu wrote:I have a small doubt.
if I load the text file on my local web server, can I read the value of it using GM_xmlhttprequest() ?
http://localhost/myfile.txt
On Wed, May 26, 2010 at 11:28 AM, esquifit <esqu...@googlemail.com> wrote:
Here you can find some inspiration:
http://groups.google.com/group/greasemonkey-users/browse_thread/thread/21ad5af3c7cc4b00
-- cc | pseudonymous | <http://carlclark.mp/>
On 2010-05-29 08:44, jyothi panidarapu wrote:This line should beI have installed and tried it. There was no affect after installation. Can somebody tell me what's wrong with it?
On Wed, May 26, 2010 at 6:23 PM, jyothi panidarapu <jyothi.p...@gmail.com> wrote:
I am including the script that I have written, please tell me if something is wrong. I haven't installed yet, before that I have read up how to test it.
// ==UserScript==
// @key value
// @name : Reload the page if there is any change in Ip address of the system
// namespace
// @Description:
// @include http://*
// @include file://*
// ==/UserScript==
window.setInterval("checkIpChange()",2000); // Call the function every 2 seconds
window.setInterval(checkIpChange,2000); // Call the function every 2 secondsas otherwise it will try to call an undefined function. (See http://wiki.greasespot.net/Avoid_Common_Pitfalls_in_Greasemonkey for more detail, specifically the Auto-Eval Strings section.)
Not sure what this line is trying to do, exactly. Maybe something got left out in copy+paste?
var protocol= location.protocol;
var pattern= file:
Are you really requesting Atom and XML? It seems like this would be more likely to require text/plain.
function checkIpChange()
{
protocol= location.protocol;
if( protocol.match(pattern)
{
window.location.reload();
}
else
{
GM_xmlhttpRequest(
{
method: 'GET',
url: 'http://localhost/readValue.txt', // file which contains the value
headers:
{
'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey',
'Accept': 'application/atom+xml,application/xml,text/xml',
No, I just want to access the text.
--
You received this message because you are subscribed to the Google Groups "greasemonkey-users" group.
To post to this group, send email to greasemon...@googlegroups.com.
To unsubscribe from this group, send email to greasemonkey-us...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/greasemonkey-users?hl=en.
// ==UserScript==
// @key value
// @name : Reload the page if there is any change in Ip address of the system
// namespace
// @Description:
// @include http://*
// @include file://*
// ==/UserScript==
window.setInterval("checkIpChange()",2000); // Call the function every 2 seconds
function checkIpChange()
{
GM_xmlhttpRequest(
{
method: 'GET',
url: 'http://localhost/readValue.txt',
headers:
{
'User-agent': 'Mozilla/3.5 (compatible) Greasemonkey',
'Accept': 'text/xml',
},
onload: function(responseDetails) //My text file entry would be either '0' or '1'
{
alert('Request for Atom feed returned ' + responseDetails.status + ' ' + responseDetails.statusText + '\n\n' +
'Feed data:\n' + responseDetails.responseText);
change= responseDetails.responseText ;
Following is the modified code, still it didn't work. This alert box is not popping out. I am using firefox 3.5.3.
Do these API's work for this version of firefox?
// ==UserScript== // @key value // @name : Reload the page if there is any change in Ip address of the system // namespace // @Description: // @include http://* // @include file://* // ==/UserScript== window.setInterval("checkIpChange()",2000); // Call the function every 2 seconds
window.setInterval(checkIpChange, 2000); // Call the function every 2 seconds
function checkIpChange() { GM_xmlhttpRequest( { method: 'GET', url: 'http://localhost/readValue.txt', headers: { 'User-agent': 'Mozilla/3.5 (compatible) Greasemonkey', 'Accept': 'text/xml',
'Accept': 'text/plain',(Since this is running on the localhost, it's not likely to make much difference, if any, unless you set up an Apache instance or whatever to return different resource representations on different Accept header.)
Download MSN Messenger: Get MSN Messenger 2010 Instantly Includes 10,000 Bonus Smileys Free
http://click.lavabit.com/?r=MTYyNjQx