Apple script question
display dialog "Username" default answer ""
set the target_username to the text returned of the result
display dialog "Password" default answer "" with hidden answer
set the pass to the text returned of the result
when i use this i get two differnt windows one asking for the username and then one for the password after the username has been entered
is there a way to make them appear on the same window??
While some who peruse these particular forums have applescript knowledge, most really do not. I'm not ashamed to admit I am relatively new to applescript and can only do basics
Perhaps asking [here|http://discussions.apple.com/forum.jspa?forumID=724] would be more beneficial as those forums are specific to your issue...
Similar Messages
-
Any thoughts why the following script generates will only force a refresh of the smart playlist "Random Country" if Live Updating is turned off. This script works for the other two playlists shown which have Live Updating turned on.
on run
tell application "iTunes"
--delete every track of playlist "Random Christian"
--delete every track of playlist "Mainstream"
delete every track of playlist "Random Country"
end tell
end run
I get the following error why I run the script with Live Updating activated.
error "iTunes got an error: every track of playlist \"Random Country\" doesn’t understand the delete message." number -1708 from every track of playlist "Random Country"
I am currently running iTunes 11.0.2 on OSX 10.8.2Thanks Winston Churchill. I was missing purchased content (cloud stuff) on my ATV2. The problem was with iTunes and many others were having similar problems. I asked them to fix iTunes so it worked, but they insisted on giving me outdated instructions that had no relevance to me. It is very frustrating dealing with them. I intentionally shortened my question when I asked it here just to find out what the directions they gave meant and you have answered that. Thanks again. This is the thread about missing shows:
https://discussions.apple.com/message/16486299#16486299 -
Apple Script "Folder Contents to UPPER or lowercase"
So I use the apple script "Change Case of Item Names" from the "Script Menu" all the time when I need to convert a handful of files because of my OCD organization techniques. One thing that frustrates me is that it will not change ALL files within a folder, within a folder and so on. Say I have a folder with 25 folders, and within each of those folders there are 200 files. I'd like to set the script on that very fist folder to change ALL the contents within it to either UPPER or lower case. Can anyone help me out by giving me a script or navigate me to a script that I've overlooked?
Thanks,
-Zachin the future please post apple script questions in the Apple script forum under mac os x technologies.
the following modification of the built in script should do what you want
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px; height: 335px;
color: #000000;
background-color: #ADD8E6;
overflow: auto;"
title="this text can be pasted into the Script Editor">
try
tell application "Finder" to set the source_folder to (folder of the front window) as alias
on error -- no open folder windows
set the source_folder to path to desktop folder as alias
end try
display dialog "Change case to:" buttons {"Cancel", "UPPER", "lower"}
set the button_pressed to the button returned of the result
tell application "Finder"
repeat with this_item in entire contents of source_folder
set the current_name to the name of this_item as text
if the button_pressed is "lower" then
set the name of this_item to my change_case_of(the current_name, "lower")
else
set the name of this_item to my change_case_of(the current_name, "upper")
end if
end repeat
end tell
beep 2
on change_case_of(this_text, this_case)
if this_case is "lower" then
set the comparison_string to "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
set the source_string to "abcdefghijklmnopqrstuvwxyz"
else
set the comparison_string to "abcdefghijklmnopqrstuvwxyz"
set the source_string to "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
end if
set the new_text to ""
repeat with thisChar in this_text
set x to the offset of thisChar in the comparison_string
if x is not 0 then
set the new_text to (the new_text & character x of the source_string) as string
else
set the new_text to (the new_text & thisChar) as string
end if
end repeat
return the new_text
end change_case_of</pre>
paste it into script Editor and save it in /Library/scripts/Finder Scripts. call it something like "recursive change of names". -
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. -
Apple Script to Sort through the Address Book
Dear All,
I am quite new to Apple and just a learner on Apple-scripts. Its been quite a task to learn.. I would require some help on a few things..
The script will eventually use numbers to send email and get the user inputs and any yet to reach there..
After going through lots of scripts to sort through the address book and make a clean address book, i found they are quite slow in processing takes about 20~30 Minutes to get through 2000 Contacts..
Hence after reading posting of Mr. Koenig & Mr. Hiroto and specifically on deep copy. I have written the following code which does the following on 2000 records within 6~8Mins.
The Script work its way through all the contact is the address List.. and creates Groups
1. Duplicate Email Id's — List of Contacts with same email ID's including Contacts where the email Id is entered twice.. (Strange.. Address Book Issue, copy of the email Id under work & home)
2. Duplicate Phone — List of Contacts with same Phone Numbers including Contacts where the Phone Nos is entered twice.
3. Duplicate Name — List of Contacts with Same Names
4. Duplicate No Name — List of Contacts without the First Name and Last Name
it also sort the Contacts under the following Group which you can edit later with all the information's..
1. Only Email Ids — List of Contacts with Email ID and No Phone Numbers
2. Only Phone — List of Contacts with Phone Numbers and No Email Id's
3. No Email or Phone — List of Contacts with No Email Id's and No Phone numbers (some half completed contacts )
My Question to the forum is why is the following code still taking too much time..
set onlyDupEList to every person of group theGroupEmail
repeat with j from 1 to count of Dup_email
set tempdata to item j of Dup_email
if onlyDupEList does not contain {tempdata} then add tempdata to group theGroupEmail
end repeat
save application "Address Book"
and the scripts slows down when the items in the list is quite large (over 800 or so )..
Any help is appreciated and thanks in advance..
-- the code ---
global MsgTitle
on run
set MsgTitle to "Search for Duplicates in Address Book Contacts"
display dialog ¬
"This Script takes a while to finish" & return & "maybe 10 min or More..." & return & "Depending on the Address Book Contacts." & return & return & "Hence Allow it to run for the while" with title MsgTitle ¬
with icon 1 ¬
buttons {"Continue"} ¬
giving up after 5
set question to display dialog "Select the Duplicate Search Parameter " with icon 1 with title MsgTitle ¬
buttons {"Contact Name", "Contacts on Phone & Email Id's", "Quit"} default button 3
set rtnValue to button returned of question
if rtnValue is "Quit" then
-- tell application "Address Book" to quit
tell me to quit
end if
if rtnValue is "Contact Name" then
-- tell application "Address Book" to quit
GetDup_byName("Duplicate Name")
end if
if rtnValue is "Contacts on Phone & Email Id's" then --Contacts on Phone & Email Id's
-- tell application "Address Book" to quit
Get_dup()
end if
end run
--- Search on Name Field ---
on GetDup_byName(theGroupName)
set question to display dialog "Do you want to search for duplicates based on Names? " with icon 0 with title MsgTitle ¬
buttons {"Continue", "Quit"} default button 1
set rtnValue to button returned of question
if rtnValue is "Quit" then
-- tell application "Address Book" to quit
tell me to quit
end if
tell application "Address Book"
activate
set biglist to {}
set NoNameList to {}
set theGroupNoName to "Duplicates No Names"
set theGroup to theGroupName
-- if not (exists (group "Dupilicate Entries")) then
if not (exists (group theGroup)) then
make new group with properties {name:theGroup}
save
end if
if not (exists (group theGroupNoName)) then
make new group with properties {name:theGroupNoName}
save
end if
set the_names to name of people
repeat with i from 1 to number of items in the_names
set theName to item i of the_names
-- return theName
if theName is not in biglist then
copy theName to end of biglist
else
set counter to (people whose name is theName)
if (count of counter) > 1 then
repeat with i from 1 to number of items in counter
set this_item to item i of counter
-- display dialog this_item
add this_item to group theGroup
end repeat
-- return counter as string
end if
end if
-- captures the Contacts without Name ---
if theName contains "@" then
-- display dialog theName
set counterList to (people whose name is theName)
repeat with i from 1 to number of items in counterList
set this_item to item i of counterList
-- display dialog this_item
add this_item to group theGroupNoName
end repeat
end if
-- save application "Address Book"
end repeat
save application "Address Book"
set peopleCount to (count every person)
-- set peopleCount to 50 -- only for testing --
repeat with i from 1 to peopleCount
set first_name to first name of person i as string
set Last_Name to last name of person i as string
if first_name is equal to "missing value" and Last_Name is equal to "missing value" then
-- display dialog first_name & " : " & Last_Name
set end of NoNameList to (id of person i)
end if
end repeat
repeat with j from 1 to the count of NoNameList
set tempdata to item j of NoNameList
-- set testdata to person id tempdata
-- if (name of groups of testdata does not contain theGroupNoEmail) then
add tempdata to group theGroupNoName
-- end if
end repeat
save application "Address Book"*)
display dialog ¬
"This Script Finished Processing Address Book Contacts the Duplicates are in the group" with title MsgTitle ¬
with icon 1 ¬
buttons {"Continue"} ¬
giving up after 5
end tell
end GetDup_byName
on Get_dup()
set question to display dialog "Do you want to search for duplicates based on Names? " with icon 0 with title MsgTitle ¬
buttons {"Continue", "Quit"} default button 1
set rtnValue to button returned of question
if rtnValue is "Quit" then
-- tell application "Address Book" to quit
tell me to quit
end if
tell application "Address Book"
activate
set theGroupEmail to "Duplicate Email Id's"
set theGroupPhone to "Duplicate Phone"
set theGroupNoEmail to "Only Phone Numbers"
set thegroupNoPhone to "Only Email Id's"
set theGroupNoData to "No Email or Phone"
-- set theGroup to theGroupName
if not (exists (group theGroupEmail)) then
make new group with properties {name:theGroupEmail}
save "Address Book"
end if
if not (exists (group theGroupPhone)) then
make new group with properties {name:theGroupPhone}
save "Address Book"
end if
if not (exists (group theGroupNoEmail)) then
make new group with properties {name:theGroupNoEmail}
save "Address Book"
end if
if not (exists (group thegroupNoPhone)) then
make new group with properties {name:thegroupNoPhone}
save "Address Book"
end if
if not (exists (group theGroupNoData)) then
make new group with properties {name:theGroupNoData}
save "Address Book"
end if
set ListofPeople to people --the_ID
set ListofEmailID to value of emails of people --the_emails
-- return ListofEmailID
set ListofPhones to value of phone of people -- the_phones
-- return ListofPhones
set biglist to {}
set ListEmail_Uniq to {}
set ListEmail_Dup to {}
set No_PhoneList to {}
set No_EmailList to {}
set No_dataList to {}
set FlagEmail to false
set FlagPhone to false
-- repeat with i from 1 to number of items in the_emails
repeat with i from 1 to count of ListofEmailID
set thePersonID to item i of ListofPeople
set theEmails to item i of ListofEmailID
if theEmails is equal to {} then
set end of No_EmailList to thePersonID
else
-- set FlagEmail to true
repeat with j from 1 to count of theEmails
set tmpdata to item j of theEmails
-- return tmpdata
if tmpdata is not in biglist then
set end of biglist to tmpdata
set end of ListEmail_Uniq to {tmpdata} & {thePersonID}
else
set end of ListEmail_Dup to {tmpdata} & {thePersonID}
end if
end repeat
end if
end repeat
-- return ListEmail_Uniq
-- return ListEmail_Dup
-- save application "Address Book"
set biglist to {}
set ListPhone_Uniq to {}
set ListPhone_Dup to {}
-- repeat with i from 1 to number of items in the_emails
repeat with i from 1 to count of ListofPhones
set thePersonID to item i of ListofPeople
set thePhones to item i of ListofPhones
if thePhones is equal to {} then
set end of No_PhoneList to thePersonID
else
-- set FlagPhone to true
repeat with j from 1 to count of thePhones
set tmpdata to item j of thePhones
-- return tmpdata
if tmpdata is not in biglist then
set end of biglist to tmpdata
set end of ListPhone_Uniq to {tmpdata} & {thePersonID}
else
set end of ListPhone_Dup to {tmpdata} & {thePersonID}
end if
end repeat
end if
end repeat
-- return ListPhone_Uniq
-- return ListPhone_Dup
set the Dup_email to {}
-- Find the Duplicates from the sorted list --
repeat with i from 1 to the count of ListEmail_Dup
set tempdata to item i of ListEmail_Dup
set dataEmailDup to item 1 of tempdata
set dataPersonDup to item 2 of tempdata
repeat with j from 1 to the count of ListEmail_Uniq
set tempdata to item j of ListEmail_Uniq
set dataEmailUniq to item 1 of tempdata
set dataPersonUniq to item 2 of tempdata
-- display dialog mainEmail1 & "=" & mainEmail2 & " " & mainID1 & "=" & mainID2
if dataEmailDup is equal to dataEmailUniq then
set end of Dup_email to dataPersonDup -- & "," & dataPersonUniq
set end of Dup_email to dataPersonUniq
end if
(* -- the code takes lot more time if add to group was used --
if dataEmailDup is equal to dataEmailUniq then
set testdata to person id dataPersonDup
add testdata to group theGroup
set testdata to person id dataPersonUniq
add testdata to group theGroup
end if
end repeat
end repeat
-- return Dup_email
set the Dup_Phone to {}
-- Find the Duplicates from the sorted list --
repeat with i from 1 to the count of ListPhone_Dup
set tempdata to item i of ListPhone_Dup
set dataPhoneDup to item 1 of tempdata
set dataPersonDup to item 2 of tempdata
repeat with j from 1 to the count of ListPhone_Uniq
set tempdata to item j of ListPhone_Uniq
set dataPhoneUniq to item 1 of tempdata
set dataPersonUniq to item 2 of tempdata
-- display dialog mainEmail1 & "=" & mainEmail2 & " " & mainID1 & "=" & mainID2
if dataPhoneDup is equal to dataPhoneUniq then
set end of Dup_Phone to dataPersonDup -- & "," & dataPersonUniq
set end of Dup_Phone to dataPersonUniq
end if
(*if dataPhoneDup is equal to dataPhoneUniq then
set testdata to person id dataPersonDup
add testdata to group theGroup
set testdata to person id dataPersonUniq
add testdata to group theGroup
-- save
end if*)
end repeat
end repeat
-- return Dup_Phone
set onlyDupEList to every person of group theGroupEmail
repeat with j from 1 to count of Dup_email
set tempdata to item j of Dup_email
if onlyDupEList does not contain {tempdata} then add tempdata to group theGroupEmail
end repeat
save application "Address Book"
set onlyDupPList to every person of group theGroupPhone
repeat with j from 1 to count of Dup_Phone
set tempdata to item j of Dup_Phone
if onlyDupPList does not contain {tempdata} then add tempdata to group theGroupPhone
end repeat
save application "Address Book"
set onlyPhoneList to every person of group theGroupNoEmail
repeat with j from 1 to the count of No_EmailList
set tempdata1 to item j of No_EmailList
if No_PhoneList does not contain {tempdata1} then
if onlyPhoneList does not contain {tempdata1} then add tempdata1 to group theGroupNoEmail
end if
(*set flagE to false
repeat with i from 1 to the count of No_PhoneList
set tempdata2 to item i of No_PhoneList
if tempdata1 is equal to tempdata2 then
set flagE to true
exit repeat
end if
end repeat
if flagE is false then add tempdata1 to group theGroupNoEmail*)
end repeat
save application "Address Book"
set onlyEmailList to every person of group thegroupNoPhone
repeat with j from 1 to the count of No_PhoneList
set tempdata1 to item j of No_PhoneList
if No_EmailList does not contain {tempdata1} then
if onlyEmailList does not contain {tempdata1} then add tempdata1 to group thegroupNoPhone
end if
end repeat
save application "Address Book"
set onlyList to every person of group theGroupNoData
repeat with i from 1 to count of ListofPeople
if (item i of ListofEmailID is equal to {}) and (item i of ListofPhones is equal to {}) then
set tempdata to item i of ListofPeople
if onlyList does not contain {tempdata} then add tempdata to group theGroupNoData
end if
end repeat
save application "Address Book"
display dialog ¬
"This Script Finished Processing Address Book Contacts the Duplicates are in the group" with title MsgTitle ¬
with icon 1 ¬
buttons {"Continue"} ¬
giving up after 5
end tell
end Get_dup
on quit
--set MsgTitle to "Change Email ID's Domain Name"
save application "Address Book"
display dialog "Contact Srikanth Kamath at [email protected] for any Help" with title MsgTitle with icon 1 buttons "OK"
continue quit
end quitHello Srikanth Kamath,
I'm not sure you're still following this thread, but anyway here's sample code I said I'd post later.
--SCRIPT2
main()
on main()
script o
-- input data
property xx : {1, 2, 3, 4, 5} -- list of parents
property yy : {{"g", "h"}, {"a", "b"}, {"b", "e", "f"}, {"e"}, {"c", "d"}} -- list of children per parent
-- work list
property pp : {} -- list of children tagged by parent; i.e, lits of {child, parent}
property qq : {}
property rr : {}
-- (1) build list of children tagged by parent
repeat with i from 1 to count my xx
set x to my xx's item i
set y to my yy's item i
repeat with p in y
set end of my pp to {p's contents, x}
end repeat
end repeat
--return pp -- {{"g", 1}, {"h", 1}, {"a", 2}, {"b", 2}, {"b", 3}, {"e", 3}, {"f", 3}, {"e", 4}, {"c", 5}, {"d", 5}}
-- (2) sort tagged list by child as key
msort(my by_key1, my pp)
--return pp -- {{"a", 2}, {"b", 2}, {"b", 3}, {"c", 5}, {"d", 5}, {"e", 3}, {"e", 4}, {"f", 3}, {"g", 1}, {"h", 1}}
-- (3) retrieve parents with duplicate child
(* retrieve list of {child, parent} for duplicate child *)
set my qq to uniq(my eq_key1, my pp, {_dup:true})
--return qq -- {{"b", 2}, {"b", 3}, {"e", 3}, {"e", 4}}
(* retrieve list of parent *)
repeat with q in my qq
set r to q's item 2
if r is not in my rr then set end of my rr to r
end repeat
return rr -- {2, 3, 4}
end script
tell o to run
end main
on by_key1(x, y)
msort's comparator for list of lists
key = item 1, ascending
returns true iff x and y are out of order
return x's item 1 > y's item 1
end by_key1
on eq_key1(x, y)
uniq's comparator for list of lists
key = item 1
returns true iff x and y are considered equal
return x's item 1 = y's item 1
end eq_key1
on msort(cmp_, aa) -- v1.2f2
Basic recursive merge sort handler having list sorted in place.
handler cmp_ : comparator
* cmp_(x, y) must return true iff list element x and y are out of order.
list aa : list to be sorted in place
script o
property parent : {} -- limit closure to minimum
property xx : aa -- to be sorted in place
property xxl : count my xx
property yy : {}
property cmp : cmp_
on merge(p, q, r)
property xx: source list
integer p, q, r : absolute indices to specify range to be merged such that
xx's items p thru r is the target range,
xx's items p thru (q-1) is the first sublist,
xx's items q thru r is the second sublist.
(p < q <= r)
local i, j, k, xp, xr, yi, yj, ix, jx
if r - p = 1 then
set xp to my xx's item p
set xr to my xx's item r
if my cmp(xp, xr) then
set my xx's item p to xr
set my xx's item r to xp
end if
return -- exit
else
if p < q - 1 then merge(p, (p + q) div 2, q - 1)
merge(q, (q + r + 1) div 2, r)
end if
At this point, sublits xx[p, q-1] and xx[q, r] have been already sorted (p < q <= r)
if my cmp(my xx's item (q - 1), my xx's item q) then
else -- xx[p, q-1] & xx[q, r] are already sorted
return
end if
set yy to my xx's items p thru r -- working copy for comparison
set ix to q - p
set jx to r - p + 1
set i to 1
set j to q - p + 1
set k to p
set yi to my yy's item i
set yj to my yy's item j
repeat
if my cmp(yi, yj) then
set my xx's item k to yj
set j to j + 1
set k to k + 1
if j > jx then
set my xx's item k to yi
set i to i + 1
set k to k + 1
repeat until k > r
set my xx's item k to my yy's item i
set i to i + 1
set k to k + 1
end repeat
return
end if
set yj to my yy's item j
else
set my xx's item k to yi
set i to i + 1
set k to k + 1
if i > ix then
set my xx's item k to yj
set j to j + 1
set k to k + 1
repeat until k > r
set my xx's item k to my yy's item j
set j to j + 1
set k to k + 1
end repeat
return
end if
set yi to my yy's item i
end if
end repeat
end merge
on cmp(x, y)
(* primary comparator *)
return x > y
end cmp
local d, i, j
if xxl ≤ 1 then return
if cmp_ = {} then set my cmp to cmp -- comparator fallback
my merge(1, (xxl + 1) div 2, xxl)
end script
tell o to run
end msort
on uniq(eq_, aa, {dup:dup}) -- v0.21
handler eq_ : comparator eq_(x, y) that returns true iff x and y are considered equal
list aa : pre-sorted list
(precisely, a list organized such that any duplicate items are adjacent to each other)
boolean _dup : option whether return unique items or duplicate items
return duplicate if true, unique otherwise.
script o
property parent : {} -- limit closure to minimum
property xx : aa
property yy : {}
property eq : eq_
on eq(x, y)
(* primitive comparator *)
x = y
end eq
if eq_ = {} then set my eq to my eq -- comparator fallback
local t, x, _on
if (count my xx) < 2 then return my xx's contents
if _dup then
set _on to false
set t to my xx's item 1
repeat with i from 2 to count my xx
set x to my xx's item i
if eq(x, t) then
set end of my yy to t
set _on to true
else if _on then
set end of my yy to t
set _on to false
end if
set t to x
end repeat
if _on then set end of my yy to x
return my yy's contents -- return duplicate elements
else
set t to my xx's item 1
set end of my yy to t
repeat with i from 2 to count my xx
set x to my xx's item i
if eq(x, t) then
else
set end of my yy to x
set t to x
end if
end repeat
return my yy's contents -- return uinque elements
end if
end script
tell o to run
end uniq
--END OF SCRIPT2
In order to apply it to your current Address Book problem, replace the main() handler with something like the following one.
--SCRIPT2a (part)
on main()
script o
-- input data
property xx : {} -- list of parent; given later
property yy : {} -- list of children per parent; given later
-- work list
property pp : {} -- list of children tagged by parent; i.e, lits of {child, parent}
property qq : {}
property rr : {}
-- (0) get input data from AB
tell application "Address Book"
tell people
set xx to its id
set yy to its every email's value
end tell
end tell
-- (1) build list of children tagged by parent *)
(* omitted (same as the previous) *)
-- (2) sort tagged list by child as key
(* omitted (same as the previous) *)
-- (3) retrieve parents with duplicate child
(* omitted (same as the previous) *)
-- (4) group the retrieved people in AB
tell application "Address Book"
repeat with r in my rr
add person id r to group "duplicate email"
end repeat
end tell
end script
tell o to run
end main
--END OF SCRIPT2a
Good luck,
Hiroto
Message was edited by: Hiroto -
Airport and Apple Script - on and off script
I've had this problem for a while, trying to turn the airport card in a computer on and off using and apple script. i need it to automatically turn on or off depending on which account if logging into the computer.
I did find that a solution can be found by writing an apple script to turn airport on and off. but my scripting skills aren't good and haven't worked thus far.
So now i'm asking everyone: Can anyone write a script to turn the airport on or off? I bet you can't. (there's some motivation for you)
I think it's my last resort, turning to other apple user and requesting help, because i have not been able to find another solution or a prewritten script (surprisingly)
Thanks very much for your help!
"i'll gladly pay you tuesday for a an apple script today."
thanksI haven't used these tools so I don't know for sure, but doesn't Tiger's parental controls (in the Accounts preference pane) allow you to enable/disable network access by account? Would that work to solve your problem?
EDIT: OK, by starting a new thread I guess you got the same response that I posted for your previous thread. For those interested, this is a continuation of the thread kevin macky, "Account with and without airport internet access", 08:07am Oct 11, 2005 CDT.
If you are interested in trying to automate this, I suggest that you post your question in these areas:
Mac OS X > Mac OS X Technologies > AppleScript
Mac OS X > Mac OS X v10.4 Tiger > Automator -
Apple Script command on background image
Hello,
So the thing is.
I want to creat this apple script that would react only when i switch to a certain space.
I searched in the interent and found out that the Mac has no easy way of finding out, on which space it is on, so my questions is.
Would it know what background image is on that space, so that if I changed to a certain space, it would recognise the background image file, and run my script.
I have just thought of this my self, so I will be testing too.
But I wanted to know if anyone one els out there has thought of it first and found an answer.
Thank youPlease consider submitting an enhancement request to Apple, requesting that information on the spaces be made available to applications and scripts.
-
Vocal command:how Apple script ?
Hello, i'm new and i've got a question about Apple Script.
I want to use the Vocal Recognition for my app, is it possible?
For example, i say to my computer "open safari and search to google "APPLE"" end the computer do that.
I know that there is a similar program on the Preferences but i wan't to do another app to learn how to use the apple script.
Thank you, bye!Try this
-- Script Start
set answer to text returned of (display dialog "Press the function key twice and talk" default answer "" buttons {"OK"} default button 1)
if answer contains "open safari" and answer contains "google" then
set search to text ((offset of "google" in answer) + 6) thru -1 of answer
tell application "Safari"
open location "https://www.google.com/search?q=" & search & "&oq=" & search & "&aqs=chrome..69i57j0l5.1526j0j1&sourceid=chrome&espv=210&es_sm=91&ie=UTF-8/"
end tell
end if
-- Script End
Hopt this helps -
Apple script constantly says can get end (-1728)
Hi,
my apple script always will say cant get end
Here is my script
set question to display dialog "Would you like to force empty the trash" buttons {"Empty", "Force Empty", "Cancel"} default button 2
set answer to button returned of question
if answer is equal to "Force Empty" then
do shell script "rm -rf ~/.Trash/*"
if answer is equal to "Empty" then
tell application "Finder"
empty trash
end tell
end if
end if
should i try using the else function instead?
ThanksYes you should be using if else (or just else).
Looking at your code formatted like so
if answer is equal to "Force Empty" then
do shell script "rm -rf ~/.Trash/*"
if answer is equal to "Empty" then
tell application "Finder"
empty trash
end tell
end if
end if
you can see that if the answer is not equal to "Force Empty" then the script just exits. The answer is never checked for "Empty"
So something like
if answer is equal to "Force Empty" then
do shell script "rm -rf ~/.Trash/*"
else if answer is equal to "Empty" then
tell application "Finder"
empty trash
end tell
end if
would be more correct. However two issues one you are not checking if the user presses cancel. And two emptying the Trash by doing a rm in the shell should not be needed. If it is you have other problems that should be addressed.
regards
end if
end -
KeyNotes and Apple script / scripting Bridge
Hi
Sorry I am a recently started development in Mac OS, so may be this question is very simple for you guys
actually I am looking to manage Keynote application automatically from Mac Server application, I know apple script is available for lot of functionalities available in keynote but i want that all these things happend without showing anything on GUI , like i want to do all the automation on background without effecting the running GUI of keynote
if anybody can have idea how to do it in Apple script or using ScriptingBridge, I will really appriciate your help and supportdepending on what you want to do, this may or may not be possible (most likely not). Applescript works by scripting other applications: some applications are set up do do background tasks, some applications are duplicated by osax or unix utilities that operate invisibly, but most often applescript has to open a document in the application and work on it through the application.
scripting bridge is for cocoa developers: it allows cocoa apps to script other apps. it's not really useful for you unless you want to develop specialized software.
more details would be helpful. -
Apple Script - Simple Navigation thru Preferences
Howdy,
I'm trying to us Apple Script to simply change my Network Location. I thought it would be easy, I must be missing something. Here is the code I've written so far that works...
tell application "System Preferences"
activate
set current pane to pane "Network"
end tell
Now, I want to change the Location field (I believe it's called an anchor) to my secondary (Home, for example). So, I added a line like such...
tell application "System Preferences"
activate
set current pane to pane "Network"
set anchor to "Location"
end tell
This 4th line doesn't work, but you get the idea. I have written many variations of this 4th line (i.e. 'set "Location" to "Home"'), nothing seems to work. And there doesn't seem to be much documentation on anchors (other than what's in the Dictionary).
Recording doesn't save it, so that's out of the question.
Does anyone have any ideas?? Thanks.
Bryan
iMac Intel Mac OS X (10.4.7)
iMac Intel Mac OS X (10.4.7)Surround the line...
click button "Apply" of sheet 1
... with 'try ... end try', as shown below ...
try
click button "Apply" of sheet 1 -- Select the'Apply' button of drop down sheet.
end try
Full code, with comments:
property tMenu : "Home" -- The menu item to select.
tell application "System Preferences" -- Launch application
activate
set current pane to pane "com.apple.preference.network" -- Select 'Network' utility.
end tell
tell application "System Events" to tell process "System Preferences"
tell window 1
click pop up button 1 -- Select the 'Localtion' popup button.
click menu item tMenu of menu 1 of pop up button 1 -- Select the 'tMenu' menu item.
click button "Apply Now" -- Select the 'Apply Now' button.
click button 1 -- Select the Close button.
try
click button "Apply" of sheet 1 -- Select the'Apply' button of drop down sheet.
end try
end tell
end tell -
Running an apple script from excel
I have been trying to find some visual basic code to run an apple script from an excel workbook for weeks now, but after searching everehwere online and asking in multiple excel forums I have yet to find an answer. It appears it should be possible (as windows users of excel are able to do it, although running different files not apple scripts), but I cant get it to work on a mac, and I have not been able to come accross someone that is running excel on OSX that has an answer. Hoping I can find some mac excel users with apple script and visual basic knowledge here that might have an answer.
This is a link to the question I posted on excel forum a couple of weeks ago:
http://www.excelforum.com/excel-programming-vba-macros/962375-vb-code-to-run-a-f ile-on-mac.htmlI use http://macchampion.com/scenario_features.shtml
dual-core G5/2.3 Mac OS X (10.4.6) dual screens -
Apple Script to Check for System as well as Applications Updates?
Hi,
I was wondering if someone has created an Apple Script to check for Finder as well as Applications updates automatically.
Thanks,
Nawaf
MacBook 13" 2Ghz 2GB Mac OS X (10.4.7)There wouldn't be any updates to the Finder separately. Any system updates are announced by Apple when they're available, and this is what the Software Update feature is for.
If you go to System Preferences->Software Update, you can set it to automatically check for updates, or you can check manually. Monthly is usually the best schedule to check for updates, as Apple doesn't often release things on any quicker schedule.
Mulder
If this answered you question, please consider awarding some points. Why Reward Points?
iMac G4 700Mhz Mac OS X (10.3.9) -
Apple script to turn AirPort on/off?
Is there a way to use Apple script to turn an AirPort Extreme on and off?
I haven't used these tools so I don't know for sure, but doesn't Tiger's parental controls (in the Accounts preference pane) allow you to enable/disable network access by account? Would that work to solve your problem?
EDIT: OK, by starting a new thread I guess you got the same response that I posted for your previous thread. For those interested, this is a continuation of the thread kevin macky, "Account with and without airport internet access", 08:07am Oct 11, 2005 CDT.
If you are interested in trying to automate this, I suggest that you post your question in these areas:
Mac OS X > Mac OS X Technologies > AppleScript
Mac OS X > Mac OS X v10.4 Tiger > Automator -
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)
Maybe you are looking for
-
Word wrap works only selectively
Hi I'm experiencing the following effect in Discoverer Plus (10.1.2.54.25).: Situation Crosstab worksheet with several dimensions on the side. All dimensions have word warp activated. Problem Word wrap works only for the dimension that is the furthes
-
Question re navigating back to link in large combined document.
In a large, combined PDF, which consists of a 55-page legal brief and all the references it cites to, I have created links to the exact pages cited. How do I get back to where I was when I clicked the link???
-
Hi Sap Guru's, I am having problem with SKF.I am doing cost center allocation through assessment. I am using SKF for it.For each period I am punching the values for SKF.Now the problem is when we run assessment it picks the receiving cost center for
-
Need tutorial on how to produce video
I can't find this anywhere. I need to find a tutorial of some kind that will teach me how to produce video using still images and vector art among other non-video things. It needs to be from the ground up as I've really only been poking around in it
-
EPMA Period Dimension - cannot move Base members
I am trying to move Periods out of Quarters and under YearTotal in an already deployed application in EPMA (Planning app). I want to have YearTotal above Jan-Dec, and Q1-Q4 as Dynamic Calcs with months shared below. This is all well and good in plann