Trying to append the Excel file through unix via command prompt - excel

What needs to be done?
I need to make a connection to the remote machine through UNIX, go to the shared drive, open an excel file, save it and close it. This needs to written in an script.
The file contains macros so they needs to be opened manually on daily basis, save it and close it. We plan to write a script that would run on daily basis and refresh this file automatically.
Where am i facing the issue?
Making a connection to the remote machine is done, after that i run certains commands:
1. Open the command prompt
2. cd the file path
3. Open the File
Now this is where the issue starts
How to save the file automatically?
How to close that file?
I tried using the taskill option and it almost worked but it gives out the popup of Do you want to save the file and i dont know how to provide output to that popup through command prompt.
Let me know if you have any idea on how to move ahead on this.

A bit hackish, but xdotool, a program which simulates mouse clicks and keyboard presses could be used. If Windows is being used, then see this question for tools which simulate mouse clicks and keyboard presses.

Have you tried SendKeys?
That may help.

Related

NEdit_How to use the Shell on NEdit to save the file - LINUX base

I am working on the script on NEdit with LINUX environment.
But I can't reach one of the funciton of the script.
*I would like to add "save" file function at the script, but it seems not possible.
I checked the NEdit Help document, it mentions the "Make Backup Copy" function is UNIX only.
Not sure anyone has experience on it? -> To automatically save/backup the file after you call the script with LINUX environment.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Make Backup Copy
On Save, write a backup copy of the file as it existed before the Save command with the extension .bck (Unix only).
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
https://www.doc.ic.ac.uk/lab/labman/nedit/n6.html
Are you using the macros or the functions?
save() just saves the current file (same as Ctrl-S)
save_as_dialog() will bring up a dialogue to save the file
You can put them in buttons from the macro menus or you can define a functions and then add that function to a macro button.

Run Command Instructions to open and save excel file

I am using the run command. It starts with
Start Excel.exe "Filepath\FileName.xls"
This opens the file. A popup appears, and asks if you would like to update the links.
I need to know what commands in the run commands to use that would:
Tab and select "Don't Update", then save and close the file.
(this will be refreshing data that was just input into the file from Alteryx)
Thanks for any help you can provide.
It may be possible to do this altering the Excel settings, this is outside of the command line.

Automate "Right-click + Print" on .xlsx files

I need to automate the act of printing .xlsx file.
I have already seen some answers to this task saying that it is possible by creating a VBA script, as well as some examples. That is not about what my question revolves around.
Thought, I know that it is also possible to right-click on a .xlsx file and click "Print", which does the exact task that I want. It opens Excel, prints the file to the default printer, then closes Excel. (Windows 7, by the way)
So I'm thinking that the work has already been done here.
What process is launched when clicking this "Print" option? Can it be launched via command line, or "clicked" by a python script or something? And if not, why? How can something so easy to click be impossible to automate? I assume a process of some sort must be launched in some way.
Found it!
This task can be easily launched using python.
import os
os.startfile('C:/path/to/the/file.xlsx','print')
This code will launch the same print task. From there, it is pretty trivial for a python developer to automate the task in his scripts.
However, if you do not know much about Python and do not want to learn it now, an easy (or lazy?) way to add it in any automation script would be to save the two lines of code above in a whatever.py file, and launch it via command line (with Python installed, of course).
The context menu print command for Office documents utilizes Dynamic Data Exchange (DDE) and does not directly run a command that can be replicated from the command line.
You can view the content of the commands in the registry. Browse to HKEY_CLASSES_ROOT\.xlsx and look at the (Default) data column. On my machine, "Excel.Sheet.12" is the type of a .xslx file. Then browse to HKEY_CLASSES_ROOT\Excel.Sheet.12\shell\ to see the commands registered for that file type. On my machine, the Print (Default) is "C:\Program Files\Microsoft Office\Office16\EXCEL.EXE" /dde and the "command" is zn=BV5!!!!4!!!!MKKSkEXCELFiles>]-z5hw$l[8QeZZR4_X=$ /dde, none of which is directly useful or accessible for running from a command line.
It will require another program to allow you to access the interface, but there are programs that allow you to make use of DDE from the command line. I recommend Freddy Vulto's Class Exec. More information and a few other similar utilities can be found here.

I've downloaded an .exe file but it closes quickly as it opens

I am trying to open a downloaded .exe file but it closes as soon as it opens. Is there any possible way so that I can open it for a longer duration to read the content.
It's probably a console application rather than a GUI application. Use the command prompt to run the .exe.
Do the following...
Hold down your Windows key on your keyboard and then tap "R".
This will bring up the Run dialog. Type in "cmd" (without the quotes). Hit enter.
(this will work in all Windows versions - browsing the start menu/screen differs in each version)
If you saved the file to c:\downloads and it's called myFile.exe, type
C:
cd C:\Downloads
myFile.exe
Some of the steps are a bit redundant - if you know what you're doing in the command prompt then skip as needed (but then you probably wouldn't be posting this question). This will work even if you saved the file to D:\downloads.
Another example - if you saved the file to D:\folderA\Folder with a space\ and the file is called "my file with a space.exe" then type
D:
cd "D:\folderA\Folder with a space"
"my file with a space.exe"
If there is an issue (eg it's a 64-bit executable and you're on 32-bit Windows) then you may get a better error message at the command line.
There are so many reasons why the executable does not run. Here are some ways to check what is going wrong:
Is it your .exe? Do you known the "normal" behavior?
When you download it manually, it the result the same?
Do you download the .exe manually or via your application?
Do you see any problem in your Windows Event Viewer?
Is it the same result if you try to download the .exe via different browsers (IE, FF, ...)?
More details are welcome!
The nuget.exe file is not a console GUI application but rather a console package. Once you've downloaded it, you'll want to place it in a folder outside your Downloads folder. For example, C:\NuGet\nuget.exe - then set it as a PATH variable so that it's executable from anywhere.

Dreamweaver command to set location of fileview

is there a way to locate a specific file in the fielview of director via a shell command?
I open a file (test.php) like this in dreamweaver, using an other application:
"C:\Program Files\Dreamweaver.exe c:\test.php"
But the fileview listing the local files does not jump to the opened file.
Maybe I can write a script and launch this script via shell to locate the file in the fileview?
Thanks for help or hints!
I assume that you're talking about having the file opened via the command line automatically become selected in the Files panel.
I am aware of no documented method of getting Dreamweaver to perform operations from the command line.
About the closest you're going to easily get to would be to assign a keyboard shortcut to Site -> Locate in Site via Edit (Dreamweaver on Mac?) -> Keyboard Shortcuts. I'm not aware of it, but there may be some way to send an a specific application keystrokes via the command line.

Resources