Help creating a script to move users in and out of an OU based on a time limit

Here's my scenario: we currently have OUs based on the locations of our facilities, we also have a sub-OU(?) underneath it for users that need a group policy applied to them where whitelist applications allowed to run. From time to time we have need to pull
users out of that sub-OU for a short period of time to let them run applications they normally wouldn't be able to and won't need to run long term. Sometimes we also forget to add these people back into that policy controlled sub-OU because we get busy do
other things. Server is 2008 R2.
Here's what I'm looking for: A script that prompts for the users name, pulls that user out of the sub-OU, puts them in the main OU but only for 24 hours. After that time limit is up, a script/command runs that puts the user back in the policy controlled
sub-OU. I'm thinking a PS script would be the best way to do this.
Research: Looking at these posts here and here I'm
thinking I should be able to Frankenstein something together but I have very limited PS scripting experience.
Can anyone help me create this?

You've probably figured this out, but we're not typically in the business of writing complete solutions for people. With that said, there are projects I find particularly interesting, such as this one, where I am willing to help get someone started if they
are willing to take the time to work through the examples and learn from them.
You have two requests - one is a script that prompts for a user it then moves to a different  location in Active Directory. The second request is a way to move them back without manual interaction. This will require an automated task (scheduled task)
that will run at select times during a day.
Here's the first script (1/2): The first two lines set two different variables. The first line sets the $OUPath variable to the SubOU. The second line prompts for a user and, once a user is entered, sets that user to the $User variable. It then runs the
first try-catch, attempting to replace the $User variable with the data returned from the Get-ADUser cmdlet. Notice the use of the -Properties parameter. By default the modified date and the extensionAttributes are not returned. We will be using the modified
date so we can be certain that 24 hours passes before we move them back (see part 2/2). Including extensionAttribute13 will ensure we only move users out of the OU if they were moved in by the script. Note: The modified date on a user in AD is changed when
it is moved from one OU to another. If the user cannot be located in the first try-catch it will say it cannot locate the user in Active Directory. If it can locate it, it will set the $User variable, as described so far, and then move on.
In the second (or, nested) try-catch we split the user's DistingusihedName at the first comma so that we have two parts. We use the second part (that doesn't include their CN) and see if that matches the $OUPath variable. If it does match then that user
has already been moved. If it doesn't match then we 1. Move the user, 2. Replace extensionAttribute13 with the string 'MovedUser,' and 3. Output that the user has been moved.
$OUPath = 'OU=SubOU,OU=MainOU,DC=mydomain,DC=com'
$User = Read-Host -Prompt 'Enter SamAccountName'
try {
$User = Get-ADUser -Identity $User -Properties Modified,extensionAttribute13
try {
If ($User.DistinguishedName.Split(',',2) -eq $OUPath) {
Write-Output -Verbose 'User already moved.'
} Else {
Move-ADObject -Identity $User.DistinguishedName -TargetPath $OUPath
Set-ADUser -Identity $User.SamAccountName -Replace @{extensionAttribute13='MovedUser'}
Write-Output "'$($User.SamAccountName)' has been moved."
catch {
Write-Output "'$($User.SamAccountName)' cannot be moved."
catch {
Write-Output -Verbose "Unable to locate '$User' in Active Directory."
The second script (2/2): Here we also set a couple variables - one is the SubOU's DistinguishedName where we want to return the user and the other is the all of the users from the MainOU. Foreach user in $Users we check if their extensionAttribute13 is set
to 'MovedUser' and if their modified date is greater than or equal (-ge) to 24 hours. If it is, the script will move the user, clear extensionAttribute13, and let us know the user was moved. If for some reason your $OUPath variable is wrong, the script will
run the catch portion of the only try-catch we used in this script. Again, you'll have to schedule Task Scheduler to run this script. Good luck!
$OUPath = 'OU=MainOU,DC=mydomain,DC=com'
$Users = Get-ADUser -Filter * -SearchBase $OUPath -Properties Modified,extensionAttribute13
Foreach ($User in $Users) {
$TimeSince = New-TimeSpan -Start $User.Modified -End (Get-Date)
If ($User.extensionAttribute13 -eq 'MovedUser' -and $TimeSince.Hours -ge 24) {
try {
Move-ADObject -Identity $User.DistinguishedName -TargetPath $OUPath
Set-ADUser -Identity $User.SamAccountName -Clear extensionAttribute13
Write-Output "$($User.SamAccountName) has been moved."
catch {
Write-Output "$($User.SamAccountName) cannot be moved."
} Else {
Write-Output 'No Users to move.'
If you decide to use this, be sure to change the paths you use for the $OUPath variables. Also, if you're using this with PowerShell 2.0, you will need to use the Import-Module cmdlet to import the ActiveDirectory module. In versions above 2.0 it will be
imported automatically if you try to use an AD cmdlet.
Edit: Typo - Get-ADUser property

Similar Messages

  • Help creating a script for backup

    Hi everybody,
    I would like to make some backups using rman and recovery flash area on oracle10g on my Debian.
    I would like to make a full backup level 0 on Sunday and make incremental backups from Monday to saturday.The best would be to have one for hot backup and one for cold backups.
    But I am wondering how to schedule a task using rman. For example is it possible to write a script that would make the backups at a desired time executed by oracle?
    Or do I have to create a script on unix that should be executed by cron?
    You know I am really bad at scripting, but it would really help me if you could help me creating a script that would make the backup automatically on sunday at midnight and incremental eveydays until sunday.Here is the information I need to put in a script:
    #flash recovery area creation under sqlplus
    SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE = 10g SCOPE=BOTH SID='*';
    SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST = '/home/oracle/flash_recovery_area' SCOPE=BOTH SID='*';
    #setting the default variable
    ORACLE_SID=iscream;
    #connect to target database:
    rman TARGET SYS/oracle@iscream NOCATALOG
    #set the defaults values for rman
    CONFIGURE DEFAULT DEVICE TYPE TO DISK;
    CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET;
    CONFIGURE CONTROLFILE AUTOBACKUP ON;
    CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
    CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
    CONFIGURE BACKUP OPTIMIZATION ON;
    Any help will be appreciated
    synthese
    hot backup
    using rman
    using flash_recovery_area
    full backup set compressed on sunday
    incremental backup set compressed from mondy to saturday
    using disk
    policy retenttion 7 days
    redondance 2

    You can backup using some unix shell scripts.
    rman is not really good one.

  • Would like to create a script for list all elements and structure of an indesign document

    Hello everybody,
    I'm a very beginner in indesign scripting.
    I would like to create a script in order to list all elements and the inner structure of a n indesign document.
    The aim for me is to understand how elements are sorted and arranged into indesign, and be able to find an specific element by its item name.
    The output document could be an xml or txt document with a treeview structure.
    I would like have a rough idea of which kind of javascript code I should use for that.
    Thanks for answers.

    Hi Ossydoc,
    You can use Muse to create such a website. All you need to do is, create links in Muse for the sermons and select  " link to File " in the hyperlink option and link to those Mp3 files.
    Please refer to this screenshot :- http://prntscr.com/4xvdup
    Now, when you publish your site,  Muse would automatically upload those files onto the server and the users would then be able to listen as well as download those sermons using the links on your site.
    Hope this helps
    Regards,
    Rohit Nair 

  • Need a script to delete user files and run on logout.

    Hi folks!
    I'm a total Mac novice so forgive me if I'm vague on anything here. I work in a library and we have recently acquired an iMac running Mountain Lion. The unit is primarily for use by Visually Impaired users however sighted folks can use it as well.
    What I need is something that will delete any files created/downloaded by the sighted users but that will not delete anyone else's files. I tried just using the Guest Account however that also deletes all the system preferences for that account including the dock setup which I need to stay the same.
    If possible I would like this to run on logout.
    For additional points anyone who can also find me something that will run automatically when the users sign in and will sign them out after 30 minutes would super spectacularly awesome.
    Thanks people!

    That being said, if you you still really want to do this you can create a logout hook and write a shell script to remove the files.  See "About Daemons and Services", Appendix B on writing a logout hook.
    But a far easier way is to create Account's login item that will cause a shell script to be launched to delete the files.  You can encapsulate the shell script so it runs as an application that can be added to the Login Items.  One such encapsulator is Platypus.
    Note, rather than delete them, if you want to ensure all the specific plists have specific settings, then create a master set of them and copy the master set into the Preferences directory (being careful to observe ownership and permissions settings of course).

  • How to create an interactive magazine with user comments and voting system?

    I need to create an interactive magazine that includes user comments and votes (like/unlike).
    I know that I can create digital swf magazines in indesign and that user comments and like/unlike buttons can be entered with coding in adobe dreamweaver.
    I need this for a school project and I do not know if it's possible or if there is another way of doing it in dreamweaver...
    Thanks

    The easiest way to do like/unlike voting is use facebook´s like/unlike button generator at http://developers.facebook.com/docs/reference/plugins/like/ to create a code. You can set up the appearance and some features of your button and you will end up having an iFrame code. You can add that code into your html-wrapper file with some regular texteditor like wordPad....
    Here´s one example, it´s an InDesign SWF finalized with eDocker but I don´t see any reason why you couldn´t use the SWF exported directly from InDesign as well. If you want to put it to some specific location, you have to wrap it up into a div and set up some css for that div, but it´s not a rocket science either.....=)
    http://www.prepress.fi/keva

  • Digital Publishing Suite Help | Creating custom viewer apps for the iPad and iPhone

    This question was posted in response to the following article: http://helpx.adobe.com/digital-publishing-suite/help/create-custom-viewer-app-ipad.html

    The Approval Status section is no longer in DPS App Builder, but this reference wasn't removed. You can submit your app to the gallery using this form:
    https://adobeformscentral.com/?f=ozjJFvlBionBofBtd-wjbQ#

  • How to create a script logic using two applications and some conditions?

    Hi All,
    I am using BPC 7.0 MS
    I have two applications, one called RATE (Dimensions: Category, InputCurrency, Rate, RateEntity, Time) and one called GYP (Dimensions: Category, Entity, PL, Producto, RptCurrency, Time. In the GYP application for Revenues. I have the followings products:
    Product code
    1-808-912-433
    3-208-345-542
    11-869-789-946
    13-456-786-890
    I need to calculate a discount using the first digits to identify the product: 1, 3, 11 and 13, based on some percentages that are in the RATE application. 
    I have an element in the RATE application for each one of them.
    DPC1
    DPC3
    DPC11
    DPC13
    What I am trying to do in the script logic is:
    *XDIM_MEMBERSET PL=Revenues
    *XDIM_MEMBERSET PRODUCTO=<ALL>
    *XDIM_MEMBERSET ENTITY=<ALL>
    *XDIM_MEMBERSET CATEGORY=Budget
    *LOOKUP RATE
    *DIM D1:RATE ="DPC1"
    *DIM D11:RATE ="DPC11"
    *DIM D3:RATE ="DPC3"
    *DIM D13:RATE ="DPC13"
    *DIM RATEENTITY="Global"
    *DIM INPUTCURRENCY="VEB"
    *ENDLOOKUP
    *WHEN PL
    *IS Revenues
    *REC(FACTOR=LOOKUP(D1), PL=Discount)
    *ENDWHEN
    *COMMIT
    In the WHEN area, i would like to create some condition to identify the product and assign the correct percentage to it but i don't know how to do it?
    Do you have any suggestions?
    Also, because i need to key the values in the RATE application for the discounts, the logic should be run from this application?
    Using RUNLOGIC like this:
    *RUNLOGIC
    *APP GYP
    *LOGIC Discounts
    *ENDRUNLOGIC
    Best regards,
    Luisana

    Hi Nilanjan,
    Thanks for your prompt reply.
    The special characters ("-") cannot be used. The product codes use the special character ("_").
    I understand what you said about the property for the dimension Product but not for the dimension Rate. I have the lookup that has the four elements (DPC1, DPC11, DPC3, DPC13). It is not supposed to get the data from those elements directly when using the lookup?
    The script logic is still not working. I created the dimension property in the product dimension and the new script logic is as follows:
    *XDIM_MEMBERSET PL=Revenues
    *XDIM_MEMBERSET PRODUCT=<ALL>
    *XDIM_MEMBERSET ENTITY=<ALL>
    *XDIM_MEMBERSET CATEGORY=Budget
    *LOOKUP RATE
    *DIM D1:RATE ="DPC1"
    *DIM D11:RATE ="DPC11"
    *DIM D3:RATE ="DPC3"
    *DIM D13:RATE ="DPC13"
    *DIM RATEENTITY="Global"
    *DIM INPUTCURRENCY="VEB"
    *ENDLOOKUP
    *WHEN PRODUCT.TYPE
         *IS 1
              *REC(FACTOR=LOOKUP(D1), PL=Discount)
         *IS 11
              *REC(FACTOR=LOOKUP(D11), PL=Discount)
         *IS 3
              *REC(FACTOR=LOOKUP(D3), PL=Discount)
         *IS 13
              *REC(FACTOR=LOOKUP(D13), PL=Discount)
    *ENDWHEN
    *COMMIT
    Could you let me know what i am doing wrong?
    The calculation i would like to get is: Discount = Revenues(GYP) X DPCx(RATE)
    Also, when I sent the data from the rate application I get the message "ExecuteBaseLogic::invalid application:*APP GYP". I am using a RUNLOGIC in the application RATE with the following code:
    *RUNLOGIC
    *APP GYP
    *LOGIC Decto_en_vtas_pilot
    *ENDRUNLOGIC
    Kind Regards,
    Luisana

  • I need help creating a formula that looksup cell data and give a value.

    I want to have the table "At a glance"  show the total days a driver has worked, there total in sales and there total in milage. The table shown is a example of what I want to have happen. I want to input any name into cell B2,C2,D2,ect. that is found in the row C2:C17 of Checkpoint (Truck 1) and Checkpoint (Truck 2) and return the total amount of day the driver has driven both trucks, The total in sales the driver has collected (Truck 1 and 2) and How many miles the driver has driven (Truck 1 and 2). I realize that these tables are not labeled correct. If I enter a name into B2 and the driver associated with that name hasnt driven then I want "N/A' to show in cell B2 and so one. I assume that the formula that is created for cell B2 will be copied and pasted into cell C2, D2, ect..
    If someone could help me with this problem I'd really appreciate it.
    Thanks.

    Hi br,
    To show the number of days worked by a driver, you need to COUNT the number of times that driver's name appears in row 2 of both tables.
    To calculate his total sales and total mileage, you need to SUM the amounts he brought in each day and the distances he drove each day.
    Your functions for this are COUNTIF and SUMIF.
    Formulas in At a Glance:
    B2: =COUNTIF(Truck 1 :: $3:$3,B$1)+COUNTIF(Truck 2 :: 3:3,B$1)
    B3: =SUMIF(Truck 1 :: $3:$3,B$1,Truck 1 :: $5:$5)+SUMIF(Truck 2 :: $3:$3,B$1,Truck 2 :: $5:$5)
    B4: =SUMIF(Truck 1 :: $3:$3,B$1,Truck 1 :: $12:$12)+SUMIF(Truck 2 :: $3:$3,B$1,Truck 2 :: $12:$12)
    Fill all three formulas right to the last column of At a Glance.
    To put N/A in place of the 0 in Roger's column and the empty columns, wrap each of the formulas in an IF statement:
    Bn: =IF(AND(ISERROR(MATCH(B$1,Truck 1 :: $3:$3,0)),ISERROR(MATCH(B$1,Truck 2 :: $3:$3,0))),"N/A",formula)
    Where formula is the formula used in column B above.
    Regards,
    Barry

  • PS Script to Automate NIC Teaming and Configure Static IP Address based off an Existing Physical NIC

    # Retrieve IP Address and Default Gateway from static IP Assigned NIC and assign to variables.
    $wmi = Get-WmiObject Win32_NetworkAdapterConfiguration -Filter "IPEnabled = True" |
    Where-Object { $_.IPAddress -match '192\.' }
    $IPAddress = $wmi.IpAddress[0]
    $DefaultGateway = $wmi.DefaultIPGateway[0]
    # Create Lbfo TEAM1, by binding “Ethernet” and “Ethernet 2” NICs.
    New-NetLbfoTeam -Name TEAM1 -TeamMembers "Ethernet","Ethernet 2" -TeamingMode Lacp -LoadBalancingAlgorithm TransportPorts -Confirm:$false
    # 20 second pause to allow TEAM1 to form and come online.
    Start-Sleep -s 20
    # Configure static IP Address, Subnet, Default Gateway, DNS Server IPs to newly formed TEAM1 interface.
    New-NetIPAddress –InterfaceAlias “TEAM1” –IPAddress $IPAddress –PrefixLength 24 -DefaultGateway $DefaultGateway
    Set-DnsClientServerAddress -InterfaceAlias “TEAM1” -ServerAddresses xx.xx.xx.xx, xx.xx.xx.xx
    Howdy All!
    I was recently presented with the challenge of automating the creation and configuration of a NIC Team on Server 2012 and Server 2012 R2.
    Condition:
    New Team will use static IP Address of an existing NIC (one of two physical NICs to be used in the Team).  Each server has more than one NIC.
    Our environment is pretty static, in the sense that all our servers use the same subnet mask and DNS server IP Addresses, so I really only had
    to worry about the Static IP Address and the Default Gateway.
    1. Retrieve NIC IP Address and Default Gateway:
    I needed a way to query only the NIC with the correct IP Address settings and create required variables based on that query.  For that, I
    leveraged WMI.  For example purposes, let's say the servers in your environment start with 192. and you know the source physical NIC with desired network configurations follows this scheme.  This will retrieve only the network configuration information
    for the NIC that has the IP Address that starts with "192."  Feel free to replace 192 with whatever octet you use.  you can expand the criteria by filling out additional octects... example:
    Where-Object
    $_.IPAddress
    -match'192\.168.' } This would search for NICs with IP Addresses 192.168.xx.xx.
    $wmi
    = Get-WmiObject
    Win32_NetworkAdapterConfiguration
    -Filter "IPEnabled = True"
    |
    Where-Object {
    $_.IPAddress
    -match '192\.' }
    $IPAddress
    = $wmi.IpAddress[0]
    $DefaultGateway
    = $wmi.DefaultIPGateway[0]
    2. Create Lbfo TEAM1
    This is a straight forward command based off of New-NetLbfoTeam.  I used  "-Confirm:$false" to suppress prompts. 
    Our NICs are named “Ethernet” and “Ethernet 2” by default, so I was able to keep –TeamMembers as a static entry. 
    Also added start-sleep command to give the new Team time to build and come online before moving on to network configurations. 
    New-NetLbfoTeam
    -Name TEAM1
    -TeamMembers "Ethernet","Ethernet 2"
    -TeamingMode SwitchIndependent
    -LoadBalancingAlgorithm
    Dynamic -Confirm:$false
    # 20 second pause to allow TEAM1 to form and come online.
    Start-Sleep
    -s 20
    3. Configure network settings for interface "TEAM1".
    Now it's time to pipe the previous physical NICs configurations to the newly built team.  Here is where I will leverage
    the variables I created earlier.
    There are two separate commands used to fully configure network settings,
    New-NetIPAddress : Here is where you assign the IP Address, Subnet Mask, and Default Gateway.
    Set-DnsClientServerAddress: Here is where you assign any DNS Servers.  In my case, I have 2, just replace x's with your
    desired DNS IP Addresses.
    New-NetIPAddress
    –InterfaceAlias “TEAM1”
    –IPAddress $IPAddress
    –PrefixLength 24
    -DefaultGateway $DefaultGateway
    Set-DnsClientServerAddress
    -InterfaceAlias “TEAM1”
    -ServerAddresses xx.xx.xx.xx, xx.xx.xx.xx
    Hope this helps and cheers!

    I've done this before, and because of that I've run into something you may find valuable. 
    Namely two challenges:
    There are "n" number of adapters in the server.
    Adapters with multiple ports should be labeled in order.
    MS only supports making a LBFO Team out of "like speed" adapters.
    To solve both of these challenges I standardized the name based on link speed for each adapter before creating hte team.  Pretty simple really!  FIrst I created to variables to store the 10g and 1g adapters.  I went ahead and told it to skip
    any "hyper-V" ports for obvious reasons, and sorted by MAC address as servers tend to put all thier onboard NICs in sequentially by MAC:
    $All10GAdapters = (Get-NetAdapter |where{$_.LinkSpeed -eq "10 Gbps" -and $_.InterfaceDesription -notmatch 'Hyper-V*'}|sort-object MacAddress)
    $All1GAdapters = (Get-NetAdapter |where{$_.LinkSpeed -eq "1 Gbps" -and $_.InterfaceDesription -notmatch 'Hyper-V*'}|sort-object MacAddress)
    Sweet ... now that I have my adapters I can rename them into something standardized:
    $i=0
    $All10GAdapters | ForEach-Object {
    Rename-NetAdapter -Name $_.Name -NewName "Ethernet_10g_$i"
    $i++
    $i = 0
    $All1GAdapters | ForEach-Object {
    Rename-NetAdapter -Name $_.Name -NewName "Ethernet_1g_$i"
    $i++
    Once that's done Now i can return to your team command but use a wildcard sense I know the standardized name!
    New-NetLbfoTeam -Name TEAM1G -TeamMembers Ethernet_1g_* -TeamingMode SwitchIndependent -LoadBalancingAlgorithm Dynamic -Confirm:$false
    New-NetLbfoTeam -Name TEAM10G -TeamMembers Ethernet_10g_* -TeamingMode SwitchIndependent -LoadBalancingAlgorithm Dynamic -Confirm:$false

  • I have been using my newly purchased Iphone for Iphonagraphy (Iphone photography).  I would like to sync my Iphone to my external hard drive so I can move photos in and out of my Iphone, to make use of the apps I have exclusively on my phone.

    I want to sync my Iphone with the external hard drive so I can move photos from my phone to the hard drive AND BACK!  I'm using a Windows OS

    You have several options:
    Connect the phone using a cable to your computer. Use the camera and scanner wizard to import the photos from the Camera Roll, then organize them and sync them back to the Photos app (see: http://support.apple.com/kb/HT4083). the Camera Roll is intended for temporary storage only.
    Save the images to your Dropbox account. It's free, http://www.dropbox.com. There's a Dropbox app for the iPhone, and also for Windows, Mac and Linux. Dropbox can also be accessed using a web browser. Dropbox (and similar services) provide cloud-based storage that can be accessed from anywhere.
    Use Photo Stream
    Email or text (MMS) the images to yourself
    Create a Picasa or Shutterfly account, save the images to it, then download to your computer
    I'm sure there are others.

  • Need help with easy script for open / close app and move files

    Hi,
    I'm not a scripter.. never done anything special perhaps more complicated than /shutdown -s on cmd..
    I actually learned ASCII C language on university but never used it in real.
    I'm trying to create a basic script that perhaps you could help me or guide me how to do it..
    The commands are
    1) Close a running app (end task it or force kill it, I prefer end task it)
    2) delete files from x location
    3) run .exe app from y location
    4) close that running app 
    5) move files from z to y
    Perhaps adding few "wait few seconds" commands in between each, so the apps will launch successfully..
    My first question will be whats the easiest script language to do that?
    I tried VBScript but couldn't find commands for open or close apps.. also for controlling files..
    And what commands can do that? I could google them up for better understanding no need for rough guide
    And lastly, does it too hard? If it takes more than hour to make it (learn and process) than it ain't worth it..
    Thanks alot ahead!
    Jordan.

    hmm 2 questions:
    1) taskkill.exe causing me access deny error.. I used "taskkill.exe /IM softwarename.exe"
    how do I get permission or something to fix that?
    2) on the "move" command..
    First, its a "copy" instead.. but I easily figured that out.. 
    but more important is that I want to copy a folder.. with unknown list of way too long files and sub folders..
    and all I see is ability to move a file..
    Is this possible?
    Thanks

  • Need Help Creating A Script For Labeling Finder Files from Indesign

    Trying to figure out a way to have a script run in InDesign CS4 that will label a text file RED after it's been imported into InDesign.
    We import numerous text files into an InDesign template. Since there are several text files in the same folder, we need to somehow "mark off" that we've imported that file and move to the next one to import. I have created an Automator "service" with a keyboard shortcut to label the file Red in the finder but it would be great if we could have this happen automatically after we import into InDesign.
    If we import the wrong text file by accident and it gets missed in proofing, it costs us a lot of money with the printer.
    Thanks for any ideas.
    Jim

    You know, these guys are absolutely right in their assessment that this is a good place for event listeners. You would need three scripts though.
    Something like...
    Label Placed Files Red.scpt
    --Put this in a folder called IDScripts in your Documents folder
    main(evt)
    on main(myEvent)
    tell application "Adobe InDesign CS4"
    set placedFilePath to full name of myEvent
    set placedFilePath to placedFilePath as alias
    end tell
    tell application "Finder"
    --This turns the file color red
    set label index of placedFilePath to 2
    end tell
    end main
    And these two are in your InDesign scripts folder...
    Start Placed File Finder Labelling.scpt
    --Installs the afterImport event listener for the Label Placed Files Red script.
    tell application "Adobe InDesign CS4"
    set myHandler to path to documents folder
    set myScriptName to "Label Placed Files Red.scpt"
    set myHandler to "" & myHandler & "IDScripts:" & myScriptName
    try
    set myHandler to myHandler as alias
    make event listener with properties {event type:"afterImport", handler:myHandler, captures:true}
    display dialog "Placed File Labelling: ON" buttons "OK" default button 1
    on error
    display dialog "ERROR: Couldn't start handler!" & return & return & "Make sure the \"" & myScriptName & "\" script in a folder called \"IDScripts\" inside your Documents folder and try again" buttons "OK" default button 1
    end try
    end tell
    Stop Placed File Finder Labelling.scpt
    --Removes the afterImport event listener for the Label Placed Files Red script.
    tell application "Adobe InDesign CS4"
    set myHandler to path to documents folder
    set myScriptName to "Label Placed Files Red.scpt"
    set myHandler to "" & myHandler & "IDScripts:" & myScriptName
    set myHandler to myHandler as alias
    set myResult to remove event listener event type "afterImport" handler myHandler with captures
    if (myResult is false) then
    display dialog "ERROR: Couldn't remove handler! Are you sure it is active?" & return & return & "If so, please quit and relaunch InDesign to get rid of it." buttons "OK" default button 1
    else
    display dialog "Placed File Labelling: OFF" buttons "OK" default button 1
    end if
    end tell

  • 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.
    Thanks

    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.
    Thanks

  • Help creating a boot disk for ailing powerbook (and journalist!)

    Hello, I'm a journalist with a desperate need to recover my Mac.
    My Powerbook G4 (operating 10.4.8 I believe) was working fine until I did the latest suggested Mac software upgrade of Safari. Immediately Safari stopped responding hanging up or quitting. So I tried the next recommended update, thinking perhaps the two went together: Security 2008-009 I believe. It required a restart, which I did. (Note: I didn't do the recommended Java or Quicktime update at the same time because I'm currently working in Sierra Leone with terribly slow internet and figured I'd get to it later).
    Now, however, the computer won't boot up. I hear the tone, I get the gray screen with the apple, I get the blue screen, I get the opening OS X screen and the blue progress bar, which then quits early on. Then I get a blue screen of alternating hues, which continues infinitely.
    I tried all the Apple and web-suggested fixes. I cannot enter safe mode and can only perform functions with the single user mode. I've tried fsck and it said my HD is fine. The problem, I suspect, would be easy enough to fix if I could just reinstall OS X with my CD. However I am currently 7000 miles from home and CD, and in desperate need of my laptop in order to continue my volunteer work.
    I do have access to a friend's MacBook Pro 10.4.9 and the internet. I have downloaded Carbon Copy Cloner... however I don't know which files I need to copy in order to create a boot disk. Nor do I know how to create a boot disk to actually put into my computer. I have also been scared by the CCC literature that says I need to erase the target volume... which in this case is my external hard drive containing all of our video footage from the last 8 months!
    I use my computer every day, however I am a newbie at using things like Terminal and higher order functions that these occasions seem to require. CCC's Help manual, for me, might as well have been written in hieroglyphs (which, come to think of it, would have been easier as I seem to understand pictures well enough).
    I would be eternally grateful for any simple or step-by-step advice which might help me get back to work. I'm training African journalists, and without my computer to edit, we cannot do a thing!
    Thanks,
    Kim

    Here's some trouble shooting methods that I've copied from Apple KB articles:
    Resetting PRAM and NVRAM
    Shut down the computer.
    Locate the following keys on the keyboard: Command, Option, P, and R. You will need to hold these keys down simultaneously.
    Turn on the computer.
    Press and hold the Command-Option-P-R keys. You must press this key combination before the gray screen appears.
    Hold the keys down until the computer restarts and you hear the startup sound for the second time. Release the keys.
    If zapping the PRAM doesn't work, try resetting the PMU.
    Warning: Resetting the power manager also resets date and time settings. Performing a PMU reset returns the iBook and PowerBook hardware, including NVRAM, to default settings and forces the computer to shut down.
    PowerBook G4 (DVI) and PowerBook G4 (1 GHz/867 MHz)
    If the computer is on, turn it off.
    Disengage the two keyboard latches located between the Esc and F1 keys, and the F11 and
    F12 keys. (You may also need to disengage the keyboard locking screw located between the
    F5 and F6 keys.)
    Lift the keyboard. To ensure no harmful static electricity is transferred to the computer,
    properly ground yourself before performing this procedure.
    Press and release the reset button located on the upper right side of the logic board near the power button, shown here. Wait 5 seconds.
    Press the power button to restart the computer.
    PowerBook G4 and PowerBook G4 (Gigabit Ethernet)
    If the computer is on, turn it off.
    Press and release the reset button located on the rear panel of the computer between the
    external video and modem ports. Wait 5 seconds.
    Press the Power button to restart the computer.
    HTH!

  • Need urgent help on how to compare the user profile and process form attributes

    Hi All,
    We have a requirement  where after editing the  user profile attributes we have to compare the currently modified user  profile attributes and the existing     
    process form attributes and based on the differences we have to update the  process form accordingly.
    We have around 80 attributes so we cannot follow the procedure where
    we update the lookup process_triggers
    and add the "change attribute" task
    and "update attribute" taskin the process definition
    because it creates aroung 160 tasks in process definition. So we are doing it by writing a custom code. Is there any other simple way to do it or any API"s which can help us.
    Need very quick help.Thanks in advance.
    Regards,
    Geetha

    Check MOS: 1595938.1
    -Bikash

Maybe you are looking for

  • Help finding and using a package

    hi guyz, Iam new to this forum and i need this info urgently. so plz try to help me. I want to use the package below in an applet to convert my TemporaryRegistrationPermit to create a PNG file and then print it. how can i get the above package. I sea

  • Small "B0" in front of heading in PDF

    A small number appears before the headings in a PDF. We generate the PDF from Word 2010 and PDF with Adobe XI Pro. This number does not appear in the word document

  • Retry "Bulk Load Post Process" batch

    Hi, First question, what is the actual use of the scheduled task "Bulk Load Post Process"? If I am not sending out email notification, nor LDAP syncing nor generating the password do I still need to run this task after performing a bulk load through

  • Photoshop CS6 healing brush tool wont work

    So neither the healing brush tool, nor the spot healing brush tool wont work properly. It looks good, until you let it go. Then all it does is smudge (photos attached)

  • Marking chapters in audio books

    I am trying out buying audio books at iTunes Store. I bought one and burned it to a cd with no trouble. However, afterwards I noticed that the whole book was divided into only 2 tracks. I had naively expected that each chapter would be marked as a tr