Need a scripting guide

We have a couple of InDesign CS4 files with us. We need to genereate a report as follows:
1. Need to take used paragraph and character styles as chapterwise. Do not take entire style available in the document.
2. Also required the corresponding font name and font style that appear next to the style.
for e.g. the report (.csv format) shows as illustrated below.
Used style information
File name
Paragraph styles
Font Family
Font Style
Character styles
Font Family
Font Style
Chapter 1.indd
para
Times
Roman
inside
Times
Bold
para1
Times
Roman
inside1
Times
Italic
para2
Times
Roman
inside2
Times
Bold
para3
Times
Roman
inside3
Times
Bold Italic
para4
Times Ten
Roman
inside4
Times Ten
Bold
para5
Times Ten
Roman
inside5
Times Ten
Bold Italic
para6
Times Ten
Roman
inside6
Times Ten
Italic
para7
Helvetica
Regular
inside7
Helvetica
Bold
para8
Helvetica
Regular
inside8
Helvetica
Bold Italic
Chapter 2.indd
para
Times
Roman
inside
Times
Bold
para1
Times
Roman
inside1
Times
Italic
para2
Times
Roman
inside2
Times
Bold
para3
Times
Roman
inside3
Times
Bold Italic
para4
Times Ten
Roman
inside4
Times Ten
Bold
para5
Times Ten
Roman
inside5
Times Ten
Bold Italic
para6
Times Ten
Roman
inside6
Times Ten
Italic
para7
Helvetica
Regular
inside7
Helvetica
Bold
para8
Helvetica
Regular
inside8
Helvetica
Bold Italic
Any help much appreciated. . .
JA

Hi John,
      I worked out this as in .txt. It works fine. You use this codes and try with .csv.
Try this. Before that u've to create a empty text file in the desktop and copy the path to be saved...
var doc1 = app.documents[0];
var doc2 = app.documents[1];
//Paragraph Styles.......................................
var styles = doc1.stories.everyItem().paragraphs.everyItem().appliedParagraphStyle;
var len=styles.length;
a=[];
for(var i=0;i<len;i++)
    a.push(styles[i].name);
//alert(a);
//Character Styles.........................................
var chrstyles=doc1.stories.everyItem().paragraphs.everyItem().appliedCharacterStyle;
var len1=chrstyles.length;
b=[];
for(var i=0;i<len1;i++)
    b.push(chrstyles[i].name);
var styles1 = doc2.stories.everyItem().paragraphs.everyItem().appliedParagraphStyle;
var len1=styles1.length;
c=[];
for(var i=0;i<len1;i++)
    c.push(styles1[i].name);
//alert(a);
//Character Styles.........................................
var chrstyles1=doc2.stories.everyItem().paragraphs.everyItem().appliedCharacterStyle;
var len2=chrstyles1.length;
d=[];
for(var i=0;i<len2;i++)
    d.push(chrstyles1[i].name);
//alert(b);
var filenew=File("C:/Documents and Settings/velprakashk/Desktop/vel.txt");       //The created empty text file path here...
var f = filenew.open("w");
var txt=filenew.read();
txt=doc1.name +"\r";
txt=txt+"ParagraphStyles:\r"
txt=txt +a + "\r";
txt=txt+"CharacterStyles:\r"
txt=txt + b + "\r";
txt=txt +doc2.name +"\r";
txt=txt+"ParagraphStyles:\r"
txt=txt +c + "\r";
txt=txt+"CharacterStyles:\r"
txt=txt + d + "\r";
alert(txt);
filenew.write(txt);
filenew.close();
Now the things is saved in the file in desktop...
With Regards,
Vel.

Similar Messages

  • CS3 Scripting Guide AppleScript

    Shane Stanley wrote:
    > No, I have no financial link with Script Debugger, but I do think that
    > trying to script without it is a bit like having one hand tied behind your
    > back.
    >
    > We've talked of doing AppleScript Pro Sessions in Amsterdam, but alas
    > nothing has come of it so far. Ray did do a session for Apple over there a
    > couple of years back.
    Okay, I'll download the Script Debugger demo at some point and give it
    a run, but I'd better stick to one thing at a time at this point considering
    how long it's taking me just to get through the ID Scripting Guide. I have,
    however, managed to get beyond Chapter 2, and have renamed this topic
    accordingly.
    Thanks,
    Roy

    Shane Stanley wrote:
    > BOMs tend to matter only when you're moving stuff between systems
    > using
    > different endian processors, eg Intel vs PPC. It's a pity in a way
    > that BOMs
    > aren't used more widely, but much of the industry seems stuck in
    > good-enough
    > mode with ASCII variants. if you're not seeing text get garbled,
    > you're
    > fine.
    I did get some garbled text the other day, but I don't think it was a
    BOM issue. Setting the TextWrangler encoding preferences for Little-
    Endian seems to occasion some problems, mainly undesired alerts, so I
    changed them back to Western (Mac OS Roman). As far as I can remember,
    I needed Little-Endian only for doing something with ID tagged text
    that I'm now done with for the time being.
    Hey, here's one I managed to do on my own:
    tell application "Adobe InDesign CS4"
    activate
    set myDocument to make document
    set myMarginPreferences to margin preferences of myDocument
    set bottomMargin to bottom of myMarginPreferences
    set bottomYPoint to (page height of document preferences of
    myDocument) - bottomMargin
    set rightMargin to right of myMarginPreferences
    set rightXPoint to (page width of document preferences of myDocument)
    - rightMargin
    tell page 1 of myDocument
    set myTextFrame to make text frame with properties {geometric bounds:
    {top of myMarginPreferences, left of myMarginPreferences,
    bottomYPoint, rightXPoint}}
    select insertion point -1 of myTextFrame
    end tell
    end tell
    I suppose that's what you'd call trivial, but I didn't have it before
    and now I do - assigned to cmd-n, understandably.
    It wasn't easy for me and I blew too much time on it. I think the main
    problem was that I kept hitting this point:
    tell application "Adobe InDesign CS4"
    activate
    set myDocument to make document
    set myMarginPreferences to margin preferences of myDocument
    tell page 1 of myDocument
    set myTextFrame to make text frame with properties {geometric bounds:
    {top of myMarginPreferences, left of myMarginPreferences, (page height
    of document preferences of myDocument) - (bottom of
    myMarginPreferences), [...]}}
    at which it would keep telling me:
    Canât make «class marb» of «class impp» of document "Untitled-
    [n]" of application "Adobe InDesign CS4" into type number.
    I couldn't figure out what was going on there, and still can't. There
    wasn't any problem with top of myMarginPreferences. bottom of
    myMarginPreferences had to be a number, in order to work with top of
    myMarginPreferences which evidently was text, and, uh... confused again!
    Oh... top of myMarginPreferences is text, while
    page height of document preferences of myDocument is a number, right?
    If so, that doesn't seem to be intuitively evident, exactly.
    Thanks,
    Roy

  • [ID CC] Is there a specific scripting guide for CC?

    Hi,
    I was looking for the scripting guide (both applescript and Javascript) for ID CC, but all I see is the CS6 version. Is that normal? I know there isn't that much new between the two version, but it would be nice to have the updated guides.
    Also, I had heard that the Applescript language was going to be fased out. Meaning, no new feature would be supported and things that changed would break current code in future version of the software. Is there any thruth in this? I'm a fairly novice applescripter and I can't even read Javascript, so I was wondering if I need to try to learn Javascript ASAP or if I'll be able to go by with my applescript.
    Thanks for any input.
    Jeff

    @Jeff – don't know if there is a specific scripting guide for InDesign CC.
    For news of new methods, properties and objects in the DOM (Document Object Model) in ExtendScript (Adobe's implementation of JavaScript) with InDesign see:
    Marc Autret:
    So What's New in InDesign CC Scripting DOM
    http://www.indiscripts.com/post/2013/06/so-what-s-new-in-indesign-cc-scripting-dom
    Another valuable reference (not covering CC but also InDesign CS6) is:
    http://www.jongware.com/idjshelp.html
    For learning ExtendScript you will find useful:
    1. Learn about "core" JavaScript (there are plenty of useful courses floating around in the web)
    2. Buy yourself a book like Grant Gamble's "InDesign CS5 – Automation Using XML & JavaScript"
    and experiment with your own InDesign files and code snippets from that base on…
    3. Find a collegue or some friends who also want to learn about it and do some learning sessions together
    4. Visit this forum a lot and browse through older threads. Most threads are about ExtendScript.
    Where did you hear that Adobe wants to phase out AppleScript on its products?
    Flash based extensions and related to that "ActionScript" will be phased out next year for building Extensions for CC applications. It will be replaced with [HTML5, CSS and JavaScript] for building widgets. PhotoShop CC will be the first product where we will see this (maybe around mid 2014); others will follow.
    Maybe you read about the abbreviation "AS" in this regard; which for some people is "AppleScript" and for some people it is "ActionScript". Don't confuse the two scripting languages.
    Uwe

  • Indesign Script Guide

    Hi, I am new to Indesign Scripting, I need some Basic Scripting guide for XML and Non-XML automation,

    Thanks for your response, I had collected the Scripting Resources from adobe.com,
    And am looking for the scripting guides developed by other devlopers.
    hope it’s funny but many programmers have its own documentation for scripting, It will helpful for beginners like me.,

  • Oracle and O/S Scripting Guide

    i need your help.
    i need scripting guide that cover unix and sql combination scripting writing guide.. i would prefer basic level guid please provide me a link thanx in advance

    rajeysh wrote:
    sorry, aman . i just want to view the forum columns/topics for learning purpose. sometimes in motivation of helping others. i replied. I never do this anymore.Nope, no need to say sorry mate! Some times, help is not giving what the person is asking. At times, asking a "why, what for" is more important than giving a solution to the person. That's what was the case with supplying a download link to a book which is available for purchase. I know it can be costly to buy some books. I did purchase the mentioned book just 2 weeks in a very steep price (got it imported) but I am happy that I bought it and in this way, I did give something back to the authors who have put a lot of effort in writing a book. That's what the whole point was of me and Fahd saying to you to remove the link(right Fahd? ) . No need to apologize, we all are fellow members only of this forum.
    Aman....

  • I need a script, is it possible?

    Hello all,
         I need a script that does the following.
    I select an object in AI CS3 and then execute the script.
    1st. The script takes the object and fills it with 100% magenta and makes it a spot color named CC.
    2nd. The script then resizes the document to 1" larger than the selected object and centers all art in the middle of the art board,. (so if the object is 10.5" x 15.7" the document setup size is changed to 11.5" x 16.7")
    3rd. The script then stores the size of the selected object and the new resize of the document setup on the clipboard. So if I paste into notepad it would paste "10.5 X 15.7 - 11.5 X 16.7"
    That is it, it does not need to be exact on the pasting syntax but close if you know what I mean. This will be used in a production environment so a hot key to execute the script would be nice.
    If I can get help with this it would be awesome, Please let me know if you can help.
    Anton

    there you go
    var doc = app.activeDocument;
    var sel = doc.selection;
    var doc2 = null;
    for(j= sel.length - 1; j>= 0; j--) {
        var spotty = new SpotColor();
        spotty.tint = 100;
        var spottyColor = new CMYKColor();
        spottyColor.magenta = 100;
        spotty.spot = doc.spots.add();
        spotty.spot.colorType = ColorModel.SPOT;
        spotty.spot.name = "CC";
        spotty.spot.color = spottyColor;
        sel[j].fillColor = spotty;
        sel[j].name = "##REFERENCE";
        var nInc = new UnitValue(1, "in");
        var cWidth = new UnitValue(sel[j].width, "pt");   
        var cHeight = new UnitValue(sel[j].height, "pt");
        doc2 = app.documents.add(DocumentColorSpace.CMYK, cWidth + nInc.as("pt"), cHeight.value + nInc.as("pt"), 1);
        var newSel = sel[j].duplicate(doc2);
        var nTL = parseFloat((nInc.as("pt") / 2));
        var nTop = cHeight.value + nTL;
        newSel.position = [nTL, nTop];
        grabAndCenterObjects();
        var txtFrm = doc2.textFrames.add();
        txtFrm.contents = "Old dimensions: " + cWidth.as("in").toFixed(2) + " X " + cHeight.as("in").toFixed(2) + "\" New dimensions:" + (cWidth.as("in")+1).toFixed(2) + " X " + (cHeight.as("in")+1).toFixed(2) + "\"";
        doc2.selection = null;
        txtFrm.selected = true;
        app.copy();
        txtFrm.remove();
    function grabAndCenterObjects(ignorePath) {
        for(j = doc.pageItems.length - 1; j >= 0; j--) {
            if(doc.pageItems[j].name.indexOf("##REFERENCE") > -1) continue;
            var mElem = doc.pageItems[j].duplicate(doc2);
            var left = (doc.pageItems[j].width > doc2.width) ? -(doc.pageItems[j].width - doc2.width) / 2 : (doc2.width - doc.pageItems[j].width) / 2;
            var top = (doc.pageItems[j].height > doc2.height) ? (doc.pageItems[j].height + (doc.pageItems[j].height - doc2.height)/2) : (doc.pageItems[j].height + (doc2.height - doc.pageItems[j].height)/2);
            mElem.position = [left, top];
    hope it helps;
    cheers;

  • Need java script 6.26 to use banking software keep getting "the connection was reset" error Java appears on addon blocked list

    I am trying to use Team One Credit Unions CU@home to access my accounts. Their support team tells me I need Java script 6.26. I show that on my add on list but it also states Java is blocked on the blocked software list. How do I get Java script running so I can do my home banking or at least test it to be sure that is the issue. I have tried running this program with Java enabled and disabled with the same results.

    To avoid confusion: http://kb.mozillazine.org/JavaScript_is_not_Java
    See:
    * http://kb.mozillazine.org/Java
    * http://kb.mozillazine.org/JavaScript
    Java 6 U26 is about the Java plugin.
    You can see in "Tools > Add-ons > Plugins" if the Java plugin is installed and also on the about:plugins page via the location bar.
    * http://www.java.com/en/download/help/testvm.xml - How do I test whether Java is working on my computer? - 1.4.2_xx, 1.5.0, 6.0

  • Have been here before but still have not resolved a fix for a black screen when I try to access a PDF file...Now I've got a new iPad and need the User Guide which is only available inPDF

    Have been here before but still have not resolved a fix for a black screen when I try to access a PDF file using Safari...Now I've got a new iPad and need the User Guide which is only available in PDF and FireFox will not work.

    Hello,
    '''Try Firefox Safe Mode''' to see if the problem goes away. Safe Mode is a troubleshooting mode, which disables most add-ons.
    ''(If you're not using it, switch to the Default theme.)''
    * On Windows you can open Firefox 4.0+ in Safe Mode by holding the '''Shift''' key when you open the Firefox desktop or Start menu shortcut.
    * On Mac you can open Firefox 4.0+ in Safe Mode by holding the '''option''' key while starting Firefox.
    * On Linux you can open Firefox 4.0+ in Safe Mode by quitting Firefox and then going to your Terminal and running: firefox -safe-mode (you may need to specify the Firefox installation path e.g. /usr/lib/firefox)
    * Or open the Help menu and click on the '''Restart with Add-ons Disabled...''' menu item while Firefox is running.
    [[Image:FirefoxSafeMode|width=520]]
    ''Once you get the pop-up, just select "'Start in Safe Mode"''
    [[Image:Safe Mode Fx 15 - Win]]
    '''''If the issue is not present in Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one. Please follow the [[Troubleshooting extensions and themes]] article for that.
    ''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before opening Firefox for normal use again.''
    ''When you figure out what's causing your issues, please let us know. It might help other users who have the same problem.''
    Thank you.

  • InDesign Scripting Guide/Apple Script

    The command
    set myTop to top of margin preferences of myPage
    described in the InDesign Scripting Guide doesn't work with Indesign CS2. Does anyone can help?
    Thanks

    Hi Morenga 65,
    Try:
    tell margin preferences of myPage
    set myTop to top
    end tell
    But, as Dave says, do come to the Scripting Forum--there's lots of good stuff there!
    Thanks,
    Ole

  • Need help - need a script

    Hi All,
    I have no knowledge of applescript and need something made to meet a deadline. I am a graphic artist for the national office of a non-profit with 400 agencies.
    I need a script to control adobe illustrator to make customized logo packages for all of the agencies. I have 5 base documents. There are multiple logos per document. The text is set as "aaa" that needs to be customized. I am doing a find and replace to insert the text. Each file also has a 'tagline' layer that gets turned off and saved that way also.(a PNG) One master file gets saved as an illustrator PDF.
    I need the script to ask me what the agency number is and also what the agency name is and make/name a new folder and then process the logos in illustrator saving the files in the new folder.
    They needed to be completed yesterday, but it takes me roughly 10 to 15 minutes to do one agency. I have no time to work on them during the day a all so I am pretty deserate. We have no budget for this, but I am willing to pay $50 or so out of my own pocket(sorry... recently had twins so I'm broke too)
    Please contact me at [email protected] if you could do this.

    Hi jasonschaeffer
    try here
    http://macfreelancer.com/
    Budgie

  • I need a script to invert the page order of selected pages for cs5.

    Hello,
    I am a graphic designer and i am trying to create a easier way to make multiple page folders, By using the multiple page size feature in inDesign CS5. But my problem is that i can create the front side of the folder easier than before, the backside is my problem I need to inverse the page order manual, this creates a lot of mistakes and errors along the way. Thats why I need a script to invert the page order of the pages I select. I hope to hear from someone soon.
    My best regards,
    Gijs van Roij

    In /gateprd/ARCHIVE/*.arc
    This is the script to remove the archives after it has been backup by the netbackup policy named Archive. This policy removes the archives that have been backed up.
    /home/oracle/dba/scripts> more rmovarch.sh
    #!/bin/ksh
    # compress /gateprd/ARCHIVE/*.arc
    find /gateprd/ARCHIVE/*.arc -type f ! -exec echo {} > /home/oracl
    e/dba/lists/ARCHIVElist \;
    if test $(cat /home/oracle/dba/lists/ARCHIVElist|wc -l) -gt 0
    then
    echo "Hay archives. Se corre script de borrar"
    /home/oracle/dba/scripts/ARCHIVE_BACKUP.sh ARCHIVE
    else
    echo "No archives!!"
    fi

  • I need a script that copies the filename into the file

    I need a script that copies the filename into 4th column of each line in the text doc file.
    I have over 2000 different file names each containing 6 columns and ~50-100 rows.
    I can do this manually using this script:
    awk '{print $1"\t"$2"t\"$3"\t <name> \t"$6}'
    But I would like an automation command or script. Is there any command that I can use instead of <name> that will copy the filename into the column?
    Thanks
    Monica

    Oops, I forgot the redirect to a file. It's not a good idea to edit files in place. A script could fail and you're left with at least one file ruined. It's better to create new files then delete the old files.
    for file in *; do
        while read col1 col2 col3 col4 col5 col6; do              
            printf "%s\t%s\t%s\t%s\t%s\n" $col1 $col2 $col3 $file $col6
        done < $file > n$file
    done
    You could narrow the files listed such as
    for file in *.tsv
    and redirect the new files to another directory. Such as
    done < $file > /absolute/path/to/directory/$file

  • Need a script to move files to folders

    Hi guys.  I have found a lot of similar threads but not something exactly like what I need.
    I have a ton of files that need to be sorted into folders of the same name.  I found scripts to help me with that however, I have some variations on the files with an extension to the file name that also need to be moved into the same folders.
    For instance, I have a folder named....
    spiegal_case_25_video_3
    and I have the following files that all need to be moved into that folder....
    spiegal_case_25_video_3.mp4
    spiegal_case_25_video_3.webmsd.webm
    spiegal_case_25_video_3_h.flv
    spiegal_case_25_video_3_m.flv
    spiegal_case_25_video_3_l.flv
    I have found scripts to get me part of the way there but I can't get the FLVs into the folders because of the _h _m and _l extensions on the file names.  Is there a way to move these files into their appropriate folders (maybe by ignoring the last 2 characters in the file name?)
    I have also found a script that will read everything up to the underscore, but that won't help since the file names have multiple underscores.  So I really need a script that can do the sorting while ignoring the last 2 characters in the file name.
    Can anyone help me out?  I'm not very script savvy.
    Thanks!

    I've tested the following script (under OS X 10.8.5) with 4 subfolders and 20 files, all located in a folder called "Master folder" located in a USB flash drive named "EXT_DRIVE". It seems to work flawlessly. In its present state, the script will replace any file already located in any of the subfolders.
    set theMasterFolder to POSIX file "/Volumes/EXT_DRIVE/Master folder"
    tell application "Finder"
        activate
        set theFolders to (folders of folder theMasterFolder) as alias list
        repeat with thisFolder in theFolders
            set thisName to name of thisFolder
            move (files of folder theMasterFolder whose name begins with thisName) to thisFolder with replacing
        end repeat
    end tell

  • Need a script to enable in-place hold on Office 365

    Hello, I need a script to enable in-place hold on Office 365 for my users.
    The options that I have found for this so far is to enable in-place hold for a DL or an individual user. Is there a way to use a CSV instead?
    This is what I have used before.....where "allstaff" is the name of a DL.
    New-MailboxSearch -name "3 Year In-Place Hold" -SourceMailboxes allstaff -InPlaceHoldEnabled $true -ItemHoldPeriod 1095

    That doesn't seem to work.........I think it's trying to create a new hold query for every user.
    PS C:\scripts> ./user_hold.ps1
    WARNING: The hold setting may take up to 60 minutes to take effect.
    Name                CreatedBy           InPlaceHoldEnabled  Status
    3 Year In-Place ... S-1-5-21-2495351... True                NotStarted
    Unable to execute the task. Reason: A mailbox search named <3 Year In-Place Hol
    d> already exists or is currently being deleted. Please choose a different name
        + CategoryInfo          : InvalidArgument: (Microsoft.Excha...DiscoverySea
       rch:MailboxDiscoverySearch) [], MailboxSearchTaskException
        + FullyQualifiedErrorId : [Server=BLUPR06MB097,RequestId=e8df9b95-2e00-428
       d-813f-da05ea8d09d4,TimeStamp=11/5/2013 9:38:05 PM] [FailureCategory=Cmdle
      t-MailboxSearchTaskException] 95CD9ECA
    So my next question...........how do I add users to an existing In-Place hold?

  • I need a script that will find the computer a user last logged into.

    I am still learning scripting, I need a script that will allow me to pull in usernames from a csv file. Find what computer they last logged into and output that to an csv file.
    I have looked all over and can't find exactly what I need.
     I found the following script but I need  to add the resuitsize unlimited but can not figure out where to put it we have a large environment. Also I need to be able to grab username from a csv file. Any assistance you can provide is appreciated.
    ##  Find out what computers a user is logged into on your domain by running the script
    ##  and entering in the requested logon id for the user.
    ##  This script requires the free Quest ActiveRoles Management Shell for Active Directory
    ##  snapin  http://www.quest.com/powershell/activeroles-server.aspx
    Add-PSSnapin Quest.ActiveRoles.ADManagement -ErrorAction SilentlyContinue
    $ErrorActionPreference = "SilentlyContinue"
    # Retrieve Username to search for, error checks to make sure the username
    # is not blank and that it exists in Active Directory
    Function Get-Username {
    $Global:Username = Read-Host "Enter username you want to search for"
    if ($Username -eq $null){
    Write-Host "Username cannot be blank, please re-enter username!!!!!"
    Get-Username}
    $UserCheck = Get-QADUser -SamAccountName $Username
    if ($UserCheck -eq $null){
    Write-Host "Invalid username, please verify this is the logon id for the account"
    Get-Username}
    get-username resultsize unlimited
    $computers = Get-QADComputer | where {$_.accountisdisabled -eq $false}
    foreach ($comp in $computers)
    $Computer = $comp.Name
    $ping = new-object System.Net.NetworkInformation.Ping
      $Reply = $null
      $Reply = $ping.send($Computer)
      if($Reply.status -like 'Success'){
    #Get explorer.exe processes
    $proc = gwmi win32_process -computer $Computer -Filter "Name = 'explorer.exe'"
    #Search collection of processes for username
    ForEach ($p in $proc) {
    $temp = ($p.GetOwner()).User
    if ($temp -eq $Username){
    write-host "$Username is logged on $Computer"

    If you are querying by user "resultset size" will be of no use.
    You also have functions that are never used and the body code doe snot look for users.
    Here is what you scrip looks like if printed well.  It is just a jumble of pasted together and unrelated items.
    ## Find out what computers a user is logged into on your domain by running the script
    ## and entering in the requested logon id for the user.
    ## This script requires the free Quest ActiveRoles Management Shell for Active Directory
    ## snapin http://www.quest.com/powershell/activeroles-server.aspx
    Add-PSSnapin Quest.ActiveRoles.ADManagement -ErrorAction SilentlyContinue
    $ErrorActionPreference = "SilentlyContinue"
    # Retrieve Username to search for, error checks to make sure the username
    # is not blank and that it exists in Active Directory
    Function Get-Username {
    $Global:Username = Read-Host "Enter username you want to search for"
    if ($Username -eq $null) {
    Write-Host "Username cannot be blank, please re-enter username!!!!!"
    Get-Username
    $UserCheck = Get-QADUser -SamAccountName $Username
    if ($UserCheck -eq $null) {
    Write-Host "Invalid username, please verify this is the logon id for the account"
    Get-Username
    get-username resultsize unlimited
    $computers = Get-QADComputer | where { $_.accountisdisabled -eq $false }
    foreach ($comp in $computers) {
    $Computer = $comp.Name
    $ping = new-object System.Net.NetworkInformation.Ping
    $Reply = $null
    $Reply = $ping.send($Computer)
    if ($Reply.status -like 'Success') {
    #Get explorer.exe processes
    $proc = gwmi win32_process -computer $Computer -Filter "Name = 'explorer.exe'"
    #Search collection of processes for username
    ForEach ($p in $proc) {
    $temp = ($p.GetOwner()).User
    if ($temp -eq $Username) {
    write-host "$Username is logged on $Computer"
    I suggest finding the original code then use the learning link at the top of this page to help you understand how it works in Powershell.
    ¯\_(ツ)_/¯

Maybe you are looking for

  • Getting the length of a field in a database.

    I have a field in a database that has a char length of 20, is there anyway to get that length from the database.

  • Location of single files in garageband 08

    hi, i need to grab hold of one of many recorded file in a garageband project in order to put it to use in another project in antother program. how do I locate the single files in my garageband project? best tellef, oslo

  • Using the $ to lock a cel in a formula

    Hi there, when i put a string in my formule to block the cel ( so i can draw the formule down) it just works fine. But after saving, closing and re-opening my file the formula has changed and doesn't work anymore! for example; I put an amount in cel

  • BI Support Package from 15 to 18

    Hello All, We are planning to implement SP15 to SP18 in our BI environment. How do we proceed ? Software Components SAP-JEECOR       7.00 SP15 SAP_JTECHF     7.00 SP15 UMEADMIN     7.00 SP15 LM-TOOLS     7.00 SP15 ADSSAP          7.00 SP15 JSPM      

  • About The Repository Design Approach

    Hi All, I am working for a project on OBIEE in which this tool is used for Ad Hoc Reporting. I need to create a repository that should be generic one means i need to create a repository that i need to handover to the client. This repository should be