Transfer Text notes taken on a webpage into a word doc - javascript

I'm fairly new to HTML/CSS/Javascript etc so forgive me if I totally noob all over the place here. I'll provide as much context as I can to help you understand what I'm trying to accomplish.
I work in IT as an infrastructure incident mgr for a large company. While working incidents, we typically need to contact several people using 2 different web apps, take notes of what transpires in word, who did what to fix A,B,C or look up instructions regarding certain situations. I'm trying to build an application that consolidates all of these under a single pane of glass.
For the purposes of this thread, I'll solely be discussing the notes taking aspect which covers several areas. At my company for reasons outside the scope of this discussion, it was decided that notes would be entered into word and not the ticketing system. Why not something better? Its Above my pay grade, don't really care...
We use a word doc template that has predefined areas that you fill in as the incident progresses. Example:
Incident Ticket(s): INC12345
Problem Ticket(s): PMI12345
Change Ticket(s): etc
Vendor Ticket(s):
Date: 9/18/15
Incident Manager that started incident: Billy Jo
Incident Manager that ended incident:
Summaries:
Subject/Title (from Alert):
So I have a text area floated to the right of the page that I would like to do at least 2 things to start with:
Have it ask you every line of question in the template that you fill in the values for. i.e Incident ticket: inc11111. When you fill in the answer and hit submit, it populates that field in word.
There's a notes section at the bottom of the word template. I'm thinking of entering a notes only textarea that strictly populates that part of the template ALONG with timestamps from your computer clock.
I've searched the internet for several hours trying to find something highlighting how you might do this but only see office docs telling you how to copy and paste text into a word doc. Please let me know if you need any specific info

You want to have to your users input data via a web-based form, and you want this to result in creation of a word document. The missing link is the server application in-between.
You would create an HTML form as normal, with whatever fields / inputs / validations you needed. On submitting this form, the data would be sent to your server. Here you would need to implement a server application that accepts form based inputs and generates a file from them (in this case, a word document).
The process of actually generating the word documents is most likely not trivial, but also not impossible. A quick search for generating word docs on the server throws up a few resources:
Building Server-Side Document Generation
Create and Manipulate Word Documents Programmatically Using DocX
Generating a Downloadable Word Document in the Browser
Once the document had been created, it could either be offered for download, or automatically emailed somewhere.

Related

How could I create a one click hyperlink for websites like https://www.integral-calculator.com/ that automatically pastes into the Javascript box?

My web app generates Calculus I problems in Latex and non-Latex form.
I use these two websites to check my answers:
https://www.derivative-calculator.net/
https://www.integral-calculator.com/
E.g., I copy/paste the non-Latex form of the math problem log(v)/v**4 and put it into the Integral calculator website to understand the gaps in my knowledge that is stopping me from solving the problem independently on my own by hand writing/hand solving.
I am writing this post because I want to improve my web app and reduce the steps it takes for the user to check their answers to one of these calculators. Right now, the user has to copy the equation, click the website link, then paste the equation into the website Javascript box, and finally click "Go" to be able to see suggested steps to solve the problem.
I want to take some string the represents my equation (e.g. log(v)/v**4) and turn it into a one click hyperlink like https://www.integral-calculator.com/log(v)/v**4
A link such as this does not work, presumably because the website is using a JavaScript or MathJax feature.
You are correct in that, as these websites do not use URL parameters, you will not be able to generate a URL from within your app that auto-populates the required fields. Additionally, these websites do not appear to use any sort of publicly accessible API (they take form data and process the results on the server side).
My suggestion would be to use an existing public API to check results within your app. I believe Wolfram Alpha allows up to 2000 API calls per month for free.

Is there a reliable way to automatically detect buttons and confirm codes in emails?

I find the automatic copy-code feature for incoming text messages really nice on my phone and was hoping to implement something similar for my emails. So far I've been able to hook incoming emails into a function and parse them using node-imap, but I'm struggling with the actual code autodetection.
For example, some verification codes are 6 numbers/capital letters, like 123X4Y. Some are a bit shorter and some are much longer, so I arbitrarily wrote the regex \b[0-9A-Z]{5,12}\b (I start it at 5 because many emails have a copyright date at the bottom that is 4 numbers). This works decently well but doesn't capture all codes and occasionally captures irrelevant information.
Moreover, many times instead of a code the email just contains a big ol' "Confirm" or "Verify" button. In these cases I'm currently just looking for links with the words confirm or verify either in the link text or the href, but this also fails much of the time.
I was wondering if there was any way to more reliably capture action buttons and confirmation codes from emails!
There isn't a reliable way to detect buttons in emails without some sort of computer vision as they can take infinitely many forms (a filled in table cell with an anchor, a styled anchor, etc).
You can get the confirmation code with a little bit of NLP -- you could either take a naive approach and just look for keywords like "confirm" or "verify," or you could utilize an NER (Named Entity Recognition) model to identify confirmation codes in an email.
An alternative to NER, you could simply run a Naive Bayes classifier on an encoded vector of the subject line to identify whether or not the email contains a confirmation code. If you are able to identify that the email is a "confirmation" email, you can plug in your regex above and parse out the code.

javascript HTML jquery client-side freeform text search neocities.org

Recently I got a free account with the wonderful neocities.org.
They are one of the few free hosts that allow you to program your free site
in HTML/CSS/javascript/jQUERY.
No PHP
NO serverside programming.
So
I uploaded that one-megabyte freeform text file.
Why
I hope, I do not know how, to allow visitors of my site
to fill a simple form
(a substring, a boolean bunch of words a la google, or
- I know I am pushing it - a regular expression)
The answer returned should be
a window (or a frame)
that (after querying that freeform file I mentioned)
returning the LINES
that have the contents of that form.
Only those lines.
Well, may be with some highlighting of the search terms
a FILTER.
Certainly I do not need sql, or php, or java or ...
Help
I am still learnigng javascript. So sorry I cannot provide code.
What I wanna do is search a certain unstructured text file (one megabyte) that
I will upload to my free account on neocities.org.
(actually I want any visitor to my site to do the searching)
Kinda like having my own little custom Google (with search extensions: substrings, Booleans, regular expressions).
Any visitor to my site should be able to fill a simple form (e.g Great Britain)
and get rewarded with a listing of all the lines of my text file that contain
the query term (e.g Great Britain). But none of the lines that do NOT mention
the query term.
A filter.
Extra marks for highlighting/colorizing the query terms (e.g Great Britain).
Hope I have made my specs a bit clearer, now.

Making a Google Form which has a table for answer submission

I'd like to replace a parts requisition process at my workplace with a simple (and cheap to implement) electronic process, initiated using a Google Form. The problem is that I would like users to be able to enter multiple parts (along with associated info, e.g. quantities required, booking references etc.), but I want to do so without having to have multiple repeated questions.
I have researched this extensively and cannot find anything which fits the bill - my thoughts are to use Google Apps Script to create a table in the form which a user can fill-in. The closest I have found is something like this: Creating Form Elements Dynamically
The original paper form looks like the below - I would like the table to request the information as shown below in a similar format:
Thanks in advance!
EDIT! To make it clear, I'm happy to consider other solutions to run this process through an online interface - I have gone for Google Sheets/Forms in the first instance as they are already well integrated within my company and I have experience of them (setting-up triggers etc is pretty simple)
I understand the OP has probably long moved on from this problem. I however have done something along these lines in the past and thought I'd share my approach with the community.
I'll start with the premise Google forms are just good ol' plain HTML forms that users programmatically generate with their form builder. Therefore it's possible to traverse the as-built form and extract both submit location and all field names:
document.querySelectorAll('form').forEach((x) => {console.log(x.action)})```
document.querySelectorAll('[name^="entry."]').forEach((x) => {console.log(x.name + '=' + x.closest('[role="listitem"]').querySelector('[role="heading"]').innerText)})
The above snippet will give you an idea of what the components are.
All that's left after is to build a front end to your requirements with the framework of your choice (I used AngularJs at the peak of its popularity) and incorporate as much or as little UI and validations into it as you desire.
Here you've got the flexibility to either submit the whole thing as one JSON, or to parse it into individual fields and submit entries one by one, for purposes of this demo I opted for the easiest way but this thing surely's got the potential.

Regex from another domain?

I'm trying to make an automated process to retrieve some information from a site on my work network.
var duderegex = new RegExp("Title for Mr. [^\n]+","m");
var dude = duderegex.exec(input);
So far, so good. The problem is that I'm writing this on my work computer and probably won't be able to convince anyone to store this on the same domain as the site that is hosting it. So that technically makes it XSS. And I'd rather not have to get approval to install anything seriously funky (so I can't guarantee JQuery or a powershell that's easier to copy/paste from, for example).
I don't have any problems downloading files and manipulating them via webpage after download, but that adds a step clicking Save As...
Does anyone have any workable solutions for running regex on HTML source from a different domain? I don't need to limit it to Javascript, but getting PHP to work, for example, might require more resources than I have.
A commenter asked for clarification, so here goes. Let's say I have to contact 50 copyright holders a day (it has nothing to do with intellectual property but it will work). Right now, I have a form that takes me to
(1) http://foo.bar/form.htm?action=search&type=ArtistAlbum&Artist=Beatles&Album=White
and redirects to
(2) http://foo.bar/form.htm?id=4578469
From there, I click on a dropdown (let's say track listing), and that takes me to
(3) http://foo.bar/form.htm?id=4578469&track=7
There I have an alphabetical list of everyone who worked on the track, their agents, and legal representatives. I'm only interested in three names, the name of the person who holds the copyright of the lyrics, the name of the person who holds the copyright for the melody, and the name of the person who holds the copyright of the recording. So I have to search the document three times.
Since each name has a standard title, I should be able to write a script that asks for the artist and album, generates the link to (1), either copies the param from the url for (2) or uses a regex to find it from the link to (3), loads page (3), and then generates the output for a regex on the strings
/Lyrics Copyright Holder [^\n]+/
/Melody Copyright Holder [^\n]+/
/Performance Copyright Holder [^\n]+/
I could download all the files (it would take a long time), but the information changes on occasion, and I want to make sure I'm always pulling the newest information.
But I can't seem to get around the XSS bit.
You don't say what problem you're really trying to solve so it's a little hard to know what solutions make the most sense for you, but you can write javascript that works on any web page in a browser plug-in (like in Chrome or Firefox) or by using a scripting language outside of a browser (Python, Javascript, PHP, etc...) where you load the page contents and then manipulate the contents using the language tools.

Categories