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

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.

Related

Can I upload a file to onedrive via Windows 10 command line?

I need to upload a file to OneDrive, via the command line. This will be done through a batch file which is distributed to end users.
From searching on Stack Overflow, I find questions like this one which say that you need to register an app and create an app password, using Azure. I don't have the necessary permissions to do this in the organization where I work, nor can I do anything that requires an admin account. So I can't any install software - I have to use what comes with Windows 10. I can't use VBA either as that's blocked.
I've managed to download files from OneDrive without anything like that, using the process described here:
Open the URL in either of the browser.
Open Developer options using Ctrl+Shift+I.
Go to Network tab.
Now click on download. Saving file isn’t required. We only need the network activity while browser requests the file from the server.
A new entry will appear which would look like “download.aspx?…”.
Right click on that and Copy → Copy as cURL.
Paste the copied content directly in the terminal and append ‘--output file.extension’ to save the content in file.extension since
terminal isn’t capable of showing binary data.
Example:
curl https://xyz.sharepoint.com/personal/someting/_layouts/15/download.aspx?UniqueId=cefb6082%2D696e%2D4f23%2D8c7a%2
…. some long text ….
cCtHR3NuTy82bWFtN1JBRXNlV2ZmekZOdWp3cFRsNTdJdjE2c2syZmxQamhGWnMwdkFBeXZlNWx2UkxDTkJic2hycGNGazVSTnJGUnY1Y1d0WjF5SDJMWHBqTjRmcUNUUWJxVnZYb1JjRG1WbEtjK0VIVWx2clBDQWNyZldid1R3PT08L1NQPg==;
cucg=1’ --compressed --output file.extension
I tried to do something similar after clicking 'upload' on the browser, but didn't find anything useful when trying to filter the requests.
I found these two questions but there is no keyboard shortcut to upload, AFAICT. Also the end user will be uploading a file to a folder I've shared with them from my OneDrive. Opening Chrome or Edge as a minimised window is fine, but I can't just shove a window in their face which automatically clicks on things - they won't like that.
It's just occurred to me that I might be able to use an office application to Save As the file to the necessary onedrive folder, where the keyboard shortcuts are pretty stable, but have no idea how to achieve that via the command line.
The best and more secure way to accomplish this goal I think is going to be with the Rest API for OneDrive.
(Small Files <4MB)
https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_put_content?view=odsp-graph-online
(Large files)
https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_createuploadsession?view=odsp-graph-online
You still need a Azure AD App Registration (which your admin should be able to configure for you), to provide API access to services in Azure. Coding with the API is going to be far easier and less complicated, not to mention more versatile.

Adding link to local file in Confluence

I would like to add a link to a local file in confluence. Obviously this link would only work if the file is locally on the users computer. I understand that.
If I add the address like this :
file:///D:/dev/ngs-frontend/src/pages/myPage.html
The browser sends me to :
about:blank
If I try to add it with quotes like so :
"file:///D:/dev/ngs-frontend/src/pages/myPage.html"
..confluence crashes!
How is it possible in confluence?
As you mentioned when adding the web link in Confluence specifying the file using the file protocol (file:///) you might face the issue that it doesn't work.
Obviously this link would only work if the file is locally on the users computer.
This is not entirely true. If you open the developer tools you most likely will be getting the error "Not allowed to load local resource"
As measure of security the browser won't let you access files from a different origin, specially from the users computer (this would be a serious security risk). Only imagine if you could access the files in the Windows directory from the browser, you could break apart the operating system in no time (or steal user data).
This is explained in here
If you put the file in the same server Confluence is running, then this should work just fine. However I believe you can save time just adding the page as an attachment and loading it (Confluence is pretty decent at version controlling in case you want to modify the html file).
Hope this helps!

What/where are the "quote site" options for z/OS FTP server?

I'm writing a script using Perl and Net::FTP, which is trying to upload a rather large file to the mainframe and I can't seem to get the primary/secondary allocations right.
I try to change them but it appears that, because the data sets are SMS-managed, they go to a different volume each time.
So I went looking the the quote site option which would (hopefully) lock the upload to a specific volume.
The current options I have are:
$ftp->site ("bl=10204 lr=170 rec=vb cy pri=100 sec=100")
and space is pretty tight on most volumes. However, I've located a volume with the required space but don't know how to specify that in the FTP options.
Is there a document somewhere detailing them? I couldn't find anything in the CommServer stuff nor did a Google search for ftp zos quote site turn up anything useful.
Alternatively, does anyone know the option to specify a fixed volume? Obviously I'd prefer the former since there may be other useful things in there but, at this point, I'd take the latter gratefully - I've darn near pulled out all my hair :-)
Log onto your mainframe's FTP using an interactive FTP program (e.g. FTP). Then type "quote help site" and you should get a good list of the options.
Just a little explanation... "site" is a command for the mainframe's FTP server. Typing "help" in front of it gets you help on the function. However, just typing "help site" will look for help on your FTP client (which probably never heard of the site command), so you have to pump the command to the server, which is what the "quote" command does.
BTW, your site command is asking for 100 primary and 100 secondary cylinders. That's a hefty chunk of DASD. Do you really need all that?
Good luck... let me know if you have any questions. I practically live on FTP on the mainframe and have written dozens (maybe hundreds) of Perl scripts to make things easier.
As a general FTP reference for z/os try Z/OS V1R7.0 Comm Svr: IP User's Guide and Commands.
Site commands can be found here.
Why not let SMS find the appropriate volume by using a DataClass appropriate for the file size?
How much hair did you start out with? Some can't afford to pull too much!

how do I set a Thunderbird signature to use a dynamic url's html?

I want to use a dynamic email signature in Thunderbird, that is context aware (depends on date, events in db, etc.)
If I have a PHP that can generate the signature html (i.e. http://www.site.com/email_sign.php)
how do I force Thunderbird to use it?
(the only options I see are using static html (whether inline, of from a local system file).
any ideas?
You can use the Signature Switch add-on and a batch file calling wget to achieve what you want. I wrote a simple executable to replace the bat file; you can read about it (and download it if you want to) from http://www.else.co.nz/portfolio/020-code/dynamic-email-signatures
I doubt you can do this simply. Thunderbird does allow scripting via the creation of plugins but I wouldn't personally know how do do it or how easy it might be.
Best answer I can think of would be to set a scheduled task / cron job to download the php to a local file then follow the instructions in the knowledge base, namely:
You can use Thunderbird to create signature files, or you can use your operating system tools to create them—for example, a plain text editor.
Thunderbird does not provide any
special place to store signature
files. You could create a Signatures
directory in your profile to store
them, making them easy to back up
along with the rest of your profile.
Or you could store them somewhere
else.
To use a signature file, specify it in
Account Settings as the signature for
an identity. Check the box "Attach the
signature from a file instead" and
specify the signature file.
This will work unless Thunderbird caches the HTML internally, however I see no indication in the FAQ that this is the case.
For years I updated the signature for my email client manually – until I got fed up… That’s why I wrote a PHP script to create a randomized signature block automatically from an RSS feed! Check it out: https://github.com/birdy1976/signature :-D

Office integration (Word) - intercepting save

I am planning to implement a small in-house document management system. It must have a web GUI for managing a remote folder structure stored in a database. In these folders are word documents stored (physically as blob in a database). Whenever a user clicks on a document link, a word binary is downloaded via browser and (hopefully) opened in Word on the user's PC.
This is the easy part ;)
Now the user hits "Save" or Ctrl-S. I want to have a functionality programmed inside Word that calls a custom function (maybe in a .NET DLL) that uploads the saved file back to the server (HTTP). The hard part seems to me:
How to intercept the Save process to call the extension functionality
How to deploy this to multiple users
Mike's link to the question I answered should do it for intercepting the file save. The specific button idMso for File->Save is "FileSave"
To deploy it to several users machine you can either
Create a setup project that will create an msi that you can run on all the users machines
if it's an intranet scenario, you can keep the assemblies on a network location and just add the neceassary registry settings to all the users machines. This article should describe the settings that you need to include. You would just need to change the path setting to point to the network location.
AFAIK, this is what Alfresco is doing with its Microsoft Office Add-ins (never tested myself though). As Alfresco is open-source, it must be possible to look at what they are doing. Or just ask your questions on Alfresco's forums.
You can try to override "save" from the ribbon or build your own ribbon tab with the behavior you want. It may be trickier overriding "Ctrl-S".
Overriding the ribbon: StackOverflow Question
Video on altering a standard ribbon button: Office Developer Center