Modify a script help?

I have main AI documents that are named by a number (for example "320").  Within these master documents I have 50 different artboards also named by numbers (for example "14").  Muppet Mark created an amazing script for me that we use every day here.  The script exports each artboard as a separate PDF file (ai file really) and creates a concatenated file name of [master file name] + "-" + [artboard name] + ".pdf".   So my exported files look like 320-14.pdf, using the above number examples. 
I would like to modify this code (for another script/use) to export the same way, except leave off the...[master file name] + "-" +....part.  I'd like to have the resulting files be named only by the artboard name, and not including the master file name.  Using the same example, the new resulting file would have been named "14.pdf"
Mark - can you or anyone else advise on which line/lines of code need to be removed and/or changed?
Thanks!
Tim
#target illustrator
function artboardsToPDFs() {
     if (app.documents.length = 0) {
          return;
     } else {
          var docRef = app.activeDocument;
          var docName = docRef.name;
          var baseName = docName.replace(/.ai$/,'');
var dF = Folder('S:/Graphics/Manufacturing - Production/Special');
          var aB = docRef.artboards;
          var autoNames = Array();
          for (var i = 0; i < aB.length; i++) {
               var abName = aB[i].name;
               autoNames.push(baseName + '_' + abName + '.ai');
          if (!docRef.saved) docRef.save();
          var aiOpts = new IllustratorSaveOptions();
          aiOpts.compatibility = Compatibility.ILLUSTRATOR13;
          aiOpts.pdfCompatible = true;
          aiOpts.saveMultipleArtboards = true;
          var saveFile = File(dF.fsName + '/' + docName);
          docRef.saveAs(saveFile, aiOpts);
          docRef.close(SaveOptions.DONOTSAVECHANGES);
          saveFile.remove();
          renameFiles(dF, autoNames);
artboardsToPDFs();
function renameFiles(dir, fL) {
     for (var i = 0; i < fL.length; i++) {
          var f = File(dir.fsName + '/' + fL[i]);
          if (f.exists) {
               var reName = f.name.replace('_','-');
               f.rename(reName);
               f = File(dir.fsName + '/' + reName);
               reName = f.name.replace(/\.ai$/,'.pdf');
               t = File(dir.fsName + '/' + reName);
               if (t.exists) t.remove();
               f.rename(reName);

Looks like I chopped a needed line out too… Ooops I'll check it this time… OK this does what you asked at this end…
#target illustrator
function artboardsToPDFs() {
          if ( app.documents.length = 0 ) { return; }
          var docRef = app.activeDocument;
          var baseName = docRef.name.replace( /.ai$/,'' );
          var dF = Folder( 'S:/Graphics/Manufacturing - Production/Special' );
          var aB = docRef.artboards;
          var abNames = Array();
          var autoNames = Array();
          for ( var i = 0; i < aB.length; i++ ) {
                    abNames.push( aB[i].name );
                    autoNames.push( baseName + '_' + aB[i].name + '.ai' );
          if ( !docRef.saved ) docRef.save();
          var aiOpts = new IllustratorSaveOptions();
          aiOpts.compatibility = Compatibility.ILLUSTRATOR13;
          aiOpts.pdfCompatible = true;
          aiOpts.saveMultipleArtboards = true;
          var saveFile = File( dF.fsName + '/' + docRef.name );
          docRef.saveAs( saveFile, aiOpts );
          docRef.close( SaveOptions.DONOTSAVECHANGES );
          saveFile.remove();
          renameFiles( dF, autoNames, abNames );
artboardsToPDFs();
function renameFiles( dir, fL, names ) {
          for ( var i = 0; i < fL.length; i++ ) {
                    var f = File( dir.fsName + '/' + fL[i] );
                    if ( f.exists ) { f.rename( names[i] + '.pdf' ); }

Similar Messages

  • I need help modifying a script in IPCC

    I am running UCCX Premium 5.0(2)SR02_Build045. I have a script in place, but need to modify it. Basically a call comes into my main menu and gets distributed to a contact service queue. If no agents are available the call is queued and the caller is prompted to leave a voicemail after 2 mins. If the caller continues to hold they will stay in queue. I need to modify the script so that all callers are dequeued after 15mins. The call can be terminated or routed back to my operator (0). Any help appreciated I am a scripting newbie!
    By the red arrow is the QueueTransfersLoop. I need to modify this loop to terminate after 15mins.
    Thanks!!
    Chris

    Hi Chris,
    You need to drop the get reporting statistic step in some place of the queue loop, in the get reporting statistic step properties you have to choose for the Report Object parameter the one that says "CSQ IPCC Express", in the Field parameter you have to choose "Current Wait Duration", the Row Identifier is a string variable that has the value of the CSQ name and finally Result Statistic is an integer variable that you have to set to 0.
    After that you need an if statement, in that step you have to compare the value of the Integer variable with some value, in this case the 15mins that you need (you have to compare the values in seconds). It's better to compare the value with a ".equals()" and also with a ">="  because it could be that the call has being queued a little bit more than 15 mins.
    Check the screenshot, that works for me.
    Gabriel.

  • Ruined my contacts with Apple Script, need someone to help me modify the script to undo what I did!

    Hi all, so all my contacts started with "+1". The goal was to erase the "+" and just have all of them start with "1". However, I messed up royally. I ran the following script, which made all my contacts start with "1+1". :
    tell application "Contacts"
              repeat with eachPerson in people
                        repeat with eachNumber in phones of eachPerson
                                  set theNum to (get value of eachNumber)
                                  if (theNum starts with "1+") then
                                            set value of eachNumber to "1" & theNum
                                  end if
                        end repeat
              end repeat
    save
    end tell
    This is messed up in 2 ways. Firstly, I meant to write "+1" in the script, but instead I wrote "1+". Secondly, even if I had written "1+", it still wouldn't make sense, because I'd effectively be telling the program to just add "1" in front of what's already there, including the "+1".
    Could someone please tell me how to modify this script to say:
    If the contact starts with "1+1", then erase the "1+1". Then I would need another script to take all my numbers and add "1" in front of them.

    What you want to do is simply delete the first few characters from the phone number, yes?
    How about something like this:
                             repeat with eachNumber in phones of eachPerson
                                            set theNum to (get value of eachNumber) as string
                                            if (theNum starts with "1+1") then
                     set myFixedNum to (characters 3 thru -1) of theNum
                                            else if (theNum starts with "+1") then
                                                           set myFixedNum to (characters 2 thru -1) of theNum
                                            end if
                                            set value of eachNumber to (myFixedNum as string)
                              end repeat
    That will take you from 1+1 or +1 to 1 in one easy step.

  • Please assist with modifying this script to read in a list of servers and output results to excel

    Hello,
    I have an excellent script written by Brian Wilhite to gather the last logged in user using Powershell.
    http://gallery.technet.microsoft.com/scriptcenter/Get-LastLogon-Determining-283f98ae/view/Discussions#content
    My Powershell Fu is stumbling to modify this script to the following requirements:
    Currently the script must be loaded first into Powershell, then it can be executed.  I would rather edit the script in my Powershell ISE, add the .txt file to the script itself that gives a list of the servers I need to scan.  Then when I
    press Run Script in my ISE it executes.
    I would also like to output the results of the file to excel (.xls or .csv will do).  Currently the results look as follows:
    Computer : SVR01
    User : WILHITE\BRIAN
    SID : S-1-5-21-012345678-0123456789-012345678-012345
    Time : 9/20/2012 1:07:58 PM
    CurrentlyLoggedOn : False
    I would prefer it shows up like so:
    Computer User SID Time Currently LoggedOn
    SVR01 WILHITE\BRIAN S-1xxx 9/20/2012 1:07:58 PM FalseSRV02 WILHITE\BRIAN S-2xxx 9/26/2014 10:00:00 AM True
    Any help you can provide would be greatly appreciated.  I'll add the full script to the end of this post.
    Thank you.
    Function Get-LastLogon
    <#
    .SYNOPSIS
    This function will list the last user logged on or logged in.
    .DESCRIPTION
    This function will list the last user logged on or logged in. It will detect if the user is currently logged on
    via WMI or the Registry, depending on what version of Windows is running on the target. There is some "guess" work
    to determine what Domain the user truly belongs to if run against Vista NON SP1 and below, since the function
    is using the profile name initially to detect the user name. It then compares the profile name and the Security
    Entries (ACE-SDDL) to see if they are equal to determine Domain and if the profile is loaded via the Registry.
    .PARAMETER ComputerName
    A single Computer or an array of computer names. The default is localhost ($env:COMPUTERNAME).
    .PARAMETER FilterSID
    Filters a single SID from the results. For use if there is a service account commonly used.
    .PARAMETER WQLFilter
    Default WQLFilter defined for the Win32_UserProfile query, it is best to leave this alone, unless you know what
    you are doing.
    Default Value = "NOT SID = 'S-1-5-18' AND NOT SID = 'S-1-5-19' AND NOT SID = 'S-1-5-20'"
    .EXAMPLE
    $Servers = Get-Content "C:\ServerList.txt"
    Get-LastLogon -ComputerName $Servers
    This example will return the last logon information from all the servers in the C:\ServerList.txt file.
    Computer : SVR01
    User : WILHITE\BRIAN
    SID : S-1-5-21-012345678-0123456789-012345678-012345
    Time : 9/20/2012 1:07:58 PM
    CurrentlyLoggedOn : False
    Computer : SVR02
    User : WILIHTE\BRIAN
    SID : S-1-5-21-012345678-0123456789-012345678-012345
    Time : 9/20/2012 12:46:48 PM
    CurrentlyLoggedOn : True
    .EXAMPLE
    Get-LastLogon -ComputerName svr01, svr02 -FilterSID S-1-5-21-012345678-0123456789-012345678-012345
    This example will return the last logon information from all the servers in the C:\ServerList.txt file.
    Computer : SVR01
    User : WILHITE\ADMIN
    SID : S-1-5-21-012345678-0123456789-012345678-543210
    Time : 9/20/2012 1:07:58 PM
    CurrentlyLoggedOn : False
    Computer : SVR02
    User : WILIHTE\ADMIN
    SID : S-1-5-21-012345678-0123456789-012345678-543210
    Time : 9/20/2012 12:46:48 PM
    CurrentlyLoggedOn : True
    .LINK
    http://msdn.microsoft.com/en-us/library/windows/desktop/ee886409(v=vs.85).aspx
    http://msdn.microsoft.com/en-us/library/system.security.principal.securityidentifier.aspx
    .NOTES
    Author: Brian C. Wilhite
    Email: [email protected]
    Date: "09/20/2012"
    Updates: Added FilterSID Parameter
    Cleaned Up Code, defined fewer variables when creating PSObjects
    ToDo: Clean up the UserSID Translation, to continue even if the SID is local
    #>
    [CmdletBinding()]
    param(
    [Parameter(Position=0,ValueFromPipeline=$true)]
    [Alias("CN","Computer")]
    [String[]]$ComputerName="$env:COMPUTERNAME",
    [String]$FilterSID,
    [String]$WQLFilter="NOT SID = 'S-1-5-18' AND NOT SID = 'S-1-5-19' AND NOT SID = 'S-1-5-20'"
    Begin
    #Adjusting ErrorActionPreference to stop on all errors
    $TempErrAct = $ErrorActionPreference
    $ErrorActionPreference = "Stop"
    #Exclude Local System, Local Service & Network Service
    }#End Begin Script Block
    Process
    Foreach ($Computer in $ComputerName)
    $Computer = $Computer.ToUpper().Trim()
    Try
    #Querying Windows version to determine how to proceed.
    $Win32OS = Get-WmiObject -Class Win32_OperatingSystem -ComputerName $Computer
    $Build = $Win32OS.BuildNumber
    #Win32_UserProfile exist on Windows Vista and above
    If ($Build -ge 6001)
    If ($FilterSID)
    $WQLFilter = $WQLFilter + " AND NOT SID = `'$FilterSID`'"
    }#End If ($FilterSID)
    $Win32User = Get-WmiObject -Class Win32_UserProfile -Filter $WQLFilter -ComputerName $Computer
    $LastUser = $Win32User | Sort-Object -Property LastUseTime -Descending | Select-Object -First 1
    $Loaded = $LastUser.Loaded
    $Script:Time = ([WMI]'').ConvertToDateTime($LastUser.LastUseTime)
    #Convert SID to Account for friendly display
    $Script:UserSID = New-Object System.Security.Principal.SecurityIdentifier($LastUser.SID)
    $User = $Script:UserSID.Translate([System.Security.Principal.NTAccount])
    }#End If ($Build -ge 6001)
    If ($Build -le 6000)
    If ($Build -eq 2195)
    $SysDrv = $Win32OS.SystemDirectory.ToCharArray()[0] + ":"
    }#End If ($Build -eq 2195)
    Else
    $SysDrv = $Win32OS.SystemDrive
    }#End Else
    $SysDrv = $SysDrv.Replace(":","$")
    $Script:ProfLoc = "\\$Computer\$SysDrv\Documents and Settings"
    $Profiles = Get-ChildItem -Path $Script:ProfLoc
    $Script:NTUserDatLog = $Profiles | ForEach-Object -Process {$_.GetFiles("ntuser.dat.LOG")}
    #Function to grab last profile data, used for allowing -FilterSID to function properly.
    function GetLastProfData ($InstanceNumber)
    $Script:LastProf = ($Script:NTUserDatLog | Sort-Object -Property LastWriteTime -Descending)[$InstanceNumber]
    $Script:UserName = $Script:LastProf.DirectoryName.Replace("$Script:ProfLoc","").Trim("\").ToUpper()
    $Script:Time = $Script:LastProf.LastAccessTime
    #Getting the SID of the user from the file ACE to compare
    $Script:Sddl = $Script:LastProf.GetAccessControl().Sddl
    $Script:Sddl = $Script:Sddl.split("(") | Select-String -Pattern "[0-9]\)$" | Select-Object -First 1
    #Formatting SID, assuming the 6th entry will be the users SID.
    $Script:Sddl = $Script:Sddl.ToString().Split(";")[5].Trim(")")
    #Convert Account to SID to detect if profile is loaded via the remote registry
    $Script:TranSID = New-Object System.Security.Principal.NTAccount($Script:UserName)
    $Script:UserSID = $Script:TranSID.Translate([System.Security.Principal.SecurityIdentifier])
    }#End function GetLastProfData
    GetLastProfData -InstanceNumber 0
    #If the FilterSID equals the UserSID, rerun GetLastProfData and select the next instance
    If ($Script:UserSID -eq $FilterSID)
    GetLastProfData -InstanceNumber 1
    }#End If ($Script:UserSID -eq $FilterSID)
    #If the detected SID via Sddl matches the UserSID, then connect to the registry to detect currently loggedon.
    If ($Script:Sddl -eq $Script:UserSID)
    $Reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]"Users",$Computer)
    $Loaded = $Reg.GetSubKeyNames() -contains $Script:UserSID.Value
    #Convert SID to Account for friendly display
    $Script:UserSID = New-Object System.Security.Principal.SecurityIdentifier($Script:UserSID)
    $User = $Script:UserSID.Translate([System.Security.Principal.NTAccount])
    }#End If ($Script:Sddl -eq $Script:UserSID)
    Else
    $User = $Script:UserName
    $Loaded = "Unknown"
    }#End Else
    }#End If ($Build -le 6000)
    #Creating Custom PSObject For Output
    New-Object -TypeName PSObject -Property @{
    Computer=$Computer
    User=$User
    SID=$Script:UserSID
    Time=$Script:Time
    CurrentlyLoggedOn=$Loaded
    } | Select-Object Computer, User, SID, Time, CurrentlyLoggedOn
    }#End Try
    Catch
    If ($_.Exception.Message -Like "*Some or all identity references could not be translated*")
    Write-Warning "Unable to Translate $Script:UserSID, try filtering the SID `nby using the -FilterSID parameter."
    Write-Warning "It may be that $Script:UserSID is local to $Computer, Unable to translate remote SID"
    Else
    Write-Warning $_
    }#End Catch
    }#End Foreach ($Computer in $ComputerName)
    }#End Process
    End
    #Resetting ErrorActionPref
    $ErrorActionPreference = $TempErrAct
    }#End End
    }# End Function Get-LastLogon

     This should work:
    Get-LastLogon -Computername (Get-content .\Servers.txt) | Export-CSV .\Output.csv -NoTypeInformation
    I just tested it on my test domain and it did the trick.

  • 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;

  • Modify Powershell Script

    Hello
    How can I modify this script to target all Users OU in one domain to move all disabled accounts from each Users OU to move to the Disabled Users OU?
    Search-ADAccount –AccountDisabled –UsersOnly –SearchBase “OU=Users,OU=test,OU=domain,DC=domain,DC=com”  | Move-ADObject –TargetPath “OU=Disabled Users,DC=domain,DC=com”
    The above script will work for but only for one OU, I need it to target all OU=Users OU.
    Thanks

    Hi Rover,
    I‘m writing to check if the suggestions were helpful, if you have any questions, please feel free to let me know.
    If you have any feedback on our support, please click here.
    Best Regards,
    Anna
    TechNet Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • HandbreakCLI drop folder script HELP!

    Im trying to get this script to work that passes a file through a drop folder, processes it with HandbreakCLI, then outputs the encoded file to a folded named "iflicks encode" in my "Movies" folder.
    My problem is that I can't figure out how to modify the script to direct the file into the "iflicks encode" folder. Im sure this is a easy fix for some of the more knowledgeable users out there, help would be greatly appreciated.
    on adding folder items to thisFolder after receiving theitems
    with timeout of 10000000 seconds
    try
    --repeat the command to compress each item as an individual archive
    repeat with oneItem in theitems
    tell application "Finder"
    --used to extract the name and location of the file
    set itemProp to properties of oneItem
    --where the file is
    set sourceFile to quoted form of POSIX path of oneItem
    --where the compressed file should end up
    set destFold to "HD(Mini):Users:jaredcraig:Movies:test:"
    --what the name of the file is
    --set extension hidden of oneItem to true
    if extension hidden of oneItem then
    set itemName to displayed name of oneItem
    else
    set extension hidden of oneItem to true
    set itemName to displayed name of oneItem
    set extension hidden of oneItem to false
    end if
    set itemExtension to name extension of oneItem
    --set itemBody to name body of oneItem
    --display dialog itemExtension
    set tmpFile to "conversion_output.tmp"
    end tell
    --display dialog destinationFile
    set wasError to false
    try
    --Convert Movie
    set ConvertMovieCmd to "nice /Applications/HandBrakeCLI -i " & sourceFile & " -o " & tmpFile & " -e x264 -b 5000 -2 -T -a 1,1 -E faac,copy:ac3 -B 160,160 -6 dpl2,auto -R Auto,Auto -D 0.0,0.0 -f mp4 -4 -X 960 --strict-anamorphic -m -x cabac=0:ref=2:me=umh:b-pyramid=none:b-adapt=2:weightb=0:trellis=0:weightp=0:vbv -maxrate=9500:vbv-bufsize=9500 ;"
    --display dialog ConvertMovieCmd
    do shell script ConvertMovieCmd
    --short pause before copy
    delay 10
    --Replace Original
    set ReplaceOriginalCmd to "mv -f " & tmpFile & " " & destFold & "'" & itemName & ".m4v" & "'"
    --display dialog ReplaceOriginalCmd
    do shell script ReplaceOriginalCmd
    --Tag file with green label
    on error errmsg
    --should conversion or copy fail display error message and continue with next file
    --display dialog errmsg
    --Tag file with red label
    set wasError to true
    end try
    tell application "Finder"
    if wasError then
    set label index of oneItem to 2
    else
    set label index of oneItem to 6
    end if
    end tell
    end repeat
    on error errmsg
    --should anything go wrong let the user know
    display dialog errmsg
    end try
    end timeout
    end adding folder items to

    If I'm reading your post and script correctly, this is pretty trivial.
    The AppleScript ultimately does its thing by invoking two shell commands - one to convert the file and the second to move the file to its ultimate desintation. Your solution lies in changing that second command.
    Here's the relevant line:
    set ReplaceOriginalCmd to "mv -f " & tmpFile & " " & destFold & "'" & itemName & ".m4v" & "'"
    This command moves tmpFile to destFold which was previously defined as:
    set destFold to "HD(Mini):Users:jaredcraig:Movies:test:"
    Now that won't work (and I'm surprised it doesn't choke on you right now) because you haven't specified a UNIX-style path which uses / to delimit directories. In either case, changing this line to the desired destination directory should solve your problem, e.g.:
    set destFold to quoted form of "/Users/jaredcraig/Movies/iflicks encode/"
    (note you need to use 'quoted form of' since the path includes spaces which will choke most shell commands)

  • Gallery script help, please

    Gallery script help, please
    Hello,
    I'm new to actionscript in general, I do know a little...
    I foung a gallery script, modified many things, the images
    open fine, everything is working, but here's the thing:
    the gallery is in 3 sections, red, blue and yellow.
    I would like to know how, what, and where to put a script so
    that if a "the small red image #1" is clicked, I can load any sort
    of a movie on top of the "the BIG red image #1" or #2 or 3 and so
    on...same goes for the blue and yellow...
    If I figured things correctly on my own...the small thumbnail
    images of the gallery are not buttons, that's why I can't attach a
    movie (let's say) to them...but it is all written in script, using
    the horizontal and vertical position of the mouse to open the large
    images of the gallery...
    So, I don't know how to figure things out, to attach a
    specific movie to a specific thumbnail...
    p.s.: I think the script that controls the gallery is in
    symbol 120
    I really would appreciate the help
    Merry Christmas in advance to everyone
    Sandra
    here are all the files...
    http://www.gentro.ca/sandra_test.zip

    There's a great tutorial on kirupa...
    click
    here for link

  • Modifying standard script

    helo experts i modified standard script medruck into some zscript and i made some changes but its not showing the changes in the print preview why?and whats is the ME9F can any one explain the steps for modifying a standard sap script as per the requirements?or if u show any link it will be helpful...

    Hi,
    You need to go to transaction NACE and replace standard SAPScript with your custom SAPScript.
    Path: NACE -> Select EF (Application) -> Click Output Types button -> Select NEU (if you use standard one) -> Double click on Processing Routine -> Click Change mode ->  Replace Medruck with your custom SAPScript -> Save.
    ME9F is the standard program to create PO message output. In your case, perhaps it can be used to generate and/or print SAPScript.
    Regards,
    Ferry Lianto

  • How to modify the scripts

    hi,
    any body could u help me regarding "how to modify the scripts?
    how to  add disclaimer terms in footer window? that is not connected in stand program?
    give any realtime seniro with screen -shot .
    give one realtime seniro  plz.
    i will be waiting for reply.
    regards,
    eswar.

    Hi,
    go to SE71 T code
    enter the std script, display
    from the second page Copy the script to the ZSCRIPT with EN as lang
    and do the modifications in that Zscript and that has to be attached in the NACE t code for the related Output type and Driver program.
    for example
    for PO MEDRUCK is the std Script Copy it to ZMEDRUCK and do the changes.
    then in NACE select the output type NEU and attache it to SAPFM05P program and remove the MEDRUCK and keep ZMEDRUCK.
    reward if useful
    Regards

  • Modify shell script for alerts...

    Hello,
    had a question with regards to a simple script i wrote...it take care of our every hour archive backup...NOT GOOD IN SHELL SCRIPTING....i get e-mail every single time its backed up.....i want this script to be modified in a way...where i get e-mail notification only and only if the backup fails for whatever reason...here is the script..can someone help me modifying this script....
    export MMSG=/tmp/$$.mail
    export ADDR="[email protected]"
    export ORACLE_SID=test
    export ORACLE_HOME=/u01/oracle/10g
    rm -f $$MMSG > /dev/null 2>&1
    echo "ARCHIVE BACKUP STARTED: "'date'
    echo "ARCHIVE BACKUP STARTED: "'date' > $MMSG
    /u01/oracle/10g/bin/rman target / @/home/oracle/scripts/archive_1.scr >> $MMSG 2>&1
    echo "ARCHIVE BACKUP COMPLETED: "'date'
    echo "ARCHIVE BACKUP COMPLETED: "'date' >> $MMSG
    if [ -f $MMSG ]
    then
    mailx -s "Archive Backup Status" $ADDR < $MMSG
    fi
    rm -f $MMSG > /dev/null 2>&1
    -------------------------------------------------------------------------------------------------------

    Try this:
    export MMSG=/tmp/$$.mail
    export ADDR="[email protected]"
    export ORACLE_SID=test
    export ORACLE_HOME=/u01/oracle/10g
    rm -f $$MMSG > /dev/null 2>&1
    echo "ARCHIVE BACKUP STARTED: "'date'
    echo "ARCHIVE BACKUP STARTED: "'date' > $MMSG
    /u01/oracle/10g/bin/rman target / @/home/oracle/scripts/archive_1.scr >> $MMSG 2>&1
    rc=$?
    if [ $rc -eq 0 ]
    then
      echo "ARCHIVE BACKUP COMPLETED: "'date' 
      echo "ARCHIVE BACKUP COMPLETED: "'date' >> $MMSG
    else
      echo "ARCHIVE BACKUP FAILED: "'date' 
      echo "ARCHIVE BACKUP FAILED: "'date' >> $MMSG
      mailx -s "Archive Backup Status" $ADDR < $MMSG
    fi

  • I cannot install itunes on my windown 7 laptop.  Error says "computer not modified".  Please help me with this problem.

    I cannot install Itunes and Icloud on my Sony Vaio Laptop - Window 7.  Error says " computer/system not modified".  Please help me with this problem. 

    Hello there, jag123059.
    The following Knowledge Base article offers up some great steps to follow for resolving issues with installing iTunes:
    Issues installing iTunes or QuickTime for Windows
    http://support.apple.com/kb/ht1926
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro.

  • Urgent:How to modify a script without changing the print programme

    Hi all,
    Can any body pls tell me <b>How to modify a script without changing the print programme</b>
    Give m esome real time examples.
    Good points willbe rewarded
    Thanks

    Hi
    You can write a external Subroutine to fetch the extra data into the script program
    see the following sample code
    How to call a subroutine form SAPscripts
    The Form :
    /:PERFORM CDE_CENT IN PROGRAM ZKRPMM_PERFORM_Z1MEDRUCK
    /:USING &EKKO-EBELN&
    /:CHANGING &CDECENT&
    /:ENDPERFORM
    The report :
    REPORT zkrpmm_perform_z1medruck .
    DATA : BEGIN OF it_input_table OCCURS 10.
    INCLUDE STRUCTURE itcsy.
    DATA : END OF it_input_table.
    déclaration de la table output_table contenant les
    variables exportées
    DATA : BEGIN OF it_output_table OCCURS 0.
    INCLUDE STRUCTURE itcsy.
    DATA : END OF it_output_table.
    DATA : w_ebeln LIKE ekko-ebeln,
    w_vbeln LIKE vbak-vbeln,
    w_zcdffa LIKE vbak-zcdffa.
    FORM CDE_CENT
    FORM cde_cent TABLES input output.
    it_input_table[] = input[].
    it_output_table[] = output[].
    READ TABLE it_input_table INDEX 1.
    MOVE it_input_table-value TO w_ebeln.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
    input = w_ebeln
    IMPORTING
    output = w_ebeln.
    SELECT SINGLE zcdffa FROM ekko
    INTO w_zcdffa
    WHERE ebeln = w_ebeln.
    it_output_table-name = 'CDECENT'.
    MOVE w_zcdffa TO it_output_table-value.
    MODIFY it_output_table INDEX 1.
    output[] = it_output_table[].
    ENDFORM.
    COPING SCRIPT
    There are some Standard Sap Scripts in SAP. We cant directly execute them in scripts we have to use some T-codes and by giving some input to the required fields we can see the output printform.
    I will show one example. There are some Standard Sap Scripts such as MEDRUCK which is a standard Sap Script for Purchase Order and RVINVOICE01 for billing and so on...
    To see oupt of MEDRUCK go to T-code ME9F give purchase order number and execute select one number and click on dislplay messages button on application tool bar you can find the print form of MEDRUCK.
    You cannot change the Standard Sap Scripts but you can use Standard Sap Scripts and Copy them to userdefined Script and can make changes to them and replace standard Sap Script with usedefind script.
    Ex: Go to SE71,
    on menu bar u find Utilities->copy from Client. click on it u ll find new screen showing
    Form name:
    Source Clinet:
    Target Form:
    give Form name as usedefined form name EX: ZFORM1
    Source client as 000 and
    Target form as MEDRUCK.
    execute.
    Now, the standard from MEDRUCK is copyied to your form ZFORM1.
    NOW, go to SE71 and give form name as ZFORM1 and do some changes to the form such as adding logo any thing. save and Activate.
    Now, you have done changes to the Form ZFORM1 and u have to replace your form with standard SAP Script.
    Go to NACE Transaction.
    on Applications select EF for purchase order and click Output types button on application tool bar.
    now select NEU as output types dobule click on Processing Routines.
    now click on Change option on application tool bar and on right side u find MEDRUCK in form place replace MEDRUCK with ZFORM1 and SAVE.
    go back twice and now go to T-code ME9F give the purchase order number and execute and select one option and click on display messges button .
    you will find the changes that you have done in ZFORM1. so we cant chage the standard Sap Scripts by copying the Standard Sap Scripts we can chage and replace with our forms
    Refer
    https://forums.sdn.sap.com/click.jspa?searchID=4089895&messageID=3239299
    Regards
    Message was edited by:
            Kiran Sure(skk)

  • Script -asjob (modified bgping script)

    Hello,
    I liked very much the original bgping script (http://poshtips.com/bgping-a-high-performance-bulk-ping-utility/)
    I thought, it would be nice to modify the script for query multiple servers (for example, get some information from them, like Serial Number, asap).
    So..
    Ive cut the lines i didnt need (IP address checking, results etc.. ) and left only JOB related lines..
    Param ([int]$BatchSize=3)
    #list of servers
    $source = Get-Content .\servers_FQDN.txt
    #scriptblock
    $blok = {gwmi win32_bios |select serialnumber}
    $elapsedTime = [system.diagnostics.stopwatch]::StartNew()
    $result = @()
    $itemCount = 0
    ## checking running jobs
    if (get-job|? {$_.name -like "Script*"}){
    write-host "ERROR: There are pending background jobs in this session:" -back red -fore white
    get-job |? {$_.name -like "Script*"} | out-host
    write-host "REQUIRED ACTION: Remove the jobs and restart this script" -back black -fore yellow
    $yn = read-host "Automatically remove jobs now?"
    if ($yn -eq "y"){
    get-job|? {$_.name -like "Script*"}|% {remove-job $_}
    write-host "jobs have been removed; please restart the script" -back black -fore green
    exit
    $offset = 0
    ## measure object
    $itemCount = $source.count
    Write-Host "Script will run against $itemcount servers!"
    ## Script start time mark
    write-host " Script started at $(get-date -Format ("yyyy/MM/dd hh:mm:ss")) ".padright(100) -back darkgreen -fore white
    write-host " (contains $itemCount unique entries)" -back black -fore green
    $activeJobCount = 0
    $totalJobCount = 0
    write-host "Submitting background jobs..." -back black -fore yellow
    ## end of clean, verified code
    for ($offset=0; $offset -le $itemCount;$offset += $batchSize){
    $activeJobCount += 1; $totalJobCount += 1; $HostList = @()
    $HostList += $source |select dnshostname |sort |get-unique |select -skip $offset -first $batchsize
    $j = invoke-command -computername $($source) -scriptblock $blok -asjob
    $j.name = "Script`:$totalJobCount`:$($offset+1)`:$($HostList.count)"
    write-host "+" -back black -fore cyan -nonewline
    write-host "`n$totaljobCount jobs submitted, checking for completed jobs..." -back black -fore yellow
    $recCnt = 0
    while (get-job |? {$_.name -like "Script*"}){
    foreach ($j in get-job | ? {$_.name -like "Script*"}){
    $temp = @()
    if ($j.state -eq "completed"){
    $temp = @()
    $temp += receive-job $j
    $result += $temp
    remove-job $j
    $ActiveJobCount -= 1
    write-host "-" -back black -fore cyan -nonewline
    if ($result.count -lt $itemCount){
    sleep 3
    write-host " "
    write-host " Script finished at $(get-date) ".padright(60) -back darkgreen -fore white
    write-host (" Number of hosts : {0}" -f $($result.count)) -back black -fore green
    write-host (" Elapsed Time : {0}" -f $($ElapsedTime.Elapsed.ToString())) -back black -fore green
    write-host "TEMP variable: $temp"
    $result
    write-host " Script completed all requested operations at $(get-date -Format ("yyyy/MM/dd hh:mm:ss")) ".padright(60) -back darkgreen -fore white
    write-host (" Elapsed Time : {0}" -f $($ElapsedTime.Elapsed.ToString())) -back black -fore green
    There is a bug i didnt discovered yet, the $result table containts $temp*number_of_jobs ... why?
    If i run this script against 10servers, divided by 2 (batchsize 2), it would create 5 background jobs. While $temp contains serial number from every single server, $result will multiply it * 5.
    I can use $temp as result as well, but original author used $result for a reason ...
    I  think the problem starts with line
    foreach($jinget-job|?{$_.name
    -like"Script*"}){
    ...  can u correct this script, so i will get results only 1 time?  In case of 10 servers with batchsize of 2, it will create 5jobs containing 2 queries ...
    Elapsed time is now ~24sec, i think it should be done in around 6..

    .. ah.. figured it out..
    wrong:
    $HostList += $source |select dnshostname
    |sort |get-unique
    |select -skip $offset
    -first $batchsize
     $j = invoke-command
    -computername $($source)
    -scriptblock $blok -asjob
    correct:
    $HostList += $source |sort |get-unique |select -skip $i -first $batchsize
    $j = invoke-command -computername $Hostlist -scriptblock $blok -asjob

  • Firefox not responding, freezes, sometimes responds after a few minutes, other times a pop-up appears asking if I want to stop script - help please

    firefox not responding, freezes, sometimes responds after a few minutes, other times a pop-up appears asking if I want to stop script - help please

    Start Firefox in [[Safe Mode]] to check if one of the add-ons is causing the problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    * Don't make any changes on the Safe mode start window.
    See:
    * [[Troubleshooting extensions and themes]]
    * [[Troubleshooting plugins]]
    If it does work in Safe-mode then disable all extensions and then try to find which is causing it by enabling one at a time until the problem reappears.
    * Use "Disable all add-ons" on the [[Safe mode]] start window to disable all extensions.
    * Close and restart Firefox after each change via "File > Exit" (Mac: "Firefox > Quit"; Linux: "File > Quit")

Maybe you are looking for