Powershell - Can I copy only the changed part of a file to a command prompt? - powershell

I'm trying to find a way to link two audio players' playlists so that, while one generates a playlist and saves to its own M3U file, the other (the old winamp) is somehow sent each new track as it is added via the command prompt /ADD tool. Or other means, if there's a better way.
Is this possible with Powershell? To reiterate, I need it to monitor the first program's M3U file, then as the first program dynamically adds each new track and updates itself, Powershell would send each entry to winamp via command line. Is this possible? Just asking directly since I'm a new user and am not clear if it can parse out just the new information as it is added in real-time, or close to it.
Each program has unique plug-ins so I am trying to find a way to combine them to obtain use of both sets of features at the same time.

Related

Download and Extract Remote Application File from Website

I am pretty new to IT Administration and I think I have a pretty complicated request but I want to know if it is even possible through Intune. I have an application that I want to deploy and I think I would either need to package the application as a Win32 app or via a Powershell Script. I basically would need to download the zip from this website, extract the contents, open the WCX, silently pass through the prompts, and pin the app to the taskbar. Again I am not sure if this is even possible but this would save me a lot of trouble if there was an easy way to do this. Here is the link.
https://kb.tempworks.com/help/how-to-add-an-enterprise-shortcut-to-the-desktop
To download a file, use Invoke-WebRequest with the -OutFile parameter.
To Install a .wcx you use rundll like this:
rundll32.exe 'tsworkspace,WorkspaceSilentSetup' C:\Path\To\The.wcx
(There's a whole wrapper script for that on the old technet script gallery)
It's impossible by design to pin things to users' task bar or start menu programmatically (well, you could script a bunch of hotkey presses and clicks, but don't).

Automatically respond to Matlab uigetfile

Is it possible to script a response to Matlab's uigetfile?
For example, I have a script saved as p code (uneditable) that contains calls to uigetfile. Normally, a user would run the script and manually select a file using the file browser created by uigetfile. If a user wanted to run the script on a thousand input files, the user would have to manually select every file using the file browser.
So, is there a way to run the pcode from another script and automatically respond to uigetfile's file browser. I realize that the best solution would be to do away with uigetfile, but that is not feasible in this situation.
If you are calling uigetfile in a p-file, unfortunately there is nothing you can do with Matlab.
You can have a look at Sikuli, though. It is a graphical automating software, which can handle the uigetfile popups for you.

How to force Word to do a SaveAs on generated document

We have a system where we are generating a report as a Word document (using RDLC).
The report is created in a temporary directory, and then Word is launched to display it to the user.
Word is launched, and the report loaded by:
_wordApplication = (Word.Application)Activator.CreateInstance(Type.GetTypeFromProgID("Word.Application"));
object tempFileNameObj = documentPath;
_wordDocument = _wordApplication.Documents.Open(ref tempFileNameObj);
What I want is to convince Word that this is really a newly created, unsaved file, so it will give the user a SaveAs dialog when they save it (rather than save back to the temporary location).
Ideally, I would like to be able to specify the target directory, and offer a default name.
While the Word is being launched, I can do what I like using Automation, but after Word has been launched, my application will be disconnected from Word, and I would prefer not to leave any macros floating around in the document.
You can rename your .doc file to .dot (Word Template) and if you launch it afterwards, it will create a new File looking exactely like your .doc
If you're not using a macro I believe that the only way to archieve this would be to save the file that they will download be a read-only or user defined template file this way if they wan't to make changes to it they wil have to save it with another name in their computer to save the changes made. If you can use a macro you can archieve more options and even force a save as dialog when the document is opened or when it's closed. I hope this helps as I couldn't find any more information without using a macro.

Renaming file with filepicker.io

Here is my use case: the user will click a "save" link and will be presented with a filepicker.export() dialog, choose a location and name and save a file. Here's the exotic part: I won't have the file yet at that time. It needs to be downloaded first with a GET request, and then stored in filepicker. I won't know which file to start downloading until the user clicks "save".
This can be dealt with by first downloading the file when the user clicks "save", and only then displaying the filepicker.export() dialog. However, I find this cumbersome, since the user will have to wait for the download to finish to be able to choose a filename and location.
It would be much better to allow the user to first make their choice, for example "Dropbox/image.png", and store some sort of placeholder while the download is running: "Dropbox/image.png.part". Later, when the download finishes, I could write the data to the file and rename it to "Dropbox/image.png".
Here are my questions:
Is it possible to append ".part" to the filename that the user chose in the filepicker.export() call?
More importantly, while I know how to write to the file when the download is done, is there any way to rename it? I tried creating a new fpfile object with the same filepicker URL and a different filename, the new filename was ignored (though the write succeeded).
My recommendation would be to first call filepicker.export call on an empty file and allow the user to specify both the name of the file they would like and the location in their cloud storage. When the filepicker.export call finishes, it will pass an FPFile into the callback. From there, you can download any necessary contents you need and do a filepicker.write to save the contents to the location selected by the user.
There shouldn't be any need to rename the file, as the user has already provided the name they want to save the file under during the filepicker.export() call.

Openoffice Writer macro that uploads current file to a web service on save

I want to know if this is doable and get some hints about how to achieve this.
I guess at least it would need a confirmation dialog to run the (possibly evil) macro.
I want to produce an OpenOffice document that will upload itself on save to a hardcoded URL.
Is it possible?
What are the rough steps to achieve this?
My guess is:
bind a macro to the save event
have that macro get the current file binary data
have it post this data to a URL
but before researching about how to do this I need to know if this can be done in the first place.
I don't believe you need a macro to do this, instead depending on your OS you can map a FTP or other type of protocol remotely.
For example in windows you can "Map" a FTP as a drive and this would do exactly the same thing as your describing, you open the file from the FTP and upon saving it will then be written to the remote server. FTP is just an example here, there are other platforms you can use.
If you are at all interested in this method then following the instructions below, otherwise disregard.
Mapping a Network Drive in Windows Vista and 7.
Click on Windows start orb and then click on "computer".
Click on map a network drive.
Map a network drive will then open a new dialog box where you can click "connect to a website"
Simply follow that easy to use wizard and click add a new network location (Choose a custom network location)
Type in your FTP address, including username and password.
Finally name your network location to whatever you want.
Just a suggestion, I really don't think you need any macro unless you plan on distributing these files to other people then yes, but they would need to install that macro/plugin on their open office since there is no way to encode the document itself with such features as far as I know.