473,385 Members | 1,333 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to point only to Particular file for a particular action in JavaScript

144 100+
Hi friends,

I have a below code, which is opening a Excel file, then a Message box appears and "Y" button is pressed by default SendKey(not by keyboard) and then Excel file is showing the data. After that we are doing Save as Option and saving it as today.xls New file.

Expand|Select|Wrap|Line Numbers
  1. var myApp = new ActiveXObject("Excel.Application"); 
  2. myApp.visible = false; 
  3. var shell = new ActiveXObject("WScript.shell"); 
  4. shell.run('"C:\\ROME Literature Spreadsheet.xls"',1); 
  5. WScript.sleep(5000); 
  6. shell.SendKeys("y"); 
  7. myApp.ActiveWorkbook.SaveCopyAs("C:\\goon\\today.xls");  
  8. shell.SendKeys("%{F4}"); 
  9.  
Once the Excel file is opened and Message Box appears, "Y" keyword should be pressed only at that time. Some times if the any other user pressed "Enter" or some other Keyword(Which can be done through Keyboard) at the same time, then it will not show data. How to prevent that?

And in the below code which is doing SaveAs option

myApp.ActiveWorkbook.SaveCopyAs("C:\\goon\\today.x ls");

sometimes if there are Multiple Excel file is opened..it is getting confused and pointing to some other Excel file and it is doing SaveAs option in it

I want to point to "ROME Literature Spreadsheet.xls" only which is opened at that time.

Is it possible?

Thanks in Advance
Mar 9 '12 #1
0 1218

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: JeffFinnan | last post by:
Is there a way Netscape 4.x can be forced to select a particular file extension other than the default .html? =============================== <form name=form1> <input type=file name="fileN">...
3
by: newcomer | last post by:
Is there a way to check if a file exists in Javascript? This is what I'm trying to do: if(thisfile.htm exists) do this else do that
0
by: Manish | last post by:
I have tried uploading a file using the code as //-------------------------------------------------------- // Main File <form action="importaction.php" enctype="multipart/form-data"...
3
by: SM | last post by:
Hello, Im trying to access elements in my XML file using the JavaScript DOM but i'm not sure how. I use AJAX to access the XML and then use the responseXML property to access the XML file data. I...
4
by: AshishMishra16 | last post by:
HI friends, I am using the Flex to upload files to server. I m getting all the details about the file, but I m not able to upload it to Server. Here is the code i m using for both flex & for...
0
by: Jason Huang | last post by:
Hi, In my C#.Net 2.0 web application, the web ServiceWeb application is running on the C:\Inetpub\wwwroot\MyWeb folder. I have another file server which store the files for downloading, through...
13
by: marfola | last post by:
I’m trying to find the file size using javascript, before it get uploaded into the server using the following Javascript (I don’t want to use ActiveX because of compatibility problem). function...
6
by: mitchell | last post by:
hi i was trying to delete a file in a javascript function but couldn't do it. myActiveXObject = new ActiveXObject("Scripting.FileSystemObject"); file =...
3
Frinavale
by: Frinavale | last post by:
Hi there! I'm hoping that someone knows how to check the size of a file before it is uploaded to the server using JavaScript. I have seen suggested solutions using an ActiveX control to check...
4
by: gingernob | last post by:
I could not get my head round filesystemobject syntax and more importantly how to add this to db. Can you explain in filesystemobjectexample posted, how do i define only to search for particular...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.