How do I edit this script (newbie)

Editing a script
I found a script that creates a reminder event based upon the birthdays of my contacts in Address Book. It looks forward one week at a time.
I'm not familiar with creating scripts. How would I edit this to do the following (if possible)
1- I set up a contact list in Address Book for only those people whose birthdays I want to be reminded of. Is it possible to have this script only look through this contact list, not every contact.
2- Can it also be set up to delete the previously set events (so that the only events that appear are the ones for the ensuing week)
3- Can it be set up to remind me of anniversaries also? How would I edit it? (I tried to find and replace the term birthday with anniversary, but all it did was notify me of forthcoming week's birthdays but called them anniversaries)
Thanks!
===============
birthdayAlert.scpt
User set variables
set numberDaysNotice to 1 -- how many days before the birthday to alert you, 0 is that day
set timeOfNotification to 5 -- the hour you want the notification
set selectedCalender to "Birthday Reminders" -- the calender in iCal you want to add the events to
Setup
set birthdayPeople to {}
set birthdayDates to {}
Get the current date & next week
set today to current date
set nextWeek to today + (60 * 60 * 24 * 7)
Loop through everyone in the Address Book
tell application "Address Book"
set peopleArray to the name of every person
repeat with i from 1 to count of peopleArray
set thisPerson to person i
set thisBirthday to birth date of thisPerson
Check if they've got a birthday entered on their card
if thisBirthday is not equal to (missing value) then
set year of thisBirthday to year of (current date) -- otherwise it uses their birth year
See if it's in the next week
if (thisBirthday is greater than today) and (thisBirthday is less than nextWeek) then
set thisBirthday_day to day of thisBirthday
set thisBirthday_month to month of thisBirthday
Add them to our list
set birthdayPeople to birthdayPeople & name of thisPerson
set birthdayDates to birthdayDates & birth date of thisPerson
end if
end if
end repeat
end tell
If we have birthday's go into iCal and add the alerts
if (count of birthdayPeople) is greater than 0 and ((count of birthdayPeople) is equal to (count of birthdayDates)) then
tell application "iCal"
tell calendar selectedCalender
repeat with i from 1 to count of birthdayPeople
set thisDate to item i of birthdayDates
set year of thisDate to year of today
set time of thisDate to (60 * 60) * timeOfNotification
set day of thisDate to (day of thisDate) - numberDaysNotice
set thisEvent to make new event at end with properties {description:"", summary:(item i of birthdayPeople) & "'s Birthday", location:"", start date:thisDate, end date:thisDate + 15 * minutes}
tell thisEvent
make new display alarm at end with properties {trigger interval:0}
end tell
end repeat
end tell
end tell
end if

1- I set up a contact list in Address Book for only those people whose birthdays I want to be reminded of. Is it possible to have this script only look through this contact list, not every contact.
Sure - if you created a specific group of the people you want to track then just change the line:
set peopleArray to the name of every person
to:
set peopleArray to the name of every person of group "Birthdays"
(or whatever group name you used). You see, as written your script just grabs everyone's name as opposed to just the names of people in the specific group.
2- Can it also be set up to delete the previously set events (so that the only events that appear are the ones for the ensuing week)
Yes, but that's a little trickier since you need some way to denote which events are birthday events vs. other events from last week. If you're using a specific calendar for this then you could just delete existing events in that calendar, or you could implement a minor change to the way you create events - use the description to identify this is one of your auto-created birthday alarms:
set thisEvent to make new event at end with properties {description:"birthday", summary:(item i of birthdayPeople) & "'s Birthday", location:"", start date:thisDate, end date:thisDate + 15 * minutes}
So now the events will have a specific description, so it's easy to start your new script off with a line that deletes existing 'birthday" events, via:
tell application "iCal"
  delete every event of calendar selectedCalendar whose description = "birthday"
end tell
(you can nix the '... whose description = "birthday"' element if you just want to delete all existing events in the calendar).
3- Can it be set up to remind me of anniversaries also? How would I edit it? (I tried to find and replace the term birthday with anniversary, but all it did was notify me of forthcoming week's birthdays but called them anniversaries)
Sure, that's because you specifically ask Address Book for birthdays:
set thisBirthday to birth date of thisPerson
To track anniversaries you need to ask Address Book for different data. This one's a little tricker since anniversaries are tracked via the custom date element, so you'd need something like:
set anniversaryList to {}
tell application "Address Book"
  repeat with eachPerson in (get every person) -- add 'of group "anniversaries' if you use a specific group
    repeat with eachDate in eachPerson's custom dates
      if label of eachDate = "anniversary" then
        -- this person has an Anniversary set, so add your code here to check if eachDate is in the next week if it is:
        copy eachPerson to end of anniversaryList
      end if
    end repeat
  end repeat
end tell
At the end of this you'll have a list of people whose anniversary is upcoming and you can duplicate your iCal code to add anniversary events in addition to birthdays.

Similar Messages

  • I am trying to register on icloud however it says to check email however the email address is incorrect - how do I edit this?

    I am trying to register on icloud (and back up) however it says to vertify my account and check my email to follow instructions.  However the email that icloud is sending to is incorrect.   How can I edit this email?

    It's easy to accidentally enter the wrong thing when you're so used to being asked for the Apple ID password.
    Good to hear that sorted things out
    ~Lyssa

  • How can I edit this number that I have not in my ordinary contact list, before redial?

    Whats up, fellows?
    I want to redial for a last number that called me, however I need to increase numbers (as country code, carrier code or something like that) on this number, how can I edit this number that I have not in my ordinary contact list, before redial?
    Tks,

    That is discouraging.  However I do notice that if I view my podcasts in My Podcasts mode they are grouped and sorted better than in Unplayed mode and the ones in the cloud are not shown. However although I prefer the one window view of List mode to the two windows My Podcast mode, My Podcast mode does at least indicate how many unplayed episodes I have from each podcast.  This would almost be acceptable except that partially listened to podcasts, while still there, can only be identified by highlighting the podcast title on the lefthand sidebar, (although the number of completely unplayed episodes are listed on the left hand sidebar).  As someone who often listens to a podcast over two or more days I fear I could forget which ones I have only partially listened to and would have to go down the entire left hand sidebar list highlighting each podcast to remind myself.  I really find the List mode the most informative and easiest way to view my podcasts and really wish Apple had not messed with it

  • How disable JSF2 edit my script tag?

    I am using jsf2. Problem is the script tag being edited to append closing script tag. It cause the jquery not work(I also not sure why but it does not work when i come with closing tag). How to disable jsf to format my script tag?
    original
    <script src="/jquery/menu/demo/jquery.dimensions.min.js"/>
    output
    <script src="/jquery/menu/demo/jquery.dimensions.min.js"><!--
    //--></script>

    am not sure, try with this
    <script src="/jquery/menu/demo/jquery.dimensions.min.js" type="text/javascript" > </script>

  • My itunes library contains two of end title. How can I edit this??

    My itunes library contains two of each title. How can I easily edit this????

    I've written a script called DeDuper which can help remove unwanted duplicates. See this  thread for background.
    tt2

  • How can I modify this script to return only certain rows of my mySQL table?

    Hi there,
    I have a php script that accesses a mySQL database and it was generated out of the Flex Builder wizard automatically. The script works great and there are no problems with it. It allows me to perform CRUD on a table by calling it from my Flex app. and it retrieves all the data and puts it into a nice MXML format.
    My question, currently when I call "findAll" to retrieve all the data in the table, well, it retrieves ALL the rows in the table. That's fine, but my table is starting to grow really large with thousands of rows.
    I want to modify this script so that I can pass a variable into it from Flex so that it only retrieves the rows that match the "$subscriber_id" variable that I pass. In this way the results are not the entire table's data, only the rows that match 'subscriber_id'.
    I know how to pass a variable from Flex into php and the code on the php side to pick it up would look like this:
    $subscriberID = $_POST['subscriberID'];
    Can anyone shed light as to the proper code modification in "findAll" which will take my $subscriberID variable and compare it to the 'subscriber_id' field and then only return those rows that match? I think it has something to do with lines 98 to 101.
    Any help is appreciated.
    <?php
    require_once(dirname(__FILE__) . "/2257safeDBconn.php");
    require_once(dirname(__FILE__) . "/functions.inc.php");
    require_once(dirname(__FILE__) . "/XmlSerializer.class.php");
    * This is the main PHP file that process the HTTP parameters,
    * performs the basic db operations (FIND, INSERT, UPDATE, DELETE)
    * and then serialize the response in an XML format.
    * XmlSerializer uses a PEAR xml parser to generate an xml response.
    * this takes a php array and generates an xml according to the following rules:
    * - the root tag name is called "response"
    * - if the current value is a hash, generate a tagname with the key value, recurse inside
    * - if the current value is an array, generated tags with the default value "row"
    * for example, we have the following array:
    * $arr = array(
    *      "data" => array(
    *           array("id_pol" => 1, "name_pol" => "name 1"),
    *           array("id_pol" => 2, "name_pol" => "name 2")
    *      "metadata" => array(
    *           "pageNum" => 1,
    *           "totalRows" => 345
    * we will get an xml of the following form
    * <?xml version="1.0" encoding="ISO-8859-1"?>
    * <response>
    *   <data>
    *     <row>
    *       <id_pol>1</id_pol>
    *       <name_pol>name 1</name_pol>
    *     </row>
    *     <row>
    *       <id_pol>2</id_pol>
    *       <name_pol>name 2</name_pol>
    *     </row>
    *   </data>
    *   <metadata>
    *     <totalRows>345</totalRows>
    *     <pageNum>1</pageNum>
    *   </metadata>
    * </response>
    * Please notice that the generated server side code does not have any
    * specific authentication mechanism in place.
    * The filter field. This is the only field that we will do filtering after.
    $filter_field = "subscriber_id";
    * we need to escape the value, so we need to know what it is
    * possible values: text, long, int, double, date, defined
    $filter_type = "text";
    * constructs and executes a sql select query against the selected database
    * can take the following parameters:
    * $_REQUEST["orderField"] - the field by which we do the ordering. MUST appear inside $fields.
    * $_REQUEST["orderValue"] - ASC or DESC. If neither, the default value is ASC
    * $_REQUEST["filter"] - the filter value
    * $_REQUEST["pageNum"] - the page index
    * $_REQUEST["pageSize"] - the page size (number of rows to return)
    * if neither pageNum and pageSize appear, we do a full select, no limit
    * returns : an array of the form
    * array (
    *           data => array(
    *                array('field1' => "value1", "field2" => "value2")
    *           metadata => array(
    *                "pageNum" => page_index,
    *                "totalRows" => number_of_rows
    function findAll() {
         global $conn, $filter_field, $filter_type;
          * the list of fields in the table. We need this to check that the sent value for the ordering is indeed correct.
         $fields = array('id','subscriber_id','lastName','firstName','birthdate','gender');
         $where = "";
         if (@$_REQUEST['filter'] != "") {
              $where = "WHERE " . $filter_field . " LIKE " . GetSQLValueStringForSelect(@$_REQUEST["filter"], $filter_type);     
         $order = "";
         if (@$_REQUEST["orderField"] != "" && in_array(@$_REQUEST["orderField"], $fields)) {
              $order = "ORDER BY " . @$_REQUEST["orderField"] . " " . (in_array(@$_REQUEST["orderDirection"], array("ASC", "DESC")) ? @$_REQUEST["orderDirection"] : "ASC");
         //calculate the number of rows in this table
         $rscount = mysql_query("SELECT count(*) AS cnt FROM `modelName` $where");
         $row_rscount = mysql_fetch_assoc($rscount);
         $totalrows = (int) $row_rscount["cnt"];
         //get the page number, and the page size
         $pageNum = (int)@$_REQUEST["pageNum"];
         $pageSize = (int)@$_REQUEST["pageSize"];
         //calculate the start row for the limit clause
         $start = $pageNum * $pageSize;
         //construct the query, using the where and order condition
         $query_recordset = "SELECT id,subscriber_id,lastName,firstName,birthdate,gender FROM `modelName` $where $order";
         //if we use pagination, add the limit clause
         if ($pageNum >= 0 && $pageSize > 0) {     
              $query_recordset = sprintf("%s LIMIT %d, %d", $query_recordset, $start, $pageSize);
         $recordset = mysql_query($query_recordset, $conn);
         //if we have rows in the table, loop through them and fill the array
         $toret = array();
         while ($row_recordset = mysql_fetch_assoc($recordset)) {
              array_push($toret, $row_recordset);
         //create the standard response structure
         $toret = array(
              "data" => $toret,
              "metadata" => array (
                   "totalRows" => $totalrows,
                   "pageNum" => $pageNum
         return $toret;
    * constructs and executes a sql count query against the selected database
    * can take the following parameters:
    * $_REQUEST["filter"] - the filter value
    * returns : an array of the form
    * array (
    *           data => number_of_rows,
    *           metadata => array()
    function rowCount() {
         global $conn, $filter_field, $filter_type;
         $where = "";
         if (@$_REQUEST['filter'] != "") {
              $where = "WHERE " . $filter_field . " LIKE " . GetSQLValueStringForSelect(@$_REQUEST["filter"], $filter_type);     
         //calculate the number of rows in this table
         $rscount = mysql_query("SELECT count(*) AS cnt FROM `modelName` $where");
         $row_rscount = mysql_fetch_assoc($rscount);
         $totalrows = (int) $row_rscount["cnt"];
         //create the standard response structure
         $toret = array(
              "data" => $totalrows,
              "metadata" => array()
         return $toret;

    Hi there,
    I have a php script that accesses a mySQL database and it was generated out of the Flex Builder wizard automatically. The script works great and there are no problems with it. It allows me to perform CRUD on a table by calling it from my Flex app. and it retrieves all the data and puts it into a nice MXML format.
    My question, currently when I call "findAll" to retrieve all the data in the table, well, it retrieves ALL the rows in the table. That's fine, but my table is starting to grow really large with thousands of rows.
    I want to modify this script so that I can pass a variable into it from Flex so that it only retrieves the rows that match the "$subscriber_id" variable that I pass. In this way the results are not the entire table's data, only the rows that match 'subscriber_id'.
    I know how to pass a variable from Flex into php and the code on the php side to pick it up would look like this:
    $subscriberID = $_POST['subscriberID'];
    Can anyone shed light as to the proper code modification in "findAll" which will take my $subscriberID variable and compare it to the 'subscriber_id' field and then only return those rows that match? I think it has something to do with lines 98 to 101.
    Any help is appreciated.
    <?php
    require_once(dirname(__FILE__) . "/2257safeDBconn.php");
    require_once(dirname(__FILE__) . "/functions.inc.php");
    require_once(dirname(__FILE__) . "/XmlSerializer.class.php");
    * This is the main PHP file that process the HTTP parameters,
    * performs the basic db operations (FIND, INSERT, UPDATE, DELETE)
    * and then serialize the response in an XML format.
    * XmlSerializer uses a PEAR xml parser to generate an xml response.
    * this takes a php array and generates an xml according to the following rules:
    * - the root tag name is called "response"
    * - if the current value is a hash, generate a tagname with the key value, recurse inside
    * - if the current value is an array, generated tags with the default value "row"
    * for example, we have the following array:
    * $arr = array(
    *      "data" => array(
    *           array("id_pol" => 1, "name_pol" => "name 1"),
    *           array("id_pol" => 2, "name_pol" => "name 2")
    *      "metadata" => array(
    *           "pageNum" => 1,
    *           "totalRows" => 345
    * we will get an xml of the following form
    * <?xml version="1.0" encoding="ISO-8859-1"?>
    * <response>
    *   <data>
    *     <row>
    *       <id_pol>1</id_pol>
    *       <name_pol>name 1</name_pol>
    *     </row>
    *     <row>
    *       <id_pol>2</id_pol>
    *       <name_pol>name 2</name_pol>
    *     </row>
    *   </data>
    *   <metadata>
    *     <totalRows>345</totalRows>
    *     <pageNum>1</pageNum>
    *   </metadata>
    * </response>
    * Please notice that the generated server side code does not have any
    * specific authentication mechanism in place.
    * The filter field. This is the only field that we will do filtering after.
    $filter_field = "subscriber_id";
    * we need to escape the value, so we need to know what it is
    * possible values: text, long, int, double, date, defined
    $filter_type = "text";
    * constructs and executes a sql select query against the selected database
    * can take the following parameters:
    * $_REQUEST["orderField"] - the field by which we do the ordering. MUST appear inside $fields.
    * $_REQUEST["orderValue"] - ASC or DESC. If neither, the default value is ASC
    * $_REQUEST["filter"] - the filter value
    * $_REQUEST["pageNum"] - the page index
    * $_REQUEST["pageSize"] - the page size (number of rows to return)
    * if neither pageNum and pageSize appear, we do a full select, no limit
    * returns : an array of the form
    * array (
    *           data => array(
    *                array('field1' => "value1", "field2" => "value2")
    *           metadata => array(
    *                "pageNum" => page_index,
    *                "totalRows" => number_of_rows
    function findAll() {
         global $conn, $filter_field, $filter_type;
          * the list of fields in the table. We need this to check that the sent value for the ordering is indeed correct.
         $fields = array('id','subscriber_id','lastName','firstName','birthdate','gender');
         $where = "";
         if (@$_REQUEST['filter'] != "") {
              $where = "WHERE " . $filter_field . " LIKE " . GetSQLValueStringForSelect(@$_REQUEST["filter"], $filter_type);     
         $order = "";
         if (@$_REQUEST["orderField"] != "" && in_array(@$_REQUEST["orderField"], $fields)) {
              $order = "ORDER BY " . @$_REQUEST["orderField"] . " " . (in_array(@$_REQUEST["orderDirection"], array("ASC", "DESC")) ? @$_REQUEST["orderDirection"] : "ASC");
         //calculate the number of rows in this table
         $rscount = mysql_query("SELECT count(*) AS cnt FROM `modelName` $where");
         $row_rscount = mysql_fetch_assoc($rscount);
         $totalrows = (int) $row_rscount["cnt"];
         //get the page number, and the page size
         $pageNum = (int)@$_REQUEST["pageNum"];
         $pageSize = (int)@$_REQUEST["pageSize"];
         //calculate the start row for the limit clause
         $start = $pageNum * $pageSize;
         //construct the query, using the where and order condition
         $query_recordset = "SELECT id,subscriber_id,lastName,firstName,birthdate,gender FROM `modelName` $where $order";
         //if we use pagination, add the limit clause
         if ($pageNum >= 0 && $pageSize > 0) {     
              $query_recordset = sprintf("%s LIMIT %d, %d", $query_recordset, $start, $pageSize);
         $recordset = mysql_query($query_recordset, $conn);
         //if we have rows in the table, loop through them and fill the array
         $toret = array();
         while ($row_recordset = mysql_fetch_assoc($recordset)) {
              array_push($toret, $row_recordset);
         //create the standard response structure
         $toret = array(
              "data" => $toret,
              "metadata" => array (
                   "totalRows" => $totalrows,
                   "pageNum" => $pageNum
         return $toret;
    * constructs and executes a sql count query against the selected database
    * can take the following parameters:
    * $_REQUEST["filter"] - the filter value
    * returns : an array of the form
    * array (
    *           data => number_of_rows,
    *           metadata => array()
    function rowCount() {
         global $conn, $filter_field, $filter_type;
         $where = "";
         if (@$_REQUEST['filter'] != "") {
              $where = "WHERE " . $filter_field . " LIKE " . GetSQLValueStringForSelect(@$_REQUEST["filter"], $filter_type);     
         //calculate the number of rows in this table
         $rscount = mysql_query("SELECT count(*) AS cnt FROM `modelName` $where");
         $row_rscount = mysql_fetch_assoc($rscount);
         $totalrows = (int) $row_rscount["cnt"];
         //create the standard response structure
         $toret = array(
              "data" => $totalrows,
              "metadata" => array()
         return $toret;

  • How can I change this script so it doesn't load into a new window?

    I have this script on an invisible button on a banner ad, but the client doesn't want the linked page to open in a new window, but rather load over the page in same window. How can I change the script to accomplish this, thanks!
    link_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
    function mouseDownHandler(event:MouseEvent):void {
        navigateToURL(new URLRequest("http://www.sdesignsstore.com/store.html"));

    Try...
    navigateToURL(new URLRequest("http://www.sdesignsstore.com/store.html"), "_self");

  • Firefox does not load the first time I click on it -- a script appears which ischrome://webvideodownloader/content/utils.js:131 -- when I stop this script running I can then load firefox -- how can I keep this script from running

    I can still load it with the script running or attempting to run in the background but it makes firefox tremendously slow. After I click on stop running the script then everything seems to be ok.
    how do I get the script not to run in the first place.

    In Firefox the use of the term chrome refers to the user interface and other elements that are not part of the web pages.
    See https://developer.mozilla.org/en/Chrome
    Your problems seems to be caused by the GreaseMonkey extension.<br />
    See [[Troubleshooting extensions and themes]]

  • How can I optimize this script?

    What I don't like about this script:
    1) It has to be run multiple times to process multiple staff. I'd prefer if I could input multiple employee numbers at once
    2) It takes so long to search for the user. If I use the script, it can currently take 30s to find the employee. When I use ADUC to run the "(&(objectCategory=user)(objectClass=user)(employeeID=17688))" search, the results are immediate.
    3) I'd like it to look through all the chosen employee numbers before replicating the domain.
    4) The end of the powershell script calls a batch file because the syntax in the batch file didn't work in powershell. Can the batch file commands be included directly in the powershells script?
    5) The batch file references all of our DC's to minimize replication latency. Can it be simplified while ensuring all DC's are hit ASAP?
    Here is the powershell script:
    #Disable User# Add the Quest ActiveRoles Management Shell snap-in to recognize extended commands
    Add-PSSnapin Quest.ActiveRoles.ADManagement
    # Take first commandline argument which is the employeeID and assign it to the $empID variable
    $empID=$Args[0]
    # Search for the EmployeeID and find the matching NTAccountName (NBDomain\*) [This takes about 30 seconds for 1400 users]
    Write-Host "Searching for the User which matches Employee ID $EmpID, you have about 30 seconds to press Ctrl-C to cancel..."
    $user = get-qaduser -includedproperties employeeID,samaccountname -sizelimit 0 | where {$_.employeeID -eq $empID}
    # Find the matching SAMAccountname
    $samaccountname = $user.samaccountname
    # Find the matching DN
    $SourceDN = $user.dn
    # Set where the disabled account will be moved
    $DestDN = "OU=Disabled Accounts,DC=domain,DC=Com"
    # Set recipient limits to 0
    set-mailbox -identity $samaccountname -recipientlimits 0
    Write-host $User Recipient Limit set to 0.
    # Disable all mailbox features except archive
    set-casmailbox -identity $samaccountname -owaenabled $false -ewsenabled $false -ecpenabled $false -mapienabled $false -mapiblockoutlookrpchttp $true -ewsallowmacoutlook $false -ewsallowoutlook $false
    set-casmailbox -identity $samaccountname -activesyncenabled $false -popenabled $false -imapenabled $false
    Write-host $User Exchange features disabled.
    # Block all devices associated with the mailbox:
    $DeviceIDs = (Get-ActiveSyncDeviceStatistics -Mailbox $SourceDN | foreach { $_.DeviceID } )
    Set-CASMailbox -Identity $SourceDN -ActiveSyncBlockedDeviceIDs $DeviceIDs
    Write-Host $User All approved devices have been blocked.
    # Remove all devices associated with the mailbox:
    Set-casmailbox -identity $samaccountname -ActiveSyncAllowedDeviceIDs $null
    Write-Host $User All ActiveSync devices removed from mailbox.
    #Disable the user
    Disable-QADUser $user
    Write-Host $user account disabled.
    # Move the user to the Disabled OU
    Dsmove $SourceDN -newparent $DestDN
    Write-Host $User account moved to Disabled OU.
    Write-host Finished processing user $User
    Write-host ""
    Write-host "Replicating the enterprise domain across sites..."
    cd "C:\Users\username\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\Admin Tools"
    .\"Force DC replication.cmd"
    cd "c:\scripts"
    pause

    Here's the script I'm happy with. It's just .\scriptname.ps1 xxxx xxxy xxxz, where the args are employee numbers.
    #Disable User
    import-module activedirectory
    cls
    $yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes",""
    $no = New-Object System.Management.Automation.Host.ChoiceDescription "&No",""
    $choices = [System.Management.Automation.Host.ChoiceDescription[]]($yes,$no)
    foreach ($empID in $args)
    # Search for the EmployeeID and find the matching NTAccountName (domain\*)
    $user=get-aduser -properties employeeID,samaccountname -resultsetsize $null -LDAPFilter "(employeeID=$empID)"
    $samaccountname = $user.samaccountname
    $DN=$user.distinguishedname
    $name=$user.name
    $caption = "Warning!"
    $message = "Do you want to disable " + $name + "?"
    $result = $Host.UI.PromptForChoice($caption,$message,$choices,0)
    if($result -eq 1) { Write-Host "Skipping to the next name (if available)" }
    if($result -eq 1) { continue}
    if($result -eq 0) { Write-Host "----------"}
    if($result -eq 0) { Write-Host "Processing $name"}
    # Set recipient limits to 0
    set-mailbox -identity $samAccountName -recipientlimits 0
    Write-host "$name Recipient Limit set to 0."
    # Disable all mailbox features except archive
    set-casmailbox -identity $samaccountname -owaenabled $false -ewsenabled $false -ecpenabled $false -mapienabled $false -mapiblockoutlookrpchttp $true -ewsallowmacoutlook $false -ewsallowoutlook $false
    set-casmailbox -identity $samaccountname -activesyncenabled $false -popenabled $false -imapenabled $false
    Write-host "$name Exchange features disabled."
    # Block all devices associated with the mailbox:
    $DeviceIDs = (Get-ActiveSyncDeviceStatistics -Mailbox $dn | foreach { $empID.DeviceID } )
    Set-CASMailbox -Identity $DN -ActiveSyncBlockedDeviceIDs $DeviceIDs
    Write-Host "$name All approved devices have been blocked."
    # Remove all devices associated with the mailbox:
    Set-casmailbox -identity $samAccountName -ActiveSyncAllowedDeviceIDs $null
    Write-Host "$name All ActiveSync devices removed from mailbox."
    #Disable the user
    set-aduser $samAccountname -Enabled $false
    Write-Host "$name account disabled."
    # Move the user to the Disabled OU
    Move-ADObject -TargetPath "OU=Disabled Accounts,DC=domain,DC=Com" -Identity $dn
    Write-Host "$name account moved to Disabled OU."
    Write-host "Finished processing user $name."
    Write-host "----------"
    # Recycle the IIS Application Pools to clear the token cache
    Write-Host "Recycling IIS Application pools to clear the token cache..."
    $pools=Get-WMIObject IISApplicationPool -Namespace root\MicrosoftIISv2 -authentication Packetprivacy -computername cas001
    $pools | %{$_.Recycle()}
    $pools=Get-WMIObject IISApplicationPool -Namespace root\MicrosoftIISv2 -authentication Packetprivacy -computername cas002
    $pools | %{$_.Recycle()}
    Write-Host "Client Access IIS Application pools have been recycled."
    Write-host ""
    Write-host "Replicating the enterprise domain across sites..."
    repadmin /syncall dc003.domain.com /APed
    repadmin /kcc dc004.domain
    repadmin /kcc dc003.domain
    repadmin /kcc dc002.domain
    repadmin /kcc dc01.domain
    Write-Host "Replication requested, script complete."

  • How do I make this script: Hide dock while Gimp is open, automatically?

    Scenario: I need to maximize my 1024x768 screen when I do photo editing, so every time I open Gimp.app, I hide my dock. Since I tend to re-arrange icons on my dock periodically, I generally like to leave it showing. When I quit Gimp.app, I sometimes forget to un-hide the dock and am annoyed later on when I can't easily see the icons.
    Goal: This may seem trivial, but it would be nice to make a small application that does the following:
    1) Either launch Gimp.app, or simply link something to Gimp.app that launches my home-made application concurrently.
    2) Hides the Dock when Gimp.app launches.
    3) Runs in the background, ideally not visibly, and not using more than 4 or 5 MB of RAM or generating any processor load, and observes when I either quit Gimp.app or quit X11.
    4) Shows the dock and terminates itself when I Gimp.app closes.
    If I use this as a launcher, I could give it a Gimp icon and put it in the Dock instead of Gimp. If it is activated by Gimp, the other option I mentioned in #1, the icon would not be significant because hiding mode will be turned on every time my home-made app is open.
    I see several potential solutions but can't iron out the details. I have searched Google and these forums, and found solutions to a few similar problems, but have not been able to adapt those solutions to my needs. If this could be handled better with something other than AppleScript, feel free to point it out. The ideas I have for doing this are:
    1) Write an AppleScript
    2) Set this up in Automator
    3) Save a Unix shell script, or
    4) Write a simple Java application.
    I think using Java would make this unnecessarily complicated, because #1, #2, and #3 can all handle system events quite well, that's not really what Java was meant to do. It may still be an option, though. I have generated a few working parts of the program in #1 and #2, but I the only waiting command I could find waits for the user to click in a dialogue box, not to quit an application.
    I hope this isn't too much of a newbie question, I've done a lot with Macs before, and this ought to be simple but I'm stumped. I've never needed to post on a Mac forum, but you can find me all over the Linux forums, since that isn't my forte! Help will be greatly appreciated.

    Save the code, provided below, as an applications (AppleScript applet, via the 'File Format:' popup menu), and click on the 'Options:' 'Stay Open' checkbox to add a check mark.
    -- Code starts here --
    property tApp : "Gimp"
    on run {}
    tell application "System Events" to tell process "Dock" to keystroke "d" using command down & option down
    tell application tApp to activate
    end run
    on idle {}
    tell application "System Events"
    set pNames to name of processes
    tell process "Dock" to if (not (pNames contains tApp)) then
    keystroke "d" using command down & option down
    tell me to quit
    end if
    end tell
    return 2
    end idle
    -- Code ends here --

  • Edit this script so .log replaces .jpg

    Here's portion of script I'm editing: As it is it results in .log is appending to filename. Thus I end up with filename.jpg.log. How do I get it change filename to filename.log? (Filetype is of no concern here). This needs to be unattended.
    tell application "Finder"
    repeat with i from 1 to number of items in the added_items
    set this_item to (item i of the added_items)
    set fileName to name of this_item
    set AppleScript's text item delimiters to "."
    if fileName ends with ("jpg" as text) then set newFileName to (text items 1 thru 2 of fileName) & "log" as text

    Also note that the nameproperty includes the name extension, so sometimes it is handy to extract one from the other. I use a handler to get the portions of the name:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px; height: 340px;
    color: #000000;
    background-color: #FFDDFF;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    -- get name parts from a file
    on run -- example
    set TheFIle to (choose file)
    set {TheName, TheExtension} to (GetTheNames from TheFIle)
    display dialog "Name:        " & TheName & return & "Extension:  " & TheExtension
    end run
    to GetTheNames from SomeFile
    get a name and extension from a file path
    parameters - SomeFile [mixed]: a complete file path
    returns [list] - item 1 [text]: the name
            item 2 [text]: the .extension (if no extension, the value returned is "")
    set SomeFile to SomeFile as text
    if SomeFile begins with "/" then set SomeFile to (POSIX file SomeFile) -- assume a POSIX path
    set {name:TheName, name extension:TheExtension} to info for (SomeFile as alias)
    if TheExtension is in {missing value, ""} then
    set TheExtension to ""
    else
    set TheExtension to "." & TheExtension
    end if
    set TheName to text 1 thru -((count TheExtension) + 1) of TheName
    return {TheName, TheExtension}
    end GetTheNames
    </pre>

  • Edit this script?

    I am fairly limited in scripting - would it be possible to edit the following script to allow me to export the artwork for 1 track of each disc?
    Album Art to Album Folder v1.3
    I would like to make a large poster of my album artwork and want a script to export the artwork from each album (say from track 1 or each album which i could easily specify with a smart folder in itunes.) I know there is software for purchase which does this, but i imagine this will be a one-time project, not something i feel a need to purchase.

    So, you want to take the art from each album and write that image file to the iTunes album folder. That is exactly what the script does.
    After that is done, you want to gather up the images and stitch them all together into one giant image. Is that right?
    This is a 3 part project.
    You would use the script at that page, but edit the my_scale setting it to some reasonable size for consistency. iTunes images are all kinds of sizes and that won't make a very good pastiche. Normally the smallest size image becomes the standard all need to be reduced to, but the script expands too, although the smallest ones will look pixelated if you do that.
    With that done, you would run a command in Terminal to find all jpg and png images and move them to one folder. Someone else can help you with that.
    Then, you would run Graphic Converter: http://lemkesoft.de/ and use the menu item File>Merge Folder into One Image...
    Hope that gives you some ideas.

  • I recently purchased a used iMac mid-2011 and just updated to Mavericks yesterday, but has previous owners Apple ID under app icon. It won't let me complete update without that ID and password. How can I edit this?

    I've had no issues changing Apple ID under preferences, etc. But it won't allow me to just click and change user name. Just says to put in password. I'm logged in under iTunes but haven't completely changed over my iTunes account from my old computer yet. Would that be a cause?

    The first thing to do with a second-hand computer is to erase the internal drive and install a clean copy of OS X. You—not the original owner—must do that. Changes made by Apple over the years have made this seemingly straightforward task very complex.
    How you go about it depends on the model, and on whether you already own another Mac. If you're not sure of the model, enter the serial number on this page. Then find the model on this page to see what OS version was originally installed.
    It's unsafe, and may be unlawful, to use a computer with software installed by a previous owner.
    1. If you don't own another Mac
    If the machine shipped with OS X 10.4 or 10.5, you need a boxed and shrink-wrapped retail Snow Leopard (OS X 10.6) installation disc from the Apple Store or a reputable reseller—not from eBay or anything of the kind. If the machine is very old and has less than 1 GB of memory, you'll need to add more in order to install 10.6. Preferably, install as much memory as it can take, according to the technical specifications.
    If the machine shipped with OS X 10.6, you need the installation media that came with it: gray installation discs, or a USB flash drive for a MacBook Air. You should have received those media from the original owner, but if you didn't, order replacements from Apple. A retail disc, or the gray discs from another model, will not work.
    To start up from an optical disc or a flash drive, insert it, then restart the computer and hold down the C key at the startup chime. Release the key when you see the gray Apple logo on the screen.
    If the machine shipped with OS X 10.7 or later, you don't need media. It should start up in Internet Recovery mode when you hold down the key combination option-command-R at the startup chime. Release the keys when you see a spinning globe.
    Some models shipped with OS X 10.6 and received a firmware update after 10.7 was released, enabling them to use Internet Recovery. If you have one of those models, you may not be able to reinstall 10.6 even from the original discs, and Internet Recovery may not work either without the original owner's Apple ID. In that case, contact Apple Support, or take the machine to an Apple Store or another authorized service provider to have the OS installed.
    2. If you do own another Mac
    If you already own another Mac that was upgraded in the App Store to the version of OS X that you want to install, and if the new Mac is compatible with it, then you can install it. Use Recovery Disk Assistant to prepare a USB device, then start up the new Mac from it by holding down the C key at the startup chime. Alternatively, if you have a Time Machine backup of OS X 10.7.3 or later on an external hard drive (not a Time Capsule or other network device), you can start from that by holding down the option key and selecting it from the row of icons that appears. Note that if your other Mac was never upgraded in the App Store, you can't use this method.
    3. Partition and install OS X
    a. If you see a lock screen when trying to start up from installation media or in Recovery mode, then a firmware password was set by the previous owner, or the machine was remotely locked via iCloud. You'll either have to contact the owner or take the machine to an Apple Store or another service provider to be unlocked. You may be asked for proof of ownership.
    b. Launch Disk Utility and select the icon of the internal drive—not any of the volume icons nested beneath it. In the  Partition tab, select the default options: a GUID partition table with one data volume in Mac OS Extended (Journaled) format. This operation will permanently remove all existing data on the drive.
    c. An unusual problem may arise if all the following conditions apply:
    OS X 10.7 or later was installed by the previous owner
    The startup volume was encrypted with FileVault
    You're booted in Recovery mode (that is, not from a 10.6 installation disc)
    In that case, you won't be able to unlock the volume or partition the drive without the FileVault password. Ask for guidance or see this discussion.
    d. After partitioning, quit Disk Utility and run the OS X Installer. If you're installing a version of OS X acquired from the App Store, you will need the Apple ID and password that you used. When the installation is done, the system will automatically restart into the Setup Assistant, which will prompt you to transfer the data from another Mac, its backups, or from a Windows computer. If you have any data to transfer, this is usually the best time to do it.
    e. Run Software Update and install all available system updates from Apple. To upgrade to a major version of OS X newer than 10.6, get it from the Mac App Store. Note that you can't keep an upgraded version that was installed by the original owner. He or she can't legally transfer it to you, and without the Apple ID you won't be able to update it in Software Update or reinstall, if that becomes necessary. The same goes for any App Store products that the previous owner installed—you have to repurchase them.
    4. Other issues
    a. If the original owner "accepted" the bundled iLife applications (iPhoto, iMovie, and Garage Band) in the App Store so that he or she could update them, then they're irrevocably linked to that Apple ID and you won't be able to download them without buying them. Reportedly, Mac App Store Customer Service has sometimes issued redemption codes for these apps to second owners who asked.
    b. If the previous owner didn't deauthorize the computer in the iTunes Store under his Apple ID, you wont be able to  authorize it immediately under your ID. In that case, you'll either have to wait up to 90 days or contact iTunes Support.
    c. When trying to create a new iCloud account, you might get a failure message: "Account limit reached." Apple imposes a lifetime limit of three iCloud account setups per device. Erasing the device does not reset the limit. You can still use an iCloud account that was created on another device, but you won't be able to create a new one. Contact iCloud Support for more information. The setup limit doesn't apply to Apple ID accounts used for other services, such as the iTunes and Mac App Stores, or iMessage. You can create as many of those accounts as you like.

  • How do i edit this pdf file? Noob needs pro help

    I have to translate this pdf file to spanish. i tryed the following " advanced edition -> edit text" didn't work... maybe they scanned the file? tryed: "document -> ocr text recognition"... didn't work either.
    I have Adobe Acrobat Professional. i attached one page of thefile i want to edit. Please help me!!!

    Have you tried the TOOLS>Advanced Editing>Touchup Text Tool? You will have to have the fonts on your system to do the edit. You might be able to change the font to something else on your system if needed. The file is all text (in boxes) and the touchup text tool should do the job. I was able to change the fonts to Arial (not all of them, there are a few that are still in the old font that are numbers). I have posted the result at http://wadavis.ece.vt.edu/CO2 ophir lenses.pdf. (you may have to replace the spaces with %20)

  • How do I edit this photo, my hair is glowing against the sky?

    I really need help, I have a camera RAW file from a recent vacation. It is a good photo, but the hair appears to be glowing against the sky. No matter what settings I play with it will not go away. The only way I have found so far is to use the clone stamp, but it makes my hair look funny. Any ideas?
    This is with no settings changed, straight from the camera. Everything else in the photo appears perfectly normal.

    Slick your hair down.
    Is that clip from the image at full resolution, or is it downsampled?  If that's full resolution, good luck.
    Given the imprecision of JPEG in contrasty areas, I'd recommend uploading a section of the image at full resolution as a PNG24 image, which won't have JPEG artifacting.

Maybe you are looking for

  • Resized partition using Disk Utility and now Windows 7 will not boot

    Hi, Hopefully someone can help me!! I had previously used Boot Camp to install Windows 7. However, I later realised I had not given myself anywhere near enough disk space as I started using Windows for things I hadn't originally planned on using it f

  • IMac hosed, can't boot from SuperDrive or HD - help!

    My iMac had a kernel panic last weekend. I tried to reboot, but got the endless blue screen. I booted to the Superdrive and used the AppleCare-supplied TT disc. Ran the diagnostic, did a repair, ejected, and rebooted. Now, endless grey screen. Shut d

  • Bridge CS6 - AVCHD metadata & keywords

    Recently made the transition to AVCHD video & CS6. On my media drive, I have a footage folder where I dump the contents of my memory cards.  I copy over the entire AVCHD file/folder structure. I'd like to organize this footage in Bridge CS6 by editin

  • Need help getting speaker inputs to work please.

    I'm trying to have my auido reciever and computer speakers hooked up to my computer at the same time so when I watch recorded shows off my computer i can have the sound come out of my surrouns sound speakers. The only problem is i don't have an input

  • DVDSP v 1.5 +OS 10.4.9 = DVDs play in a standalone player, not apple player

    I recently upgraded my OS to 10.4.9, but my DVDSP is version 1.5. Now it will "build" dvds, but it won't "build and format" (burn) dvds. Does this have something to do with quick time 7? ALSO: I burned the audio TS and video TS folders to a DVD - and