Fill in webforms / auto login in AutoHotKey in Crome - google-chrome

I want to open a couple of webpages. Some require User-name password. Others requires to fill in certain files in a webpage.
There are multiple ways for AutoHotKey to fill in web forms, but all are based on "com" which only works with IE
I've googled a while for examples in what fill in webforms and/or login in Crome, but found non so far. Does anyone has an example of an AHK script what fill in fields in a webpage/form

First off I'm going to start by stating that you should have included code, after all this is a code review site rather than a "Hey I need codez" site...
Now to answer your question:
You are correct, COM Objects are the best way to interact with Websites in Windows, it's dead simple and just works (in IE). Since Chrome doesn't support COM, you are left with only working with within the limitations of the browser accepting keystrokes.
Your best shot is to use the Send command to navigate to your target field (I believe sending Tab multiple times when the window is active should work) and than Send the data you wish.
I would also suggest looking into #IfWinActive and BlockInput so that you won't accidentally send an inappropriate key stroke while filling in these forms.
There may be better options for this, such as KeePass or the like. Also it's generally not a good idea to store passwords in plain text, IE within an AHK Script.

Correct, it's not possible to use Com objects with Chrome, however this site has a ton of entry level how-to's to get started with using the com object in IE. This includes how to send specific fields text (without using the send or sendinput commands), and how to triggers onclick events on existing elements (without clicking on them).
This was were I started when I needed to learn how to interact with the com object.
https://autohotkey.com/board/topic/64563-basic-ahk-v11-com-tutorial-for-webpages/

Related

Can I label browser tabs across-origins?

I have a number of embedded devices with a web-based front end, each on a different randomly assigned ip address.
I often want to check between these devices but, when they're open in different tabs, it is hard to tell which is which.
I have attempted to embed these pages in iframes with a header labelling each one, but CORS prevented the pages from showing.
Is there a way I could get the opening page to label a tab or window to help me distinguish between similar looking pages? Failing that, and possibly in SuperUser territory, is there any way I could manually label the tabs in my browser once they're open?
Here's a partial answer. There are a number of third-party plugins for Chrome which allow the user to manually rename tabs. I have installed one called Simple Tab Renamer and it seems to be doing the job.
An automated system would be nicer, but I suspect security policies would prevent that.
https://chrome.google.com/webstore/detail/simple-tab-renamer/ailhpmlejogfdcpoflidmobgkgdemaog

Communicating between a Chrome extension popup and an iFrame embedded in that popup

I have an iFrame embedded in my Chrome extension popup which displays a webpage that I am in control of. I am able to send data from the iFrame to the Chrome popup script using sendMessage from my embedded website and onMessageExternal from my popup script, but I would also like to send data the other way around (such as the extension id - I can’t access this value within an iframe).
I’ve read about methods such as using the window.postMessage() function available in HTML5, and have investigated the method discussed here, although I am not sure the second method would work in the context I intend to use it in. If I were to use postMessage, I would not be able to confirm that the message was sent by my extension as there is no domain for me to check against unless I hardcoded my plugin id in, which I would like to avoid.
Is there another method of doing what I am trying to do, or would postMessage be the best way? I want to avoid query strings to make it somewhat more difficult to send an illegitimate request to my webpage. I’m not doing anything with sensitive data, I’m just using the data to make changes to the behaviour of the webpage based on whether it is running in an extension or running natively in the browser, and using the extension id for logging purposes.

Disabling Copy & Paste from Safari Reader

I'm a Web Designer, and I have this client who runs a paid subscription blog site that has sensative content that he does not want copied and shared (hence the paid subscription).
I've recently been able to successfully disable all ability to copy the content from the actual webpages (using a wordpress plugin, and also targeting some elements using css -webkit-user-select set to none)
But more recently I've become aware that you are still able to copy and paste all of the content if the user views the webpage using Safari's Reader. Is there anyway at all to diable the user's ability to copy text from inside Reader?
I appreciate any feedback and help you can send my way!
Thanks!
You may try to implement various "tricks" to disabling copying. They have basically to do with preventing default actions when click-dragging to select text (google for jQuery preventDefault). You bind an action an then preventDefault on the event when the action is triggered.
You may also attemp to prevent-defaut some keystokes like cmd-c and cmd-a
But... as the page is delivered to the browser the text is on the user's machine. So all the techniques above can be circumvented.
In some browsers the tricks above may not work. Or, a smart user, may open the page source and extract the text.
You may go further, rendering the text to image server-side.
But a motivated user may rewrite by hand the text...
Conclusion: you can make more difficult for the average user to copy text. It's impossible to avoid it completely.
Hope this helps...

Read and Write to Access using a HTML webpage

Im quite new to HTML. What I am trying to do, is create a table in HTML (Which I have done with the standard table tags (table)(/table) etc...
The table has a number of headings, such as Name, Number, 10/10, Percentage, Option
(those aren't the exact titles but you get the idea)
The Name and Number heading is just text that won't change (the same for the text beneath these columns) Which is all fine and dandy, very easy to do.
The part I am struggling with, is part of the table that needs to be able to be edited and saved. In a nutshell, what I want 2 of the columns to do:
When the webpage is loaded up, display information that is stored in MS-Access or MS-Excel (So Automatically READ from file on page loadup)
When the user changes information on the webpage I want it to amend the data in the correct cells on the Access page, so overwrite it, As if you were typing something into Access yourself and clicking the save button.
Is this possible using HTML, Javascript and or PHP? Everything needs to be Clientside. The webpage is built, i'm Using Input type="text" for the text boxes in the table, and I was wondering if using (form) (/form) and some (Script) I could do this. I have searched on the internet and have found some examples where you can read and write to Excel but need ActiveX enabled on IE. It's a work computer and a task I have been asked to complete. There are no administrator privaliges on the system, and I can't enable ActiveX controls in IE so the other method did not work for me. Is there any other way?
You can't archive things like file access, reading and writing to databases's client side. You need to use a server side technology, incidentally, PHP is a server side technology and not client side.
Client side is everything that is run on the users browser, I.E. Chrome, etc. Server side is everything that is run within the web server, before the HTML is sent to the client.
I get the feeling your trying to run before you can walk here. You need to research how web sites work more.

mailto: links and webmail

Is there a way to implement a mailto: link that works with webmail clients?
Edit - so a traditional mailto link is (as I suspected) not going to work. So has anyone seen anything similar to those rss buttons you see with a variety of the most popular sites on?
The links are handled by the user's browser. GMail has a client-side install (GMail Notifier) that lets you specify that you want GMail to handle all mailto links.
But there's no way for a web page to specify that it's mailto link should be handled by a webmail app (even if it could, how would you know which one?).
That's really more of a web client issue, it's already available for Firefox:
http://starkravingfinkle.org/blog/2008/04/firefox-3-web-protocol-handlers/
but ultimately it's down to the user to decide how their browser handles mailto links.
Create a text file named MailtoWebMail.reg with the following content...
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\mailto\shell\open\command]
#="\"(BrowserExecutable)\" (Parameters)"
where (BrowserExecutable) is replaced with the complete path to your browser (ie. C:\Program Files\Internet Explorer\iexplore.exe)
and (Parameters) is replaced with the appropriate line for the mail service as described below...
GMail
"http://mail.google.com/mail/?view=cm&fs=1&to=%1"
Hotmail
"http://hotmail.msn.com/cgi-bin/compose?To=%1&mailto=1"
Yahoo Mail
"http://compose.mail.yahoo.com/?To=%1"
Netscape Mail
"http://webmail.netscape.com/compose.adp?mailto=%1"
Mail.com
"http://mail01.mail.com/scripts/mail/Outblaze.mail?composeto=%1&compose=1"
Opera Web Mail
"http://mymail.operamail.com/scripts/mail/Outblaze.mail?compose=1&did=1&a=1&to=%1"
Note: There should not be a blank line after the [HKEY_LOCAL_MACHINE] line
MikeB
I am just brainstorming here. You might be able attach a Javascript handler to the link that asks the user if s/he wants to login to a webmail account (along with a list of providers). If you have the correct URLs for the webmail providers, you would then be able to invoke them on the basis of the user's choice. If the user answers no, return true from the handler and presumably the link would work normally.
See, for example, http://toric.blogspot.com/2005/07/gmail-compose-link.html and http://blog.monstuff.com/archives/000238.html
Here are 2 Opera UserJS examples that you can inspect to give you and idea of how you can do it on a regular pages. (Obviously, UserJS-specific functions wouldn't work in a regular page, but you can use regular events.)
This one catches left-clicks on mailto links and opens them in Gmail for example. It can also handle forms.
http://shadow2531.com/opera/userjs/BeforeMailtoURL.js
This one catches all mailto actions, has a more generic parser (that supports any hname and not just to, cc, bcc, subject and body) and has a better format string syntax:
http://shadow2531.com/opera/userjs/BeforeMailtoURL.zip
Basically, you have to find a way to intercept mailto link actions. You can do this with click event listeners on links and submit listeners on forms (if you really want to support forms). (It's easier to use a click event listener on the whole window and just filter it to find mailto actions. That way, you catch mailto links that are dynamically added at some arbitrary time.)
Or, you can just run through the page and process all the mailto links.
But, if you want to intercept mailto actions in the address field, via window.open or document.location etc., you'll need something like HTML5's registerProtocolHandler or something like Opera's webmailprovider.ini support. You can use registerProtocolHandler in Firefox, but by default, it's restricted to the domain you set it on.
So, basically, you either convert mailto links to http(s) webmail compose URIs up front, or at the time the mailto action is invoked. The latter works much better.
Converting a mailto link to a webmail compose URI involves a few things. First, you need to know what query string variables the webmail accepts. Then, you need to parse the mailto URI to split it up into the parts you want. Then, you need to decode and re-encode (to normalize) those parts. Then, you need to join multiple occurrences of hvalues together. And, you need to handle things in a case-insensitive manner and check for and escape unsafe characters and %HH etc.
For the parsing, you can do a quick and dirty regex, but you'll get better results with a full mailto URI parser and normalizing functions.
So, if you just want to handle left-clicking on links, you can do that cross-browser. For more than that, you have to use any hooks the particular browser gives you.
Hypothetically, assuming the webmail client passes arguments through the authentication process (or the user is already authenticated), I don't see why this is so impossible. It can't be done in the simple mailto: way, but it'd be possible to provide a selection of links to popular webmail services and use Javascript to intercept clicks on mailto: links such that the user is presented with a drop-down list of possible webmail services (or their local email client). The links would carry the To:/Subject: address but formed in whatever structure that webmail service requires.
If you're using a Google Apps email account (hosted email), than Gmail Notifier will not work. You can use a bookmarklet though, to change all of your mailto: links to links that point to your webmail.
Here's a bookmarklet I wrote to do just that, it will highlight all fixed links in red.
javascript:for(var i=0;i<document.links.length;i++){var a=document.links[i];if(a.href.indexOf('mailto:')==0){a.href='http://mail.google.com/a/sample.com/mail?extsrc=mailto&url='+a.href;a.style.backgroundColor='red';a.style.color='white'}};return true;
Just be sure to change http://mail.google.com/a/sample.com to whatever the proper hosted address is for you.
I suppose this will work with a number of other email clients if you just change that link around.
Kind of an old thread, but nobody has quite answered it yet, so here goes.
As blesh nearly says above, while there's no way to get "mailto:" to go to Gmail, there's another way to skin this cat that works just fine in many situations. Just change the URL. Remove the "mailto:" prefix and insert "https://mail.google.com/mail/?view=cm&fs=1&tf=1&to=".
This seems to work like a charm, whether or not the user is coming in through Google Apps. If the user is not logged in, he'll be walked through that step, and then Gmail will still kick off a new message. The only downside I've noticed is that if (when?) Google decides to change their bookmarking scheme, this may need a bit of tweaking.
It may make sense to perform this transform either before or after the URL is in the DOM, depending on your situation.
Oh and double click the MailtoWebMail.reg to insert the command into your registry.
MikeB
Has anyone seen numbers indicating what percentage of webmail users have configured their systems with plugins etc. to properly have mailto: links sent to their browser / webmail system rather than to a desktop app? This seems critical in deciding whether to use mailto: links on a site or a contact form, but I'm having trouble coming up with numbers to guide the decision.