How to control or edit text that is copied from a web page (for good, not evil reasons) - webbrowser-control

My web application allows members of the university to lookup and display their university ID number. It displays that number in an agreed upon format 99999-9999 which was picked to help distinguish it from, say, a Social Security Number, and to make it a bit more readable and easier to memorize. Unfortunately there are a few downstream applications that, for whatever reason, do not cope with the dash and expect a 9 digit integer. This becomes a problem when users, quite reasonably, use cut and paste to capture their ID number from my app and plug it into the afore mentioned brain dead app. I am unable to fix, nor can I apply pressure to have fixed, the brain dead apps, while I am being pressured to remove the hyphen. But before I do that, is there some straightforward, reliable technique that would somehow allow the user to see the ID number with the hyphen, but cause the number without the hyphen to be captured with a browser copy/cut operation?

Of course you can, now are you wanting to copy it from your web browser control or from an external internet explorer window? If external IE window, then you will need to get a reference to this window, which can be done using the windows title, then using that reference (or, if in a web browser control, directly using your web browser control), you can search for the element where that id resides in either by tag / element name, or tag / element id, or other means (ie: you will need to figure out if its in a div tag or span tag etc)... Once you find it, get a reference to it, probably using IHTMLElement to declare your reference type... And you'll be able to either copy it and do some string manipulation on it and store it wherever you want, or you can just update the live value on the page with the new value (live editing on the page the user is seeing, to change the elements value by copying id, removing hyphen from copy in a string variable, and then assigning it back to the element we got it from).
You can use the elements .value property to read from and assign to the element, depending on the element, but most elements use .value or innertext, once again, depending on the tag/element :).
Let me know if u need some code you will need to tell us what element we are dealing with, or the HTML sample of what surrounds the student Id you want to play with.

Related

An extension for Apple's Look Up

I am learning French. Every time I use the Force Click on my Mac on a word I don't know, I get a dictionary entry and a translation to English.
But when I want to translate a whole sentence, I have to open Google Translate to do so. (1. Open Google Translate. 2. Copy sentence 3. Paste Sentence) It is pretty annoying to do that 20-30 times a day.
So is there a way to expand the capabilities of Force Click in Safari (or in the best case, in every application which allows "Look Up")?
Let me worry about how I can translate the sentences.
I am open for any kind of creative solution.
Here is the standard pop-up when I force touch
I don't think there is a documented way to achieve this on a force click, but you may want to look at Services.
Basically, you can create an application that provides a service, select some text, and then choose your application's Service menu item from the Services submenu in your Application Name menu (the one in bold where "Hide" etc. are).
The service will then receive a copy of the selection (in an NSPasteboard) and can do whatever it wants with that, or even change it.

How to develop inspect element tab for my Web Browser(Using VS2015 Community) in VB.NET

How to Develop inspect element tab section for my Web Browser which i've developed in VS2015 Community. Please help I'm searching this from last few days...
A suggestion for this could be using the TreeView Class which could potentially provide you with what you are looking for (If you're looking to create the 'Inspect Element' in it's entirety). If you just want the code then simply using the DocumentText WebBrowser Property would do that. Just having a TextBox and writing the document text into it, then you could make changes and then on a 'onFocus' Event on the WebBrowser you could have it write the edited text back to the browsers html code.
(I have done the second way before out of curiosity and it's obviously much simpler than the other way that i have suggested)
-
But with the TreeView :
You can dynamically add Nodes to that object.
Roots are 'Base' Nodes (Parents) and the and the Child, well, is obviously the Child of the Root Node.
(A node consisting of an actual name to call it by, a display name (text), and a tag for any extra info.)
But anyways, the TreeView would be the most work to do.
A few other things potentially worth your time to look at, if you chose to do either option, I've written below in a comment.

TranslateAnimation resetting views occasionally

I am busy developing my first android app which is essentially a bubble burst type of game.
So far everything works except when I want to update a text box with a score.
Views are moved using translateanimation and all works as expected as long as a simple .setText() is not used.
When this is added occasionally some views that have been moved around previously suddenly move back to their original position. Additionally some variables also are set back to their original value.
I have tried updating the score via asyntask as well as runonuithread but the same issue occurs.
Thanks
I sorted it out.
I had the text box which I use for the score in a seperate xml and in that xml I had a include statement pointing to another xml file which had all the controls which are used as bubbles/blocks.
By including the score text box in the same xml the issue was sorted out.
There must be some rules that Android has regarding animating/updating controls across two seperate layouts.

How do I make a Selenium test for a page with a textbox whose name constantly changes?

I am trying to create a test that can enter a username and password into a login form on a page. However, the textbox name changes on every load of the page, and so the test stops each time I run it.
How can I set up Selenium IDE so that it can identify the text box across refreshes?
I am assuming that the textbox only changes part of the ID and not the entire ID each time.
To work with this I would recommend using xpath like people have put above but make it more robust in that it only find that element each time.
e.g.
//input[contains(#id,'thePartOfTheIdThatNeverChanges')]
or
//input[starts-with(#id,'thePartOfTheIdThatNeverChanges')]
or
//input[ends-with(#id,'thePartOfTheIdThatNeverChanges')]
//form1 (3) - First form element in the HTML
Pulled from here as an example This is making use of XPath. In theory you can make use of XPath to focus on parsing the structure of the XHTML, however this is fairly fragile, so it's not necessarily a wise thing to do but it should take care of your issue.
Does the location of the text box change, or just the name?
You could use a css or xpath selector to get the text box if it is in the same place.
I would recommend CSS because -
a. for the readability
b. for the ease of access (and, in your case, maintainability).
I use firebug for accessing/formulating the CSS identifier.

spell check textfield

I am trying to get a spellchecker to check spelling in a text field as the user types. I am well aware that browsers such as firefox have this feature for textfields (but this requires a user to manually enable it in the right click menu.
The ideal script Im looking for would accept an id as a parameter, since the id for the field I want to be checked cannot change.
Thanks
My suggestion would to look at a predictive text tool, similar to the tag-finder that SO uses where you have a dictionary, and as a term is typed, you do some kind of AJAX-y lookup to see if they're typing correctly.
Adding a new word would be similar to adding new tags on SO - if the predicted word is not picked, add it to your dictionary.
I'm sure there are others who have done a similar task, though - and this suggestion might be harder to implement than in sounds in my head.