Monday, December 10, 2018

Automator script for folder structure in right click menu.

Automator script for folder structure in right click menu.

I had a client that works with graphics and requires an easy way to create a folder standard folder structure. This ensures that all client jobs are the same structure. This task can easily be used to create a folder structure with files and resources.


To create this script I used Automator, open Automator and start a new workflow. 



Select Service and click 'choose'.

This will open a blank workflow.


From here the possibilities are endless, but we want to create folders. 

In the left pane, under Library select Utilities. Inside utilities double click on 'Run Shell Script'. This is how we will be creating the folder structure. 


We will be using simple commands to make the structure as we desire. The commands we will be using are 'cd' and 'mkdir'. These two commands will allow us to accomplish everything we need. 

*Note* one of the tricky parts of this script is getting it to run in the correct folder. To accomplish this we will set the variable for the current folder and then move to it.

#Set current directury as current path and move to it
current_path=$(dirname "$1")
cd "$current_path"

Now that we have the script running in the correct folder we can start to make our structure. 
For this example, I will be using generic folder names, Folder#.  

#create first upper lvl folder
mkdir Folder1

With the initial folder created we can build in that folder.

#Folders inside the first folder
mkdir Folder1/Folder2
mkdir Folder1/Folder3

That is the basis of how this script works, create a folder and then create more inside it. If we need more folders in the structure we can add folders into it. 

#create Folders inside the second folder
mkdir Folder1/Folder2/Folder4
mkdir Folder1/Folder2/Folder5
mkdir Folder1/Folder2/Folder6

The only rule here is you have to create the upper-level folders before you can put the lower-level folders inside.  When you put it all together it should look something like this, but the folders should be named properly. 


#Set current directury as current path and move to it
current_path=$(dirname "$1")
cd "$current_path"

#Create first level folder
mkdir Folder1

#Create folders inside the first folder
mkdir Folder1/Folder2
mkdir Folder1/Folder3

#Create folders inside the second folder
mkdir Folder1/Folder2/Folder4
mkdir Folder1/Folder2/Folder5
mkdir Folder1/Folder2/Folder6

After the script has been created and saved we need to place it somewhere to make it available for use. If you would like this to just be available to the user account only, just double-click on the workflow file and install it. 

If you would like to action available to any user on the machine it needs to be placed into the  /Library/Services folder. This folder may not exist on your Mac, if it does not then create it and place the workflow file inside.



Now when you right click on a file or folder you will have a services section at the bottom that contains your new custom script. You can see here our action is called Folder-Creator. click this and it will create the folder structure we laid out in Automator. 




This menu action will be available for all users that login to this machine. You can open and edit this task as you need, or add in other actions that suit your structure. 

Please comment if you found this useful or have any questions.


Wednesday, October 17, 2018

Show Shared Calendars in iCal. Mac Calendar.

I recently had a client switch to exchange, much better service right?

There are always problems with switching...

We had a fairly straightforward switch, using GoDaddy 365 services. Exported the Calendars from the iCloud accounts and Importing them into the Exchange account.



First small(ish) issue was that Exchange cannot handle some of the events that are repeating forever. The client was very understanding and was ok with recreating these events. There were also other events information for the events that were not specified and was unable to be imported.


These two problems on their own could cause a significant headache for someone migrating to Exchange with old or large calendars. However, I had the luxury of not having to worry about it... This time.

Now to the heart of the issue you are here for. Shared calendars and delegates.

After I had migrated the calendar events and ignored the warning messages I moved on to sharing the calendars and settings up delegates.

When typing the name of the delegate the field would not auto-populate with the email address from the domain. It was showing random names of people I knew or other clients... This was puzzling.
I thought this was very weird but wondered where and why these names were popping up. I know they couldn't be on the client's exchange server/domain so I was very confused.



I think though maybe it was pulling names from my contacts app. I typed in a few names of people I went to college with and sure enough they showed up. The other odd thing is I could select them as a delegate but they would have no permissions. So I added the delegates to the Contacts app.


This worked! After adding the desired delegate to the contacts app on my local machine they appeared in the delegation section on iCal, which is supposed to look at the Exchange server, and not only did they show up, they were given proper permissions for accessing the shared calendars!




That's it, That's the entire solution. All that's left to do is check the box to Show. Just had to add them to the local machines contacts...... Of course, there was a bit of setting up the shared calendars in the back end but if you made it this far I don't think that was your problem.

I hope I was able to help you solve any issues you were having with delegation setup. Please leave a comment!