Hiding Folders via Apple Script
Good evening,
When i installed Leopard a got up a little Issue: When i look in my harddrive i can see the the folder "var,usr,etc" ... in the normal Finder Window.
Well i thought it would be some kind of a bug so i helped myself and used a little apple script i allreade used in Tiger to hide all these annoying folders like "Microsoft Users Data etc." You know what i mean
My Script does this:
+set myfile to choose file+
+tell application "System Events" to set visible of myfile to false+
+tell application "Finder" to update myfile+
I should be able to pick a file (have done the same for folders, too) and hide it from the normal Finder window. Well it works fine on causaul folder and data.
But on these UNIX Folder i mentoined it wont work. My Question: How can i get this to work? (I thought of missing admin priviledges?)
Try the instructions in this article.
(25833)
Similar Messages
-
Automatic graphic switch via Apple Script
hi community,
I would like to change the "Automatic graphics switching" (tick on / tick off) via an Apple Script. I made the following script and it works, except with line "click chckbox 2". Here it ticks the box "Show battery status in menu bar". With "click checkbox 1" it takes the "Lock-Button".
I would be glad if anybode could tell me the right code for ticking the checkbox "automatic graphics switching" via Apple Script.
Thanks a lot
PS: Yes I know that tool gfx Status, but I wanna do this via Apple Script.
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.energysaver"
delay 0.5
tell application "System Events"
tell process "Systemeinstellungen"
tell window "Energie sparen"
click checkbox 2
delay 0.5
end tell
end tell
end tell
quit
end tell
quitHello
You may try this. It works with MacBook Pro 2010 under 10.6.5.
tell application "System Preferences"
set current pane to pane id "com.apple.preference.energysaver"
end tell
tell application "System Events"
tell process "System Preferences"
tell window 1
tell group 1 -- automatic graphics switching
tell checkbox 1 -- automatic graphics switching
click
end tell
end tell
end tell
end tell
end tell
And the script below will set the option to the specified value.
set_automatic_graphics_switching(0)
on set_automatic_graphics_switching(i)
integer i : status of automatic graphics switching
0 : off (unchecked)
1 : on (checked)
if i is not in {0, 1} then error "Invalid argument: " & i number 8000
tell application "System Preferences"
set _was_running to running
set current pane to pane id "com.apple.preference.energysaver"
end tell
tell application "System Events"
tell process "System Preferences"
tell window 1
tell group 1 -- automatic graphics switching
tell checkbox 1 -- automatic graphics switching
if value ≠ i then click
end tell
end tell
end tell
end tell
end tell
if not _was_running then
tell application "System Preferences" to quit
end if
end set_automatic_graphics_switching
Hope this may help,
H -
Starting applications from a keynote via Apple Script?
Is there any way to start an application from a keynote via Apple Script?
Welcome to the forums!
Keynote does not support the use of AppleScript in that fashion. -
Is it possible to set a files label on opening via apple script?
Hi,
I would like to mark files which have been opened with i.e. a red lable.
Would that be possible using apple script?
If yes how would that script look like?
Thanks in advance.I don;t know of anyway of doing this in Applescript. There is the ability to monitor files using launchd, WatchPaths, but you need to know the files your monitoring before hand so it won't work for this.
Again if the domain is limited, that is it's only a certain application or a certain folder you're interested in it might be possible to put something together in Applescript but as a general use, system wide, solution I don;t think it can be done.
One other possibility would be to use the Finder and smart folders. You could look for all files in a certain folder or system wide that have been acessed in the past period and then mark those. Something along those lines is doable with eiter the Finder or a script.
regards -
Open & close iTunes every night via Apple Script
What I would like to do is have my Mac come out of sleep at 3am, open iTunes and download all my podcasts and then go back to sleep. Is this possible with Apple Script?
In System Preferences>Energy Saver click on 'Schedule' and set 'Start Up or Wake' to 3 AM
In iCal set up an event for 3.05, setting an alarm to Open File and selecting iTunes.
Suppose you want to allow half an hour:
In AppleScript Editor, write
tell application iTunes to quit
tell application "Finder" to sleep
and save it somewhere as a script, not an application.
Set up an event in iCal for 3.35 with an alarm, setting it to Run Script and selecting your script. -
Changing background via apple script
Hello,
I manage a small deployment of different macintosh products and I currently have to run 5 different images so that the background images look right on all the various resolutions. I have been working on a piece of applescript to prompt the user on first startup to select their hardware type to apply the proper background image but I am running into a few issues.
Firstly the method I am using limits me to three options and I cant seem to find any documentation on how the list function works.
Second, I keep getting errors saying the files can't be found.
Here is the code (with personal details removed) that I am working with
display dialog "Choose your hardware type" buttons {"17MBP", "15MBP", "iMac21"}
set situation to the button returned of the result
tell application "Finder"
set desktop picture to {"MacOSX:Users:USERNAME:Technical:Backgroundimages:" & situation & ".gif"} as alias
end tell
I would really like it to automatically detect the hardware type but I don't think that is possible. The error I currently get says:
error "File MacOSX:Users:USERNAME:Technical:Backgroundimages:15MBP.gif wasn’t found." number -43 from "MacOSX:Users:eventequipment:Technical:Backgroundimages:15MBP.gif"Applescript panels are limited to three buttons. if you need more than three choices, use the choose from list command:
choose from list {"alpha", "beta", "gamma", "delta", "epsilon"}
however, you ought to be able to gather the information you need without user interaction. you can base a choice on machine type using code like the following:
set machineType to paragraph 6 of (do shell script "system_profiler SPHardwareDataType")
if machineType ends with "MacbookPro2,2" or machineType ends with "…" then
set situation to "MBP15"
else if machineType ends with "…" or machineType ends with "…" then
set situation to "MBP17"
else if machineType ends with "…" or machineType ends with "…" then
set situation to "iMac21"
else
-- set default or throw error
end if
or it might be more convenient to base it on screen resolution using something like the following
set displaySize to paragraph 17 of (do shell script "system_profiler SPDisplaysDataType")
if displaySize ends with "1440 x 900" then
set situation to "MBP15"
else if displaySize ends with "…" or displaySize ends with "…" then
set situation to "MBP17"
else if displaySize ends with "…" or displaySize ends with "…" then
set situation to "iMac21"
else
-- set default or throw error
end if -
Retrieve duration of sound files via Apple Script - System Events
I need to get more details of my sound files into a FileMaker 10 Database as it is possible by using the FileMaker import function. There ist a complicated way by going first through iTunes and than to FileMaker. Now I found out, that part of the information displayed when pushing cmd+i can be retrieved with this:
tell application "System Events"
properties of file "/Volumes/MacHD/singsong.mp3"
end tell.
But duration, channels, bitrate are not accessible. Is this a general problem with metadata? May be if I got a hint how to retrieve meta-data from .jpg files I might be able to apply this also on .mp3Try the AppleScript forum under OS X Technologies.
-
Apple Script to watch any network connectivity to my mac
Hi All,
I am looking for a apple script, when that runs it tell or display a dialog box with connection number(s) or the connected machine info or IP address or when any other machine connect to my mac then display a dialog box that someone is connected.
is this is possible via apple script??You need "Little Snitch"
I believe there's a trial version available... It's good for like 30 days.
A script to do what you're looking for would be really really complicated.
http://www.obdev.at/products/littlesnitch/download.html -
Automator or Apple Script To Move Multiple Files to Multiple Folders
I was just wondering, is there any sort of automator workflow or maybe apple script that will allow me to automate the following:
I have a folder named SCANS containing multiple different files that need to go to multiple different folders.
So Say I have:
SCANS
and in this folder I have ten files named A,B,C,D,E,F,G,H,I,J and I want each of these files to be moved to different folders eg.
A I want to go to folder 1
B I want to go to folder 2
C I want to go to folder 3 etc etc.
Anyone know if there is a way of doing this please?
I have tried a workflow where I find finder items in the Scans folder and move to another but that only seems to work for one file. When I add more it does not seem to work.
Any help/guidance would be appreciated.
Thank you!Hi Niel,
Not quite what I wanted because I missed some information from my question....
What I actually want is to search for files containing certain text in the name and if positive to then move that file to the specified folders.
Cheers. -
I want to build an apple script that will parse the name of a file and sort it into folders.
This is for medical application, so I will do it as such: CLIN_FAM_PAT_FILE_DATE.EXT sorts into Folders: Family/Patient/Type/Date, either sorting into folders that already exist (and make them shared folders eventually for each patient) or creating new folders with names as indicated by the file name. The Prefix "CLIN" is an indication that the file is a clincial patient document and so needs to be filed. Files without that prefix would be ignored.
So the file format would be:
Family Folder
Family DocumentsDocument Type folders
Patient folders - for each person who is a member of that houshold unitDocument Type Folders (such as x-rays, lab reports, or insurance info)Within each document type, there would be separate folders based on the date (or at least the order of the docs would be by date)
For example: A document called CLIN_JONES123_JAMES228_LAB_022614.PDF which is a lab summary for James Jones done on 2/26/14 would go here
JONES123 FolderJAMES228 FolderLab Results FolderFebruary 2014 Folder.
Makes sense? I am initially putting these files into a Filemaker Pro database and having it compile the files based on patient name, type, date, etc. But need to use Applescript to create the folders so things are organized in a way that I can easily share with patients.
Makes sense?You can call this script from Applescript (just need to do some escaping of quotes):
This can be run in Applescript:
do shell script "
DestinantionFolder=$HOME/Desktop
MONTHS=(January February March April May June July August September October November December)
for f in ~/Desktop/*
do
if [[ $( echo \"${f##*/}\" | cut -d_ -f1 ) == \"CLIN\" ]] ; then
ff=$( echo \"${f##*/}\" | cut -d_ -f2 )
pd=$( echo \"${f##*/}\" | cut -d_ -f3 )
date=$( echo \"${f##*/}\" | cut -d_ -f5 )
date=${date%%.*}
mo=${date:0:2}
yr=20${date:4:2}
Dir=$DestinantionFolder/$ff/$pd/${MONTHS[$mo-1]}\\ $yr/
if [ ! -d \"$Dir\" ]; then
mkdir -p \"$Dir\"
fi
mv \"$f\" \"$Dir\"
fi
done"
...is there a way to trigger this whenever a new file is created to check and see if it needs to be moved
Yes, with Automator. When you Open Automator, choose Folder Action
I copied what you did and while the script ran successfully, I don't see any new folders created. Your shell script makes sense; I am not sure why it doesn't create folders.
The script as written only looks for files in the Desktop Folder
(edit by changing: DestinantionFolder=$HOME/Desktop )
To test I created a file on my Desktop
touch ~/Desktop/CLIN_JONES123_JAMES228_LAB_022614.PDF
and Folders were created and the file moved.
(Note: I only tested that format. If the file has any other format, it will fail) -
Help creating apple script to create folder and set access levels
I'm trying to create folders in FileMaker Pro using apple script and need some help in setting the access level for the folders. I want to set both Staff and everyone to Read and Write access. Secondly I would like to have a function key set on the desktop to create new folders and set that same access level. The default access is Read and I can not find a way to change that.
ThanksI'm trying to create folders in FileMaker Pro using apple script and need some help in setting the access level for the folders. I want to set both Staff and everyone to Read and Write access. Secondly I would like to have a function key set on the desktop to create new folders and set that same access level. The default access is Read and I can not find a way to change that.
Thanks -
Get AD group membership for apple script
Hello All,
I am to create an app that mounts certain network folders with an apple script:
tell application "Finder" to close every window
tell application "Finder" to eject (every disk whose local volume is false)
tell application "Finder"
tell Finder preferences
set desktop shows connected servers to true
set desktop shows external hard disks to true
end tell
end tell
do shell script "killall Finder"
display dialog "Please enter your network username:" default answer "" with title "Network Login" with icon note
set username to text returned of result
display dialog "Please enter your network password:" default answer "" with title "Network Login" with icon note with hidden answer
set userpass to text returned of result
mount volume "smb://" & username & ":" & userpass & "@192.168.1.10/teacherread"
mount volume "smb://" & username & ":" & userpass & "@192.168.1.10/teacherwrite"
mount volume "smb://" & username & ":" & userpass & "@192.168.1.10/home/" & username
mount volume "smb://" & username & ":" & userpass & "@192.168.1.10/steps"
The users are in Active Directory and are in certain groups
I would like to go one step further and add: if in group teachers, and officestaff: mount teacherread, finance etc
The macs are not bound to the domain
Thanks in advance for your help
DanielHi Again,
Another way to look at it might be if error 5014 (don't have permission) try next line
try
mount volume "smb://" & username & ":" & userpass & "@dc1/teacherread"
*if result is error number 5014 goto next command
end try
*try
mount volume "smb://" & username & ":" & userpass & "@dc1/teacherwrite"
*if result is error number 5014
end try
*try
mount volume "smb://" & username & ":" & userpass & "@dc1/home/" & username
*if result is error number 5014
*end try
*Not sure on syntax
Thanks
Daniel -
Help with moving contact info using Apple Script in Address Book
Hi folks,
I wonder if someone can help? I imported a few hundred contacts via a Gmail created vCard into my Address Book. The problem is that instead of inserting the email addresses into one of the email fields for each record, it has inserted the email address into the Notes field as follows: "EmailAddress: [email protected]".
I would like help to write an Apple Script that will search my contacts in Address Book, find those with "EmailAddress:" in the notes field, cut the email address that follows it, and pastes it into the Work Email field, carries out the operation for the whole address book and saves the changes.
Can anyone help me write a script for this. I've not used Apple Script before so this will be my first attempt!
Thanks in advance,
ayworldThis should work:
tell application "Contacts"
activate
set thePeople to every person whose note contains "EmailAddress:"
set {oldTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ":"}
repeat with thePerson in thePeople
set nn to thePerson's note
make new email at end of emails of thePerson with properties {label:"Notes", value:text item 2 of nn}
end repeat
save
end tell
It will leave the entry in notes and make the label of the new email 'Notes"
Normally when I post an AppleScript like this I tell the user to test it out before using it on the actual data but in this case I don;t know how you'd do that given there is only one Contacts and only one Contacts database.
Just make sure you have a backup just in case. I tried it here on some dummy entries in my Contacts and it worked OK.
Again this totaly relies on the data you presented. The Notes field has to be in the format
EmailAddress:[email protected]
for this to work.
regards
Message was edited by: Frank Caggiano - If you select all the text in the box, then right click and select Make new AppleScript the script will open in the AppleScript editor. Just make sure you get all the text it is easy to drop the first or last char when selecting. -
How do I install and apple script in mail
I am using dreamhost as my ISP. I am getting killed with spam and the have a script. I found out how to add the script via the rules function, but, how do you store the script in the location you need to retreive it from. there I can't find info. Can someone give me steps please? Do you make a text file, etc?
Select Mail Help from Mail's Help menu. Search for "install apple script."
Use scripts as rule actions
You can attach a script to a Mail rule. For example, you could have an incoming message trigger a script that copies information from the message and pastes it into a database that works with AppleScript.
Open Mail
Choose Mail > Preferences, then click Rules.
Add a rule or select an existing rule to edit.
Choose Run AppleScript from the “Perform the following actions” pop-up menu.
Choose a script from the pop-up menu of scripts that are located in ~/Library/Application Scripts/com.apple.mail. Or choose “Open in Finder” to open the folder so you can copy a script into it.If you later move or rename the script, your rule will not work.
Click OK to save the rule.
If you used scripts in Mail rules in OS X Lion or earlier, then the first time you open Mail in OS X Mountain Lion or later, your scripts are moved to ~/Library/Application Scripts/com.apple.mail, and your rules are updated with the new location. To show your home Library folder, hold down the Option key, then in Finder choose Go > Library.
If you use iCloud Documents & Data, your rules are available on your other Mac computers (with OS X 10.8 or later) that have iCloud Documents & Data turned on. Scripts attached to rules aren’t available. -
i need to make an apple script that can -
take a snapshot of the screen right before screen saver begins. place it into a specific place and replace the last one that was there.
anyone know how to do this?You might have better luck getting help via the Applescript forum...
http://discussions.apple.com/forum.jspa?forumID=724&start=0
Maybe you are looking for
-
Div options toolbar not displayed correctly in fluid grid layout
When I select an inserted element in fluid grid layout, the options to hide, duplicate or delete the Div are not displayed. I only have the 'move up a row' arrow displayed. How do get the other options to display on the mini toolbar? My DW CS6 versio
-
XSLT and XQuery recommendation for BPEL and OSB
Hi, 1. Why is XQuery recommeded for OSB and XSLT for BPEL. Are there any specific performance optimization reason behind this. 2. Apart from OSB and BPEL, both XSLT and XQuery has xml transformation options and creating HTML. What is the difference b
-
Troubleshooting IC WebClient's Interactive Scripting Runtime
What can you do if when running IC WebClient, scripts don't appear for selection in the dropdown. Here are few things to check if you encounter this symptom. It is described depending on the CRM version you have installed <b> CRM 4.0</b> 1
-
I have a Macbook Air 11" Processor and memory 1.4GHz Intel Core 2 Duo processor with 3MB on-chip shared L2 cache; or optional 1.6GHz Intel Core 2 Duo processor with 3MB shared L2 cache 800MHz frontside bus 2GB of 1066MHz DDR3 SDRAM onboard (4GB maxim
-
How to do Cntrl + arrow option from Windows on a macbook
I'm using parellels to work in microsoft powerpoint. On my PC I can move text boxes tiny spaces by holding the control key and pressing the arrows. How can I do that same thing on a mac? If I use just the arrows it moves it too much. How can I get th