Jump to content
Sign in to follow this  
Devil_Wolf

Need some help with Java Script

Recommended Posts

Is anyone good with Java Script?

 

I have recently begun a huge project that will eventually be used by the entirety of the USAF, and I have run into a few issues with some Java Script coding and could use some help. Anyone here know anything about JS?

 

Thanks for your help!

 

-Devil

Share this post


Link to post

Luckily JS is one of the easiest scripting languages :smile:

 

First you should explain what trouble you have and tell us about what you're doing.

 

Are you using JS for web browsers, games, servers, or what?

What are you trying to do with the code?
What's the issue that you're running in to?

Edited by Naught

Share this post


Link to post

Here's a little back story,

 

I built a Microsoft Access database for my guys in my intel shop, which has a ton of VB Scripting and macros and the whole nine. it ended up being distributed to a lot of the AF intel shops, and got the attention of some big wigs in leadership.

 

Since then, I have been asked to create the same thing, but web based to be distributed out AF wide to be used by everyone for another purpose.

 

I have gotten to a point where I am stuck, and here is what I need help on:

 

I have a webpage, which a lot of information gets posted to. I have a Java Script that will search the page, grab the information required, and open a dialog box with the information.

 

From there I have to manually copy it and paste it into Microsoft Excel.

 

I would like it to automatically copy the information and export or paste it into the Excel sheet, but I have no idea what the coding to do it is.

Edited by Devil_Wolf

Share this post


Link to post

http://excelbuilderjs.com/

http://innovatejs.wordpress.com/2012/08/29/introducing-xlsx-js/

 

for the pure javascript solution I'd consider one of those libraries, although, if it's going to be used on classified machines they might get jumpy about a library being used.

 

Me personally, i'd throw the copied information to the server via an ajax request then use PHP to create the file, then offer it for download.

https://phpexcel.codeplex.com/

 

 

That and similar solutions is about as far as the "automatic" side goes, alternative methods involve using Excel's built-in import functions.

Displaying the information as a table can be imported directly into Excel (Data->From Web),  you could use CSV, you could display the information as XML which excel supports importing.

Share this post


Link to post

The major issue I have, is that I cannot add new programs to the systems as they are classified government systems, so I have to work only with the Java built into Firefox, and Excel.

 

So it would probably have to be a pure java script solution.

 

Is there no simple JS code that will at least just automatically copy the information?

Share this post


Link to post

Just by the nature of JS and web browsers, it was built with the idea in mind to keep everything in a sandbox of sorts, so theoretically nothing should interact with the user outside of the web browser unless he or she downloads a file or authenticates a simple operation (like clipboard management, although I think some browsers like Chrome doesn't explicitly require authentication for simple clipboard operations).

 

So the extent of what you can do with JS is to either just copy the information to the clipboard and allow the user to paste it (or build a clipboard listener or button in Excel to do that automatically), download a file like Verox offered, or something else along those lines, but in no way should any modern browser allow JS to interact with Excel.

 

If you're interested in utilizing the clipboard method, check this: http://stackoverflow.com/questions/400212/how-to-copy-to-the-clipboard-in-javascript

 

Now Java (not JS) is a completely different beast which can interact with the client PC, as it's a full programming language and not just used for scripting, but I doubt they'll let you use that on their computers since you can do almost anything with it (it's not sandboxed like JS is).

 

Also, if you're using IE, take a look at ActiveX, which may provide something close to what you're looking for.

Edited by Naught

Share this post


Link to post

I figured that was going to be an issue.

 

I think they got tired of me building things in Java and locked it out from everyone except admins, so I am stuck to the embedded JS inside Firefox.

 

I can live with just the copy script and make the users paste themselves, Ill take a look at that site.

 

This project has become tough to do when I am locked out of all the needed tools

Share this post


Link to post

So the extent of what you can do with JS is to either just copy the information to the clipboard and allow the user to paste it (or build a clipboard listener or button in Excel to do that automatically)

 

 

So your saying to have the JS copy to clipboard, then a button in Excel that has a VB script to paste from clipboard?

Share this post


Link to post

HTML has saving blobs, you can use a flash file to generate an excel spreadsheet but it's doubtful it'll be installed or you can use the copy/paste method.

That's about all you can do.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...