+ Reply to Thread
Results 1 to 7 of 7

Applescript folder

  1. #1
    Registered User
    Join Date
    04-09-2012
    Location
    London, UK
    MS-Off Ver
    Excel 2016 Windows
    Posts
    13

    Applescript folder

    I have been modifying an Excel vba project to run on a MAC. It has been a challenge but we are nearly there.
    One of the functions asks the user to select a file and then writes to it.

    The Apple sandbox has been a problem but we’ve found that if you select a file via applescript code placed in:
    /Users/user/Library/Application Scripts/com.microsoft.Excel then it works.

    Google ‘vba applescripttask’ for details of the mechanism (sorry - I cannot post urls!)
    The folder clearly has some special attributes/properties.

    With Office 2016 and Office 2019 the folder gets created (presumably during office installation) and everything works. With Office 365 though the folder is missing. If you create the folder manually just don’t work.

    Has anyone else had this problem and solved it? Is it an Office installation option? What might the special properties be?

    Phil
    Last edited by PhilB2; 12-16-2020 at 08:55 AM. Reason: Solved

  2. #2
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Applescript folder

    Quote Originally Posted by PhilB2 View Post
    The Apple sandbox has been a problem but we’ve found that if you select a file via applescript code placed in:
    /Users/user/Library/Application Scripts/com.microsoft.Excel then it works.

    Google ‘vba applescripttask’ for details of the mechanism (sorry - I cannot post urls!)
    The folder clearly has some special attributes/properties.
    no clue what you're saying. after doing all of this:

    https://www.google.com/search?q=vba+...pt+select+file

    https://www.google.com/search?q=vba+applescripttask

    https://www.tutorialfor.com/questions-77014.htm

    I still have no idea what you mean by:
    The folder clearly has some special attributes/properties.
    ???

  3. #3
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Applescript folder

    Quote Originally Posted by PhilB2 View Post
    (sorry - I cannot post urls!)
    yes you can.

  4. #4
    Registered User
    Join Date
    04-09-2012
    Location
    London, UK
    MS-Off Ver
    Excel 2016 Windows
    Posts
    13

    Re: Applescript folder

    You can post urls but I cannot!
    You are not allowed to post any kinds of links, images or videos until you post a few times
    Thanks for those url’s – I have seen them and have been in dialogue with Nigel at Warwick.
    no clue what you're saying
    I’ll give more details.

    I have previously published addin code to do conversions involving British map references, to manipulate gpx files,
    plot on Google Earth and get postcode coordinates.

    Following an approach from a MAC user we’ve been trying to port it to MAC and the modified code has been tried on
    three different MAC systems. So far about 100 iterations of the code! Encouragingly, the custom ribbon menus,
    cartographic conversions, iterative routines, recursion, dictionaries, XML parsing and cell handling all worked fine.

    It was when we got to file handling that it all fell apart due to sandbox restrictions.

    Under Windows you’d get the name of a file to write to with:
    Please Login or Register  to view this content.
    With MAC unfortunately that is unstable – it locks Excel up requiring the MAC equivalent of ctrl/alt/del and
    killing the excel process.

    Instead, you have to delve into Applescript to choose the file. This works and is very stable:
    Please Login or Register  to view this content.
    Now the file holding that applescript has to be in a particular named folder:
    Please Login or Register  to view this content.
    .
    This requirement is part of the sandbox restrictions placed on Office.

    Under MAC Excel 2016 and Excel2019 that folder is created (I presume) as part of the Office install process. On the Office 365 system the folder was missing so was created manually.

    The Applescipt above fails with 365 and that manually created folder – it ‘spins’ until MAC OS times it out.

    I am left with the question ‘what is the difference between a manually created folder and an office installation created one?’

    Hence the reference to attributes/properties.
    Phil

  5. #5
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent SAC
    Posts
    8,885

    Re: Applescript folder

    Have you looked at Ron's articles such as this one: https://www.rondebruin.nl/mac/mac034.htm ?
    Rory

  6. #6
    Registered User
    Join Date
    04-09-2012
    Location
    London, UK
    MS-Off Ver
    Excel 2016 Windows
    Posts
    13

    Re: Applescript folder

    Thanks for your response.
    Yes, seen that. I have found Ron de Bruin's pages revealing and learned a lot from them but I'm trying to write outside the sandbox.
    That's successful except for office 365 (or this particular installation of 365?).
    Phil

  7. #7
    Registered User
    Join Date
    04-09-2012
    Location
    London, UK
    MS-Off Ver
    Excel 2016 Windows
    Posts
    13

    Re: Applescript folder

    We have found that the applescript file started working. We believe that a MAC system restart fixed it.
    Thanks all.
    Phil

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Mac OS & VBA & Applescript
    By Devsur in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-27-2018, 10:53 AM
  2. Add AppleScript to VBA
    By bloomingcarrot in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-27-2015, 08:36 PM
  3. Converting Macros to AppleScript
    By pdgood in forum Excel General
    Replies: 4
    Last Post: 10-28-2010, 03:50 PM
  4. Converting a simple macro to applescript
    By suppedraken in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-06-2010, 11:25 AM
  5. AppleScript - Unprotect, Sort, Protect.
    By UMOP in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-13-2010, 01:46 AM
  6. 2004 VBA to 2008 AppleScript
    By kbraaten in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-17-2008, 05:19 PM
  7. Convert VB macro to applescript?
    By pingwin77 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-02-2008, 01:11 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1