How to give entitlements to Applescript app - excel

I have an application created in Omnis studio where I want the user to be able to press a button to open Microsoft Excel and then paste what is in the clipboard. To do that I have my application call an AppleScript app Seen here:
tell application "Microsoft Excel"
activate
make new workbook
paste special on worksheet active sheet
end tell
However whenever my application calls that script it runs into issues with apple's sandboxing saying that it can't send events to Microsoft Excel.
I read online that in order to get access to sending events in Mac OS you need to have a entitlements.plist file associated with your application. How would I add a entitlements.plist file to my Applescript app so that when it is run it is able to send events to Microsoft Excel?

If you do not sell the app and just use it for your own, best would be to deactivate sandboxing. Your app will still run by righclicking it > open.
If you already have sandboxing enabled there already must be a YOURAPPNAME.entitlements file inside your application structure (not in the compiled app, but in your source code) because sandboxing has to be enabled in that file.
I don't know Omnis studio, you may try using XCode instead which supports entitlements files from the scratch - even if you have to go with applescript objective-c instead of plain applescript.
if you manage to find that file you need to add a new key/value to it like so for addressing Excel:
key: "com.apple.security.temporary-exception.apple-events"
value (type array):
Item 0 > "com.microsoft.excel"
But watch out - if you want to stay in sandbox, from OSX 10.14 there's a new security policy called "security integrity protection" (SIP) by Apple where users also need to allow your app to automate other apps, checkout this thread: "because it is not SIP-protected" - Apple event error in OSX Mojave
To bypass this beginning from 10.14 you also have to add a new line to your info.plist file
key: NSAppleEventsUsageDescription
value: [Some description why you need to use AppleEvents]
I don't know if third party editors will follow the speed Apple provides in things of changes.

This is an older post, but why would you create an Excel file like that, if its just columns of data, just export a CSV file, that Excel can easily open...

Related

Overide Defaultappassociations.xml and let user select the application

I am working on Win 10 upgrade activity. As you know we can select application for file extension. So, those file will open on that app. e.g. html files only open in Chrome when user double click on that.
We can create XML file (DefaultAppAssociations.xml) and place it in C:\windows\system32
Now, I got the request to make one application default but let user decide if they want any other app. Is there any way to handle such things because defaultappassociations.xml will hard code this. Every time machine restart and it will set the same.
This is only possible as part of the operating system deployment or rather for newly created user profiles.
The command (official documentation):
Dism.exe /online /Import-DefaultAppAssociations:<path to exported xml>
However as I said you cannot alter existing profiles that way. Altering existing profiles in any way that is not the force via gpo is afaik not possible anymore because Microsoft does not want to allow it. A pretty stupid decision but at least you can tell whoever made the request that it is by MS design.

Issue With Files Not Opening With Office365

My company uses a SharePoint site for our department where we share resources and documentation. We currently have a primary Excel sheet linked that contains a massive amount of our day to day info and our most common hurdles and pertains to about 80% of our workflow. This was created before the company switched (recently) to Office365 and the web based applications vs the standalone programs. Now it is not letting anyone open the the sheet because it is still trying to open in the Excel program and not the web app.
We previously used Office '13 and there was never any issue. The link is meant to open the Excel sheet right up in a read only capacity and not save the program because the content is being updated regularly with new information and regulations. With the "upgrade" from the older version of Office to the 365 web based standard version this link no longer opens the file directly, it saves to the PC and then needs to be loaded to the web app from the saved version which completely negates the ability for it to be dynamically updated. Inversely, we could import that into One Drive and update it to the new system and set the link to the view only shareable link but that would take an excessive amount of time to reformat and edit on top of everything else. If that is how we need to do it then that is how we need to do it, but is there anyway to just update the link already in the system so that it can allow the file to be opened in the web app as well as the stand alone for those not upgraded yet or with the advanced version (managers) that still uses the programs and not the web apps?
I expect the file to be able to be opened in Office365 Excel web app read only as opposed to being saved to the local machine and if possible also be opened directly in the standalone Excel program for those using the 365 Advanced version or who have not yet completed the upgrade process that the company is currently rolling out.
Thank you for your time with this.
We solved this by simply upgrading the whole department and to the Office 365 Advanced version circumventing the entire issue, thank you for your time regardless.

Visual Studio Interface with MS Excel backend for Multiple Users to Run simultaneously

Until last month, I was creating Google WebApps with HTML interface, Java and Google Apps Script to let the users save data to Google Sheets.
That was working beautifully as all the users were able to save data to a single spreadsheet simultaneously without any data misses/issues.
This month onwards, I don't have the option to use Google Web Apps.
Therefore, I bought Visual Studio. Basically, I am trying to create an Interface using Visual Studio as I have some experience on Visual Basic codes, and then looking forward to save the data to MS Excel.
I have setup an FTP drive where I have saved a test .EXE file which saves their clipboard text to a single Rich Text File(I used the timer to save/read/refresh the file every few seconds). Since all the users have read/write/execute rights to that FTP folder, they are able to launch the .exe file simultaneouly from their systems and it's working perfectly. We are looking at a team of 100+ people.
Now the next step for me is to let them open the .EXE file where the data can be saved to a single Excel file. With Google Spreadsheets it was way too easy. But I need some guidance on how to do that with Microsoft. I studied through articles and articles to track the last updated row and push the data below that. I need tips from someone who has done something like this and if there's a better/efficient way of doing that.
Any help/article would be appreciated.

Solution for Deploying & Updating Document Level VSTO Addin Including the Document

Do any of you have advice on methods for deploying an office VSTO addin, especially Excel, that makes it easy to update and deploy the document as well as the addin.
I have a document level addin for Excel 2010 that I created using VSTO. I currently deploy it using click once. However, this has a few problems. The first problem is that I publish it to ftp then users install it from my website. Since the document and addin are downloaded from the internet, I obviously have trouble getting proper permission for the addin to run and the document to be trusted. Currently I just have users manually adjust permissions and grant access when the solution is installed. That part works and is fine, but if any of you have suggestions on how to automate this that would be great.
The second problem, the main one I am wanting help with in this post, is deploying updates. I generally like using clickonce because of its ease of installation and automatic update features. The solutions I develop are used in rapidly growing fast changing companies, which means I am often making updates. Click once makes it easy enough to update the "code" or addin itself. I just have it automatically check for updates when it is started, and if there are updates it will prompt the user to download them. But what about the document? My solution doesn't only include the code. It also includes the highly customized Excel workbook.
When the solution is initially installed a copy of the workbook is just downloaded to the local computer. But what about after it is deployed to dozens of computers? Does a document level change (adding a column for example) mean going to each computer and downloading the updated workbook manually?
Surely there is a better way to automatically deploy updated versions of the workbook. Any suggestions?
Here are a few ideas I thought of:
Use some installer other than clickonce. Any suggestion on one that allows easy automatic updates?
Somehow package the workbook as an application resource. I have actually done this in some situations, but not in cases where the document itself included a VSTO addin.
Related to the previous idea. Make a "wrapper" project that includes the workbook & VSTO addin. Then the addin would be launched by clicking on a regular icon on the desktop, which would download the workbook (if an update was needed) then open it in Excel. I would prefer that method of launch over simply opening the workbook anyway.
Note: No user data needs to be preserved in the Workbook when an update is done. The old version could simply be overwritten by the new one. The workbook gets all its data from an SQL server.
You could use a Visual Studio Setup Project which leverages Windows Installer. See this deployment walkthrough guide on using VSTO 4.0.
In Visual Studio 2012, support for Setup Projects is being deprecated in favor of InstallShield LE which is another alternative.

best content on how to deploy and share a VSTO solution

with the push to leverage visual studio and dotnet with office based solutions, especially excel, where is the best article or information on how having office sheet with additional binaries and assemblies is sharable.
Do this external code get packaged with the spreadsheet
what if people start emailing the spreadsheet around. Is there any overhead of this additional assemblies. Is there risk of the binaries getting detached from the spreadsheet
It seems like microsoft has been pushing VSTO for over 5 years now but you read lots of mixed reviews and issues. Are we at the point where companies that do large VBA excel solutions can fully migrate over to dotnet without any real worries?
First of all, I want to answer your question on whether or not VSTO is ready for larger implementations. The answer is YES! Especially if the alternative is VBA. You have the entire .Net framework available, you can use web services, ADO.Net (better still, with the enterprise library). You can still write code that looks a lot like VBA, but is much more powerful. You can get more information by reading Walkthrough: Creating Your First Document-Level Customization for Excel. This page will give you an idea of what VSTO features are available to you.
Now, to answer your question on deployment.
It depends on whether you are making an Add-In or a document level customization. If its an Add-In, then you must install it on each client, and any passing around of documents will not effect that (Add-Ins are at the application level, and not at the individual document level).
I assume that you are talking about a document level customization, so I will center my answer around that.
When you create a document level customization, the assemblies are not loaded into the excel file (as they are with VBA). Instead, a document property is added telling the application that this document contains a manifest file (and tells it of the manifest file's location). The manifest file contains links to the assembly that makes up your customization.
As with any .Net application, there are sometimes other (referenced) assemblies that also need to be deployed. Not always are these assemblies in the GAC, so they would have to be located in the same folder as your executing assembly (in this case, your customization assembly). You don't necessarily have to place your assemblies in the same location as your excel file, though.
There are a few ways you can deploy the customization.
You can store all of the assemblies and the excel file in a folder and run the application that way (if the excel file is passed around, the users must pass around the entire folder).
You can run an setup program that installs the assemblies to a specific folder on the users computer, and specifies the manifest at that location (if the excel file is passed around, the users must also pass around the setup program).
You can install the assemblies in a network location and specify in the document properties, that the manifest and the assemblies are all at that network location (if the excel file is passed around, nothing needs to be passed along with it - but there are security settings that need to be made. Read this page for more information).
Any way that you decide to do this, here is the page you need to read in order to understand the document properties that enable the customization.
You need to make sure all of your users have the prerequisites installed. The easiest way to do this is to give them all a setup program. If you create a setup project for your customization, you can setup the bootstrapper to automatically install the prerequisites. You can also do this if you use ClickOnce to install the customization. This page will give you all the information you need to know regarding deployment.
Here are some other helpful links you will need to see:
Application Manifests for Office Solutions (2007 System)
Deployment Manifests for Office Solutions (2007 System)
Application and Deployment Manifests in Office Solutions
I hope this helps. Once you read all of this information, I think you'll agree that VSTO is a much better choice than VBA. You just have to plan your deployment carefully.
I created a Excel add-on and deployed it to a server. Then I passed around two links, the setup.exe file and the link to the actual Workbook. The workbook file never changed - it's purpose was to open and load the add-on which was now in the user's Add/Remove Programs. The add-on itself would check for updates on startup.
So if they start emailing the workbook around, great! I believe in theory, the workbook would download the add-on if it was missing, but I don't have a fresh computer around to test that. If it doesn't, it's just a simply exe to install (which will update on launch anyhow, so outdated isn't an issue).
For document-level deployment, I recommend the following three links:
https://msdn.microsoft.com/en-us/library/ms268758(v=vs.90).aspx
https://msdn.microsoft.com/en-us/library/ff937654.aspx
How do you assign the Assembly Location of an Excel VSTO Installation?
Unlike application-level solution, document-level has 2 special properties: _AssemblyLocation and_AssemblyName, which indicate the *.vsto position. To set these properties by install path, a custom action project should be created to record the target path when installing, and packaged together with setup.exe. Then you could put your excel file anywhere (on local machine) and open it in the correct way.

Resources