I am working on a selenium testng frame work where I am downloading the Excel file, but as it is opening automatically I am not able to execute further script, is there any way where this file does not open automatically or opens in background?
Related
I am trying to open multiple notepad files using Python script. I was successful with opening one using import subprocess and subprocess.call method and specifying the file path. However, this doesn't work for opening multiple notepad files. The second notepad opens only after I close the first notepad.
Script that I use for opening One Notepad (this works well):
import subprocess
subprocess.call(['cmd.exe','/c','D:\Folder1\Notepad1.txt'])
Script that I use for opening Two Notepads (this doesn't work):
import subprocess
subprocess.call(['cmd.exe','/c','D:\Folder1\Notepad1.txt'])
subprocess.call(['cmd.exe','/c','D:\Folder1\Notepad2.txt'])
I was expecting to see both the notepad files getting opened in multiple windows, but the second one opens only after I close the first notepad.
I have created an Excel file from delimted text file using awk in linux terminal transferring the same to windows. when opened it shows a pop-up "This file might be corrupted or unsafe.would you like to open?"But on tapping yes I could see data everything is fine as expected.How to avoid such pop-up.
I have tried to convert to .xlsx then I couldn't even see the data
I tried to zip and send then unzip same warning popsup
My guess as to what is going on is that the incoming Excel file is still basically a Linux file, but MS Office, being flexible, is allowing you to open it. For a one time fix, try the following steps from Windows Excel:
Open the Linux Excel file (some_file.xlsx)
Save as another file name (some_new_file.xlsx)
Close Excel
Delete some_file.xlsx and rename some_new_file.xlsx to some_file.xlsx
Now try opening the file again, and hopefully the error message will have gone away.
At work I use a tool that requires me to download a .xlsx file, open it, then save it to remove the workbook protection. I'd like to create a script that automatically opens and saves any .xlsx files that are saved in the downloads folder.
I'm assuming PowerShell is the right tool to use. I found this article that explains how to do something similar, but I need help with configuring the parameters.
https://social.technet.microsoft.com/Forums/scriptcenter/en-US/1faa97e0-2288-4bb2-b8ad-283df32779d4/can-i-open-an-excel-workbook-when-files-with-a-certain-extension-are-saved-in-a-specified-folder?forum=ITCG
What I need is for the script to monitor the $env:USERPROFILE\downloads folder for any .xlsx files. Then I need it to open that file in Excel (preferably in a minimized window), save it with the same filename, then close Excel.
You can use IO.FileSystemWatcher to monitor a directory. See Start-FileSystemWatcher for an example implementation in PowerShell.
While it is possible to run a datanitro script via VBA, this still requires excel to be open. Is it possible to have a .py file that executes datanitro (like opening and closing an excel file) without a human needing to be present to open excel and execute the script?
If it isn't possible yet is it in the works?
DataNitro needs to have Excel open before you can run it, but you can have a script start automatically when a workbook is opened (https://datanitro.com/docs/scripts.html#autostart).
You can combine that with a Python script (outside of DataNitro) or other script to open and close the Excel file and launch the process automatically.
I am having problems opening an existing Excel file with Tcl Tk. I am able to open an existing MS Word file with no problems. The code that I am using is as follows, also my test application has "package require tcom" included:
proc OpenFile {} {
#Path to file
set app [::tcom::ref getobject "C:\\Users\\Me\\Desktop\\Test.doc"]
#Change path to application
set this [$app Application]
#Open application
$this Visible 1
}
This code is executed by a button. Basically, Test.doc gets opened after the button is pressed.
I tried changing the file to an existing Excel file, and when I press the button the file opens for a split second, and then closes. This also happens with MS Access files, as well.
Does anyone know how to open an existing Excel file with Tcl Tk, and make it stay open? Additionally, for PDFs and text files, I understand that I cannot use Tcom to open these files. Does anyone know how to open PDFs, text, and other non-MS files with Tcl Tk?
I really appreciate your help!
Thank you,
DFM
Assuming you're on Windows and you just want to open a file (.xls, .pdf, ...) with its usual application (ie. not modifying the file from your script) you can just use "start" like this:
set TestDoc "My Test.xls"
eval exec [auto_execok start \"\" [list $TestDoc]