Batch - Execute Macros from command line - csv

I have a macro done by LibreOffice Calc it's a french version of OpenOffice.
This macro opens a csv file without the dialog box. But I'd like to execute it via Batch.
The ideia is, use system() commmand in matlab to run this macro.
This macro is in addressed as Importcsv.ods --> Standard --> Module1 --> CSVOpen
How should I put the complete address of the file, and where put the name of the csv file I want to open?
Many thanks,
Bruno
PS: I'd forgot something. I want to run this in Calc and there, do anything I want. Because this file will be sabed in xls to be used in SolidWorks (CAD software).

I've continued looking for it, and I found an answer to execute the macro.
We should open the repertory in cmd where is the file with the macro ,put the address of the exe, write the name of it and the reference of the macros. I'll do an example:
"C:\Program Files\OpenOffice.org 3\program\soffice.exe" FileName.ods "macro:///Standard.Module1.MacroName"
if wanted directly from matlab, is just use the system('') command.

"c:\Program Files (x86)\OpenOffice 4\program\swriter.exe" -invisible "macro:///Standard.Module1.Main"
or from another source
"c:\Program Files (x86)\OpenOffice 4\program\swriter.exe" -nologo -norestore -nolockcheck "macro:///Standard.Module1.Main"

Related

How to run JM reference software using visual studio 2010

I have downloaded the H.264 source code and I can view it in Visual studio 2010. I don't know how to run the JM Reference software. How can I do that, and how to view the output?
First of all right click on the project in VS and rebuild solution.
After that from command prompt go to bin folder of JM reference software.
Which is in JM->bin.
Now write lencod.exe in command prompt.
This will run your encoder for default video file selected in encoder configurations. And same goes for decoder that is ldecod.exe.
For other encoding/decoding parameters read manual.
These slides will also help you to get started.
Firstly, I recommend you to download the latest JM reference software for H.264/AVC form this link. After downloading just click on jm_vc11.sln file (solution file) and it will open in Microsoft Visual Studio (MVS) as this:
Solution Explorer Image in MVS
Then from toolbar menu, click on Build>Batch Build and you will see something like this:
Batch Build in MVS
Then click on Rebuild button and it will compile and build all of the projects of this solution in your current folder. After seconds or so, you can go through a folder called "bin" in the current folder. In this folder you see lots of config files which are in .cfg format. Please open encoder.cfg file and you can see all the encoder configuration for you H.264 codec and at first lines of it there is InputFile name, FramesToBeEncoded, FrameRates and the deafult values is as this picture. Just please make sure the file "foreman_part_qcif.yuv" existed in the bin folder. Then just open command prompt (type cmd in windows search bar) and go to the current directory>bin folder where you can see lencod.exe file. Type this in your command line: "lencod.exe -d encoder.cfg" and it will encode your InputFile and generate test_ref.yuv as a reconstruction file that you can see the result of your encoding process. Also you can see your .yuv files using third-party apps like "yuvplayer". For decoding, Please open bin>decoder.cfg and check that the inpuFile is "test.264" and the output is "test_dec.yuv". Then in command prompt type: "ldecod.exe -d decoder.cfg" and the decoded output file will be generated as "test_dec.yuv" which you can play it in yuvplayer, for example.
For more details about the parameters of encoders and decoders please check the documentation file in your currnet directory>doc folder.

Loading icon from kit using twapi

I have a tcl script named main.tcl in a folder called App. One of the lines in the script uses a command from the twapi module (that line is actually in a proc and I'm trying to minimize the app to system tray when a user closes the app through the 'X' window button):
package require twapi
# ... code here
set hand [twapi::load_icon_from_file tclkit.ico]
# ... code here
The file tclkit.ico is in the same directory as the script (i.e. in the folder App).
When main.tcl is run through wish, the script works without any issues, but after wrapping it into an executable through command line,
> tclkit sdx.kit wrap App -runtime tclsh863.exe
the executable raises an error, notably that the icon file could not be found:
The system cannot find the file specified.
The system cannot find the file specified.
while executing
"LoadImage $hmod $path $type $opts(width) $opts(height) $flags"
(procedure "twapi::_load_image" line 18)
invoked from within
"twapi::load_icon_from_file tclkit.ico"
(procedure "min_to_tray" line 2)
invoked from within
"min_to_tray"
(command for "WM_DELETE_WINDOW" window manager protocol)
The current workaround right now is to have a copy of the tclkit.ico file in the same directory as the .exe but I want to avoid that as much as possible and only have the standalone .exe file. I tried using the full path with:
set hand [twapi::load_icon_from_file [file join [pwd] App.exe tclkit.ico]]
which normally works when I want to read a file (.txt, .png files, etc.) within the .exe, without success.
So basically, is there a way to enable the .exe to load the .ico file from within itself or another workaround that will not require some dependence on a file outside the .exe app?
The core issue is that the relevant Windows API actually takes a filename, and not something that it's more easy to wrap loading-from-archive around (such as a buffer). This means that you have to copy the file out of the archive somewhere and then pass that name to the system call. This is in fact what Tcl does internally for load when it's pulling the DLL from a source that isn't directly visible to the OS; it doesn't do it automatically for TWAPI though, as that library takes the philosophical position of being just a thin wrapper and letting the caller handle the consequences (which does mean you can easily do more tricks, provided you're inventive).
I suggest copying the file to a temporary file somewhere (i.e., the standard location for these things; Tcl 8.6 has file tempfile to help with this sort of trick) and then passing the full filename into the TWAPI call. I think everywhere in the Windows API that you could pass a simple filename in, you can also pass a full filename. (That's actually very convenient…)

IrfanView generate HTML file from Thumbnails in cmd

I try generate from IrfanView cmd interface HTML page from directory with Thumbnails, but I can't find any parameter or options, how I can do it.
I can generate Thumbnails via:
"C:\Program Files (x86)\IrfanView\i_view32.exe" "C:\Test\FullScreens\*.jpg" /resize=(100,100) /aspectratio /resample /convert="C:\Test\*.png
I can't find this in cmd:
It is possible to realize this?
Thank you, Regards,
  Peter
The text file i_options.txt in program files folder of IrfanView contains all options which can be used on command line. There is no option to create an HTML file. This must be done via GUI using the captured dialog.
But after creating the thumbnails for the images, it would be of course possible to create with a batch file also the HTML file using the commands echo, for, if and set with output created by several echo command lines redirected to the HTML file to create. Executing in a command prompt window help echo, help for, ... displays help on those internal commands of command interpreter cmd.
However, it would be a lot of work to create a batch file with all the parameters of the dialog. And it would make the batch file slower to really support all those parameters. A tailor-made batch file for creating the HTML file exactly like you want them would be much easier to code.
I suggest to try by yourself coding the batch file to create the HTML file. Create a new question with a link to this question, if you have somewhere a problem which you can't solve by yourself. Post in this question the batch code you have so far and the content of the HTML file created by IrfanView which should be instead created by the batch file.

Zip the contents of a folder in SSIS

I am trying to zip the contents of a Folder in SSIS, there are files and folders in the source folder and I need to zip them all individually. I can get the files to zip fine my problem is the folders.
I have to use 7.zip to create the zipped packages.
Can anyone point me to a good tutorial. I haven't been able to implement any of the samples that I have found.
Thanks
This is how I have configured it.
Its easy to configure but the trick is in constructing the Arguments. Though you see the Arguments as static in the screenshot, its actually coming from a variable and that variable is set in the Arguments expression of Execute Process Task.
I presume you will have this Execute Process task in a For Each File Ennumerator with Traverse SubFolders checked.
Once you have this basic setup in place, all you need to do is work on building the arguments to do the zipping, how you want them. A good place to find all the command line arguments is here.
Finally, the only issue I ran into was not providing a working directory in the command line arguments for 7zip. The package used to run fine on my dev environment but used to fail when running on the server via a SQL job. This was because 7zip didn't have access to the 'Temp' folder on the SQL Server, which it uses by default as the 'working directory'. I got round this problem by specifying the 'working directory as follows at the end of the command line arguments, using the -ws switch:
For e.g:
a -t7z DestinationFile.7z SourceFile -wS:YourTempDirectoryToWhichTheSQLAgentHasRights

SQLServer 2008 : Name of backup file

I have a SQL server 2008 and I would change the name of the backup file.
I use an SSIS package to perform my backups.
The file's name looks like
[DATABASE_NAME]_backup_YYYY_MM_DD_XXXXXX_XXXXXX
This is automatically generated by SqlServer, and I want to remove the "_".
How I can modify this ?
Thank you in advance,
Andy.
I have faced similar situation today and used following workaround.
Use "Execute Process Task" to rename the backup. I created a batch file with following command and executed it after the Database backup task.
ren BDNAME.bak DBNAME_%date:~-4,4%%date:~-7,2%%date:~4,2%.bak
Above command will rename DBNAME.bak file to DBNAME_yyyymmdd.bak
Keep the file in the same folder where you keep the backup file. In the Execute Process Task Editor, specify batch file name in the Executable property and the location of batch file in the WorkingDirectory property.
Hope it helps.
I believe that you can use the DestinationManualList for this, although I've never used it myself and I can't seem to find documentation or examples of it anywhere. It appears in the Properties list for the Backup Database Task, but not in the dialog for it.
I don't believe you can manual edit the DestinationManualList property. Right click on the task and select Edit. In the dialog that opens click on "Back up databases across one or more files" then click on the Add button. In the Select Backup Destination dialog click on File name and enter the path including the name and extension of the file. What you've entered will then show up in the DestinationManualList collection.