Mac Os.x Create App Alias On Desktop By Script


  1. Mac Os.x Create App Alias On Desktop By Scripture

May 20, 2006  My OS': Mac OS X Lion, Mac OS X Snow Leopard, Mac OS X Tiger, Mac OS 9.2.2, openSUSE 10.3 I was on the Mac-Forums honor roll for September 2007, 01:43 PM #2. (Windows switchers know an alias as a shortcut. The idea is the same, although Macs had it first. Harrumph.) You can always identify an alias by the small curved arrow at the base of the icon, and the icon might also sport the tag alias at the end of its name. You have two ways to create an alias. Here’s one: Select the item. Jun 13, 2016  How Mac Scripting Works. The Open Scripting Architecture (OSA) provides a standard and extensible mechanism for interapplication communication in OS X. This communication takes place through the exchange of Apple events. An Apple event is a type of interprocess message that encapsulates commands and data. A scriptable application responds to Apple events by performing. Of course the final script takes the first argument as the App Name. That way you can just run 'launch Mail' without cluttering your environment with aliases. I have the same for quitting apps. Very handy when I want to remotely cleanly kill an app. Killall -2 'app' might work as well, but I don't know that that signal is as clean in the GUI. In the Mail app on your Mac, choose Mail Preferences, then click Accounts. Select an account, then click Account Information. Click the Email Address pop-up menu, choose Edit Email Addresses, then do one of the following: Add an alias: Click the Add button, then enter a name and email address. Edit an alias: Click the Full Name or Email Address field, then change the name or email address.

Os.x
A script to create aliases 9 comments Create New Account
Click here to return to the 'A script to create aliases' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.

It is not such a good idea to have a relogin as part of the script since if you use this script several times, you will build up many nested invocations of this script and nested login shells. Not such a big problem but a bit worrisome if you don't logout for weeks & weeks. (If you don't understand what I mean, try adding a line
echo 'finished adding alias'
at the end of the script - you won't see the 'finished ..' until you exit from the new shell you have created.)
You could avoid the need for re-login if you put the aliases in a separate file (.aliases or aliases.mine) since then all that would be needed to get the updated aliases is to 'source' the aliases file. But this source-ing of the aliases file can't be done from inside the script since that wouldn't affect the current shell. So you would need to use an alias to invoke the script and have the 'source' as part of the alias.
I also have a small quibble with the terminology used in the prompts. If I say:
alias copy cp
then the usual terminology is: 'copy is an alias for the 'cp' command'. Your prompts have this backwards.

You could add a message to source ~/.cshrc and you won't need to login, or just add it to the code

Here is a python version taht does not require a login.
It does however require an aliases.mine file.
#!/usr/bin/env python
import os
user = raw_input('Enter username: ')
cmd = raw_input('Enter the CMD you want to make an alias for: ')
alias = raw_input('Enter the alias without quotes: ')
pound = raw_input('Enter a one line description for the alias: ')
file = '/Users/%s/Library/init/tcsh/aliases.mine' % user
output = '# %s n alias %s '%s' n' % (pound, cmd, alias)
fileout = open(file, 'a')
fileout.write(output)
fileout.close()
See if it works for you.
Thanks.
SA

But, as far as I can see (not being very knowledgeable in Python), this script does not result in the new alias being immediately available. I.e. so that immediately after using the script you can make use of the new alias. That was the reason, I believe, for the re-login in the original script.

No prob:#!/usr/bin/env python
import os
user = raw_input('Enter username: ')
cmd = raw_input('Enter the CMD you want to make an alias for: ')
alias = raw_input('Enter the alias without quotes: ')
pound = raw_input('Enter a one line description for the alias: ')
file = '/Users/%s/Library/init/tcsh/aliases.mine' % user
output = '# %s n alias %s '%s' n' % (pound, cmd, alias)
fileout = open(file, 'a')
fileout.write(output)
fileout.close()
os.system('su %s' % user)
This of course leads a possible security opening open for abuse as
mentioned earlier.
Good Luck.
SA

Sigh.
This version has exactly the same problem as the original script.
It starts a new (nested) shell and the Python script continues to run as long as you use that shell. If you did this several times, you would have several copies of this Python script running as well as several extra shells.

Why not just rehash then instead of su?
Will this work?
SA

rehashing updates the shell's list of executables.
It does not do anything with aliases.
The solution is relatively simple - you use an alias to perform multiple commands as I suggested earlier. (There is nothing that can be done in a shell script since what you are trying to change is the current shell's environment.)

Okay, so the problem that people have identified with the script is that you need to relogin for it to take effect. But you don't -- all you have to do is take the command that it echoes:
alias listall 'ls -l'
or whatever, and then copy and paste it to the command line, and hit return. Not fully automated or elegant or anything, but certainly effective.
Dan

Modifying this control will update this page automatically

Mail User Guide

An email alias is like a nickname and helps to keep your actual email address private. When you send emails using an alias, your recipients never see your actual email address.

Create or change an alias

  1. In the Mail app on your Mac, choose Mail > Preferences, then click Accounts.

  2. Select an account, then click Account Information.

  3. Click the Email Address pop-up menu, choose Edit Email Addresses, then do one of the following:

    • Add an alias: Click the Add button , then enter a name and email address.

    • Edit an alias: Click the Full Name or Email Address field, then change the name or email address.

    • Remove an alias: Select an alias, then click the Remove button .

Send an email from an alias

Mac Os.x Create App Alias On Desktop By Scripture

  1. In the Mail app on your Mac, move the pointer over the From field in a message you’re writing.

  2. Click the pop-up menu that appears, then choose an email alias.

    Be careful!/There are many sources for obtaining information on software. The timelapse software mac is developing at a frantic pace. Time lapse software freeware mac games. New versions of the software should be released several times a quarter and even several times a month. Update for timelapse software mac.There are several reasons for this dynamic:First, new technologies are emerging, as a result, the equipment is being improved and that, in turn, requires software changes.Secondly, the needs of users are growing, requirements are increasing and the needs are changing for timelapse software mac.Therefore, it is necessary to monitor changes in the timelapse software mac and to update it in a timely manner./ If you do not update in time, you can become a victim of viruses and scammers, which can lead to irreversible consequences.