Powershell Script Dropdown List Passes Argument to Expiration Date

Hello,
I am trying to configure this script so that the user has a choice to make.  If the user chooses "FTE", then the script proceeds to the next function.  If the user chooses "Contractor", he is then taken to the expiration date portion
of the script.  How do I configure this script to flow in that manner?
# Edit This item to change the DropDown Values
[array]$DropDownArray = "FTE", "Contractor"
# This Function Returns the Selected Value and Closes the Form
function Return-DropDown {
$Choice = $DropDown.SelectedItem.ToString()
$Form.Close()
#Write-Host $Choice
 $MyChoice = $Choice
 #Write-Host $MyChoice
 $Script:Choice = $DropDown.SelectedItem.ToString()
 $Form.Close()
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") |Out-Null
[System.Reflection.Assembly]::LoadWithPartialName("System.Drawing") |Out-Null
$Form = New-Object System.Windows.Forms.Form
$Form.width = 300
$Form.height = 150
$Form.Text = ”User Type”
$DropDown = new-object System.Windows.Forms.ComboBox
$DropDown.Location = new-object System.Drawing.Size(100,10)
$DropDown.Size = new-object System.Drawing.Size(130,30)
$DropDown.DropDownStyle = "DropDownList" # This style of combobox will prevent blank
# item selection.
ForEach ($Item in $DropDownArray) {
$DropDown.Items.Add($Item) | Out-Null # Added pipe to out-null to prevent index from
# showing up in the console window.
$DropDown.SelectedIndex = 0 # Select the first item by default
$Form.Controls.Add($DropDown)
$DropDownLabel = new-object System.Windows.Forms.Label
$DropDownLabel.Location = new-object System.Drawing.Size(10,10)
$DropDownLabel.size = new-object System.Drawing.Size(100,20)
$DropDownLabel.Text = "Items"
$Form.Controls.Add($DropDownLabel)
$Button = new-object System.Windows.Forms.Button
$Button.Location = new-object System.Drawing.Size(100,50)
$Button.Size = new-object System.Drawing.Size(100,20)
$Button.Text = "Select an Item"
$Button.Add_Click({Return-DropDown})
$form.Controls.Add($Button)
$Form.Add_Shown({$Form.Activate()})
$Form.ShowDialog() | Out-Null # out-null to prevent "OK" or "Cancel"
# from appearing in the console window
#Set the expiration date
$ans=Read-Host 'What is the expiration date of this account? (mm-dd-yyyy)'
$expDate=[datetime]$ans
HELP Read-Host -Full
##End of Script
Thanks in advance for your help.

Here is an example of one way to do this in a form:
[void][reflection.assembly]::Load("System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
[void][reflection.assembly]::Load("System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
[System.Windows.Forms.Application]::EnableVisualStyles()
$form1 = New-Object 'System.Windows.Forms.Form'
$datetimepicker1 = New-Object 'System.Windows.Forms.DateTimePicker'
$radiobuttonFTE = New-Object 'System.Windows.Forms.RadioButton'
$radiobuttonContractor = New-Object 'System.Windows.Forms.RadioButton'
$buttonOK = New-Object 'System.Windows.Forms.Button'
$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
$radiobuttonContractor_CheckedChanged={
if($radiobuttonContractor.Checked){
$datetimepicker1.Visible=$true
}else{
$datetimepicker1.Visible=$false
$Form_StateCorrection_Load=
#Correct the initial state of the form to prevent the .Net maximized form issue
$form1.WindowState = $InitialFormWindowState
$Form_Cleanup_FormClosed=
#Remove all event handlers from the controls
try
$radiobuttonContractor.remove_CheckedChanged($radiobuttonContractor_CheckedChanged)
$form1.remove_Load($FormEvent_Load)
$form1.remove_Load($Form_StateCorrection_Load)
$form1.remove_FormClosed($Form_Cleanup_FormClosed)
catch [Exception]
$form1.Controls.Add($datetimepicker1)
$form1.Controls.Add($radiobuttonFTE)
$form1.Controls.Add($radiobuttonContractor)
$form1.Controls.Add($buttonOK)
$form1.AcceptButton = $buttonOK
$form1.ClientSize = '508, 262'
$form1.FormBorderStyle = 'FixedDialog'
$form1.MaximizeBox = $False
$form1.MinimizeBox = $False
$form1.Name = "form1"
$form1.StartPosition = 'CenterScreen'
$form1.Text = "Form"
$form1.add_Load($FormEvent_Load)
# datetimepicker1
$datetimepicker1.Location = '160, 91'
$datetimepicker1.Name = "datetimepicker1"
$datetimepicker1.Size = '200, 20'
$datetimepicker1.TabIndex = 3
$datetimepicker1.Visible = $False
# radiobuttonFTE
$radiobuttonFTE.Location = '33, 57'
$radiobuttonFTE.Name = "radiobuttonFTE"
$radiobuttonFTE.Size = '104, 24'
$radiobuttonFTE.TabIndex = 2
$radiobuttonFTE.TabStop = $True
$radiobuttonFTE.Text = "FTE"
$radiobuttonFTE.UseVisualStyleBackColor = $True
# radiobuttonContractor
$radiobuttonContractor.Location = '33, 87'
$radiobuttonContractor.Name = "radiobuttonContractor"
$radiobuttonContractor.Size = '104, 24'
$radiobuttonContractor.TabIndex = 1
$radiobuttonContractor.TabStop = $True
$radiobuttonContractor.Text = "Contractor"
$radiobuttonContractor.UseVisualStyleBackColor = $True
$radiobuttonContractor.add_CheckedChanged($radiobuttonContractor_CheckedChanged)
# buttonOK
$buttonOK.Anchor = 'Bottom, Right'
$buttonOK.DialogResult = 'OK'
$buttonOK.Location = '421, 227'
$buttonOK.Name = "buttonOK"
$buttonOK.Size = '75, 23'
$buttonOK.TabIndex = 0
$buttonOK.Text = "OK"
$buttonOK.UseVisualStyleBackColor = $True
#endregion Generated Form Code
#Save the initial state of the form
$InitialFormWindowState = $form1.WindowState
#Init the OnLoad event to correct the initial state of the form
$form1.add_Load($Form_StateCorrection_Load)
#Clean up the control events
$form1.add_FormClosed($Form_Cleanup_FormClosed)
#Show the Form
$form1.ShowDialog()
¯\_(ツ)_/¯

Similar Messages

  • PowerShell script to list ALL documents bigger than 10MB - in list attachments/libraries all over my site?

    Hi there,
    Just wondering if someone can give me the PowerShell script to list ALL documents bigger than 10MB - in list attachments/libraries all over my site?
    Really appreciated.
    Thank you.

    Hello,
    here you can find sample to help you create yoru script :
    http://sharepointpromag.com/sharepoint/windows-powershell-scripts-sharepoint-info-files-pagesweb-parts
    see this sample extract from this site
    Get-SPWeb http://sharepoint/sites/training |
                                     Select -ExpandProperty Lists |
                                     Where { $_.GetType().Name -eq "SPDocumentLibrary" -and
                                             -not $_.Hidden }
    |
                                     Select -ExpandProperty Items |
                                     Where { $_.File.Length -gt 5000 } |
                                     Select Name, {$_.File.Length},
                                            @{Name="URL";
                                            Expression={$_.ParentList.ParentWeb.Url
    + "/" + $_.Url}}
    this can help too :
    https://gallery.technet.microsoft.com/office/Get-detail-report-of-all-b29ea8e2
    Best regards, Christopher.
    Blog |
    Mail
    Please remember to click "Mark As Answer" if a post solves your problem or
    "Vote As Helpful" if it was useful.
    Why mark as answer?

  • Powershell Script to list pdf files in a directory

    Hey Scripting guy, I read few of your forum solutions for the scripts and was really enthralled to embrace this powershell scripting, thanks for the motivation.
    I am still a learner and want to learn more, I had to do a script on generating an excel report which consisted of number of files of files in PDF format for each directory and sub-directory in the path.
    I used the,
    get-childitem $Path -recurse | where {$_.Extension -match "pdf"}
    command, all I wanted to know is how to count the number of PDF files in each sub directory, please help me out,
    Thanks in advance

    Ok, let's have some fun :)
    function Count-FilesRecursive{
    Param(
    [parameter(Mandatory = $true, Position = 0)]
    [string]$Path,
    [parameter(Mandatory = $true, Position = 1)]
    [string]$Filter
    $SB_recursive = {
    [System.IO.Directory]::GetDirectories($args[0])|ForEach-Object {
    Try{
    $i = ([System.IO.Directory]::GetFiles($_,$Filter)).Count
    Catch [UnauthorizedAccessException] {
    $i = 0
    "{0,-10} {1}" -f $i, $_
    Try{
    $SB_recursive.Invoke($_)
    Catch [UnauthorizedAccessException] {}
    "{0,-10} {1}" -f "Number of files", "Path"
    "{0,-10} {1}" -f "---------------", "----"
    $SB_recursive.Invoke($Path)
    Count-FilesRecursive -Path C:\users -Filter '*.pdf'

  • Powershell script with list view

    Hi,
    I have a scheduled job in SharePoint 2013 environment, where I export SharePoint list Items as csv. I would like to use a SharePoint list View so that I get all the items from the view into csv. I tried below
    script and it only returns items that are in the first paginated view. The view has an item limit of 50 items. But I wan't to return all the items in the view. 
    Please help me modify the script accordingly. Thank you.
    #Retrieving the Web Site with List
    $MyWeb = Get-SPWeb "http://mysite/sites/testsite"
    #Get the List name
    $MyList = $MyWeb.Lists["Programs"]
    #Get The View
    #Change the name of the view
    $MyView = $MyList.Views["My View"]
    #Get the Items from the view
    $MyItems = $MyList.GetItems($MyView)
    #Get Specific field items and export it to a csv file
    $MyItems | %{ select-object -input $_ -prop @{Name='ID';expression={$_.ID;}}, 
    @{Name='Content Type';expression={$_["P. Type"];}}, 
    @{Name='Program Name';expression={$_["Program Name"];}},
    @{Name='Classifications';expression={($_["Classifications"]).substring(($_
    ["Classifications"]).IndexOf("#")+1);}},
    @{Name='Classifications ID';expression={($_["Classifications"]).split(";")[0];}},
    @{Name='VP';expression={($_["VP Owner"]).substring(($_["VP Owner"]).IndexOf("#")+1);}},
    @{Name='VP ID';expression={($_["VP Owner"]).split(";")[0];}},
    @{Name='Project Manager';expression={$_["Project Manager"];}},
    @{Name='GL Project Code';expression={$_["GL Project Code"];}}, 
    @{Name='Segment BU';expression={($_["Segment BU"]).substring(($_["Segment BU"]).IndexOf
    ("#")+1);}}, 
    @{Name='Segment BU ID';expression={($_["Segment BU"]).split(";")[0];}},
    @{Name='C-Product Line';expression={$_["C-Product Line"];}}, 
    @{Name='Node and Foundry';expression={($_["Node and Foundry"]).substring(($_["Node and 
    Foundry"]).IndexOf("#")+1);}},
    @{Name='Node and Foundry ID';expression={($_["Node and Foundry"]).split(";")[0];}},
    @{Name='Phase';expression={$_["Phase"];}}, 
    @{Name='Program Activity';expression={$_["Program Activity"];}}, 
    @{Name='Archive';expression={$_["Archive"];}}; } | Export-Csv -Path "c:\Dashboard.csv"
    techie

    Hi CoolTechie,
    Rather than writing a batch job to populate excel timely fashion, I will suggest to make a excel data source auto-refresh after every minute, which is more real time. That excel can be shared as well.
    You can use the Excel as external data source, you
    can set refresh the excel per 1 minute.
    The steps of configuration, you can refer to the following
    link.
    http://sharepointlink.blogspot.com/2010/08/sharepoint-2010-excel-services-and.html
    Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply.

  • PowerShell Script to Delete Files Based on Current Date

    I know by using Get-Date PowerShell will look at the current date.  I would like to make a very basic PS Script which will delete a file older than 8 days based on the current day.  I believe using a if/then function will be necessary. 
    I am very new to scripting so Im not sure how the syntax is written.  All help appreciated.

    Yes, use -Recurse to get subfolders too:
    $Folder = "C:\Users\Me\Backups"
    Get-ChildItem -Path $Folder -Recurse |
    Where { $_.LastWriteTime -lt [DateTime]::Today.AddDays(-8) } |
    Sort LastWriteTime |
    Remove-Item $_ -Force -Confirm:$false
    Sam Boutros, Senior Consultant, Software Logic, KOP, PA http://superwidgets.wordpress.com (Please take a moment to Vote as Helpful and/or Mark as Answer, where applicable) _________________________________________________________________________________
    Powershell: Learn it before it's an emergency http://technet.microsoft.com/en-us/scriptcenter/powershell.aspx http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx

  • Powershell Script for Exchange- Storagelimitstatus wont return any data.

    I am trying to run the following script using PowerGUI and its working but one piece. The storagelimitstatus isn't returning any data. Any impute would great.
    Here is what I wrote. 
    If (-not (Get-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 -ErrorAction SilentlyContinue))
    {   Try { Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 -ErrorAction Stop }
        Catch { Write-Host "Unable to load Exchange tools because ""$($Error[0])""" -ForegroundColor Red ; Exit }
    Get-Mailbox -ResultSize Unlimited | Select-Object DisplayName,IssueWarningQuota, storagelimitstatus,ProhibitSendQuota,ProhibitSendReceiveQuota,@{label="TotalItemSize(MB)";expression={(Get-MailboxStatistics $_).TotalItemSize.Value.ToMB()}}, @{label="ItemCount";expression={(Get-MailboxStatistics
    $_).ItemCount}}, Database| Export-Csv "\\pc1417\c$\Scripts\UserMailboxSizes.csv" -NoTypeInformatio

    StorageLimitStatus is a property extracted by Get-MailboxStatistics and not Get-Mailbox.Try below and check if that works!
    Get-Mailbox -ResultSize Unlimited | Select-Object DisplayName,IssueWarningQuota,@{label="StorageLimitStatus";expression={(Get-MailboxStatistics $_).StorageLimitStatus}},ProhibitSendQuota,ProhibitSendReceiveQuota,@{label="TotalItemSize(MB)";expression={(Get-MailboxStatistics $_).TotalItemSize.Value.ToMB()}}, @{label="ItemCount";expression={(Get-MailboxStatistics $_).ItemCount}}, Database| Export-Csv "\\pc1417\c$\Scripts\UserMailboxSizes.csv" -NoTypeInformation
    Pavan Maganti ~ ( Exchange | 2003/2007/2010/E15(2013)) ~~ Please remember to click “Vote As Helpful" if it really helps and "Mark as Answer” if it answers your question, “Unmark as Answer” if a marked post does not actually answer your
    question. ~~ This Information is provided is "AS IS" and confers NO Rights!!

  • Run PowerShell script from C# writing to input pipe

    Hello,
    I am trying to run a PowerShell script from C# (I have no control over what's in the script). The script may have a prompt like "Press enter to continue". So my goal is:
    1. Get text output from the script (easy, many examples available)
    3. If output contains "Press enter to continue", write a blank line to the running script's pipe to make it finish its job and quit
    4. If output does contain that prompt, just let it exit by itself without sending any input
    Note that commands in this PS script also try to get at script's file path, so I can't read script from file and pass it as text. It has to be executed as a script so it knows where it's located.
    I have done this with .exes and batch files before. All you do in that case is process.StandardInput.WriteLine() which "types" enter into the input stream of script you are trying to control. But this does not work with Power Shell. How do I do this?
    I have tried using PS object model like so:
    using (Pipeline pipeline = runspace.CreatePipeline())
    Command command = new Command(scriptPS, true, true);
       pipeline.Commands.Add(command);
       pipeline.Commands[0].MergeMyResults(PipelineResultTypes.Error, PipelineResultTypes.Output);
       pipeline.Input.Write("\n");
       Collection<PSObject> psresults = pipeline.Invoke();   //...
    But I get an error because the script prompts:
    "A command that prompts the user failed because the host program or the command type does not support user interaction. Try a host program that supports user interaction, such as the Windows PowerShell Console or Windows PowerShell ISE, and remove prompt-related
    commands from command types that do not support user interaction, such as Windows PowerShell workflows."
    I also tried using Process, and running PowerShell with -File switch to execute the script, then write to StandardInput with C#. I get no errors then, but the input is ignored and doesn't make it to PowerShell.
    Please help!

    No man, what kind of answer is that? You should have left it unanswered rather than waste people's time like this. I already seen those links before I posted my question. They address the issue of specifying script parameters, but not
    writing to the input pipe.
    Fortunately I did figure this out by writing a custom script host for PowerShell. Anyone interested can read about this in detail on MSDN (fortunately simple material with samples you can copy paste as I did, so this solution takes little time to implement).
    Implement PSHost interface. Nothing special here, just paste directly from MSDN sample and modify their SetShouldExit function definition to contain just a "return;". Here's the relevant link:
    http://msdn.microsoft.com/en-us/library/windows/desktop/ee706559(v=vs.85).aspx
    Implement PSHostUserInterface interface. This is the ticket to solving this problem
    (see below). Here's the MSDN link:
    http://msdn.microsoft.com/en-us/library/windows/desktop/ee706584(v=vs.85).aspx
    Implement PSHostRawUserInterface. This may not be required (not sure) but I did anyway. Nearly a direct paste from MSDN:
    http://msdn.microsoft.com/en-us/library/windows/desktop/ee706601(v=vs.85).aspx
    So, there are two PSHostUserInterface function implementations that are of particular interest. First is Prompt (read header comment to see why):
    /// <summary>
    /// When script attempts to get user input, we override it and give it input programmatically,
    /// by looking up within promptInput's dictionary<string,string> or lineInput array.
    /// PromptInput dictionary is mapped by input prompt (for example, return "" in response to "Press ENTER to continue")
    /// LineInput is a regular array, and each time the script wants to prompt for input we return the next line in that array;
    /// this works much like piping inputs from a regular text file in DOS command line.
    /// </summary>
    /// <param name="caption">The caption or title of the prompt.</param>
    /// <param name="message">The text of the prompt.</param>
    /// <param name="descriptions">A collection of FieldDescription objects that
    /// describe each field of the prompt.</param>
    /// <returns>Throws a NotImplementedException exception.</returns>
    public override Dictionary<string, PSObject> Prompt(string caption, string message, System.Collections.ObjectModel.Collection<FieldDescription> descriptions)
    Dictionary<string, PSObject> ret = new Dictionary<string, PSObject>();
    foreach (FieldDescription desc in descriptions)
    if (this.promptInput.Count != 0)
    ret[desc.Name] = new PSObject(this.promptInput[desc.Name] + "\r\n");
    else if (this.lineInput != null && this.currentLineInput >= 0 && this.currentLineInput < this.lineInput.Length)
    ret[desc.Name] = new PSObject(this.lineInput[this.currentLineInput++] + "\r\n");
    else
    if (desc.DefaultValue == null)
    ret[desc.Name] = new PSObject("\r\n");
    else
    ret[desc.Name] = new PSObject(desc.DefaultValue);
    return ret;
    Next is PromptForChoice. Here I opted to always return the default choice, but you could rewrite it to read from somewhere to "simulate" reading from input pipe just like the function above:
    public override int PromptForChoice(string caption, string message, System.Collections.ObjectModel.Collection<ChoiceDescription> choices, int defaultChoice)
            return defaultChoice;
    Last but not least, here's a ReadLine implementation (again read header comment):
    /// <summary>
    /// If the LineInput is set, "read" the next line from line input string array, incrementing line pointer/// </summary>
    /// <returns>The characters that are entered by the user.</returns>
    public override string ReadLine()
    if (this.lineInput != null && this.currentLineInput >= 0 && this.currentLineInput < this.lineInput.Length)
    return this.lineInput[this.currentLineInput++];
    else
    return Console.ReadLine();
    Both are exposed as properties:
    /// <summary>
    /// Gets or sets the input pipe override
    /// </summary>
    public string Input
    get
    return string.Join("\n", this.lineInput);
    set
    if (value != null)
    this.lineInput = value.Split('\n');
    this.currentLineInput = 0;
    else
    this.lineInput = null;
    /// <summary>
    /// Gets or sets input pipe override for named prompts
    /// </summary>
    public Dictionary<string, string> PromptInput
    get
    return this.promptInput;
    set
    this.promptInput = value;
    And finally, here's how the whole shebang is used:
    /// <summary>
    /// Runs a powershell script, with input pipe arguments
    /// </summary>
    /// <param name="script">Path of the script to execute, or script text</param>
    /// <param name="inline">Whether or not to execute script text directly, or execute script from path</param>
    /// <param name="unrestricted">Whether or not to set unrestricted execution policy</param>
    /// <param name="parameters">Parameters to pass to the script command line</param>
    /// <param name="inputOverride">Input to pass into the script's input pipe</param>
    /// <param name="inputOverrideName">Input to pass into the script's input pipe, to each prompt by label</param>
    /// <returns>Output lines</returns>
    public static string PowerShell(string script, bool inline, bool unrestricted = false, Dictionary<string, string> parameters = null, string inputOverride = null, Dictionary<string, string> inputOverrideByName = null)
    string output = null;
    ScriptHost host = new ScriptHost();
    (host.UI as ScriptHostUserInterface).Input = inputOverride;
    (host.UI as ScriptHostUserInterface).PromptInput = inputOverrideByName;
    using (Runspace runspace = RunspaceFactory.CreateRunspace(host))
    runspace.Open();
    if (unrestricted)
    RunspaceInvoke runSpaceInvoker = new RunspaceInvoke(runspace);
    runSpaceInvoker.Invoke("Set-ExecutionPolicy Unrestricted");
    using (Pipeline pipeline = runspace.CreatePipeline())
    if (inline)
    pipeline.Commands.AddScript(script);
    else
    Command command = new Command(script, true, true);
    foreach (KeyValuePair<string, string> param in parameters)
    command.Parameters.Add(param.Key, param.Value);
    pipeline.Commands.Add(command);
    pipeline.Commands.Add("Out-String");
    pipeline.Commands[0].MergeMyResults(PipelineResultTypes.Error, PipelineResultTypes.Output);
    Collection<PSObject> psresults = pipeline.Invoke();
    var sb = new StringBuilder();
    foreach (PSObject obj in psresults)
    sb.AppendLine(obj.ToString());
    output = sb.ToString();
    pipeline.Dispose();
    runspace.Close();
    return (host.UI as ScriptHostUserInterface).Output + "\r\n" + output;
    As you can see, I also did some magic with the .Output property. That just accumulates lines of text output by the script in every WriteXXX function implemented in your custom PSHostUserInterface. The end result of all this, is that if you have a script
    that has prompts, choices or reads from standard input, you can execute the script within the context of your custom script host written as above, to control precisely what strings are passed to it in response to prompts.
     

  • Populating dropdown list from an XML file

    Hi!
    I want to prepopulate a dropdown list in a form from an XML file.
    Typically something like:
      A
      B
      C
    Is this the correct way to specify the list's values in XML?
    How do I specify the binding property of my dropdown list, to put the values A, B and C into the dropdown list?
    I am using Designer 7.0!
    Thanks!

    [email protected] wrote:
    > Hi!
    >
    > I want to prepopulate a dropdown list in a form from an XML file.
    > Typically something like:
    >
    >
    >   A
    >   B
    >   C
    >
    >
    >
    > Is this the correct way to specify the list's values in XML?
    > How do I specify the binding property of my dropdown list, to put the values A, B and C into the dropdown list?
    >
    > I am using Designer 7.0!
    >
    > Thanks!
    Liana,
       You can't do this with Designer 7.0.  If you upgrade to Designer 7.1,
    you can bind dropdown list values to your xml data using the dynamic
    property binding capabilities.
    Hope this helps!
       Justin

  • Dropdown List Not Refresh with Static PDF

    Hi,
    I'm using LiveCycle ES2 version 9 to design my form and view using Acrobat X Pro. In my form, I have a dropdown list that binds to a data connection to populate the list of products available. The SQL query of the data connection is as simple as below,
         "SELECT ProductCode, ProductName FROM PUB_Product WHERE ActiveInd = yes"
    Everything works perfectly when I save my PDF in dynamic form. However, due to some limitation with dynamic form, I have no choice but to save the PDF in static form. Problem with static form arises when there are changes to PUB_Product table which could be adding/removing product, setting an active product to non-active and etc. In case of any changes, I have to re-open the PDF in LiveCycle and save it in order to have the latest data reflected in the form. Is there anything I can do so that the changes to the product table will straight away reflected in the form without having to re-save it?
    Thanks in advance for your advise.
    Regards,
    Steven

    Hi Paul,
    Thanks for helping. I'm using Acrobat to view the PDF form. Thus, shouldn't have any problem connecting to the database.
    I've captured some screenshots as below and hope it helps you understand my situation better.
    This is my Access database
    This is my PDF. Added a data connection "Product" using SQL Query "SELECT ProductCode, ProductName FROM PUB_Product WHERE ActiveInd=yes" whereby it will only extract the "active" products.
    Binded the product code dropdown list with "Product" data connection to populate the list.
    The output of the PDF form. Only the active products are being listed.
    Now, if let's say I add a new product to my PUB_Product table, the dynamic form will straight away list the new product but not the static form.
    Dynamic form
    Static form
    In order to see the new product listed in the static form dropdown list, I have to re-open the form in Live Cycle and just simply save it. So my question is, is there anything I can do to skip this "open and save" step?
    Thanks.
    Regards,
    Steven

  • Dropdown List (LOV) Help

    I have a request to put a seperate line within the dropdown list to seperate different category data. Is this possible ? Can someone give advise on how to implement it?

    I have a request to put a seperate line within the dropdown list to seperate different category data.Your requirement is not clear. Are you talking about seperating data in your LOV by category? For example, say you have an LOV that displays a listing of CARs available for sale:
    MAKE        MODEL       COLOR
    Ford        Focus       Blue
    Ford        Focus       Green
    Chevy       Volt        Red
    Chevy       Volt        Blue
    Dodge       300         Black
    Dodge       300         Blue
    BMW         M3          White
    Mercedes    450SL       Blackand you want:
    MAKE        MODEL       COLOR
    Ford        Focus       Blue
    Ford        Focus       Green
    Chevy       Volt        Red
    Chevy       Volt        Blue
    Dodge       300         Black
    Dodge       300         Blue
    BMW         M3          White
    Mercedes    450SL       Black
    ______________________________If this is what you want - no you can't do this with a standard Oracle Forms LOV. You could try modifying your query in SQL Developer to add the lines to the output and try this query as the Record Group source of your LOV, but there are no guaruntees this will work.
    Please describe your requirement better!
    Craig...

  • Get back dropdown list data.

    Hi all,
    I am adding a new customer screen into transaction code ME21N. I managed to see the new tab Customer Data created, I have also created a dropdown list in the screen with data for example, Text 1, Text 2, Text 3.
    My problem now is whenever I selected the dropdown list to Text2, I go tab Delivery/Invoice, and come back to tab Customer Data, the dropdown list data is blank. How could I set the dropdown list data and display the selected data whenever I come back to Customer Data?
    Your answer is very much appreciated.
    Thanks in advance.

    Hi ,
    Define separate module for Drop down assignment. Using Fn Module VRM_SET_VALUES assign the values u want to do.
    code{
    MODULE list_def_code OUTPUT.
      CLEAR: value,list , name ,  wa_defect.
      REFRESH: list , it_sale , it_defect.
      SELECT * FROM zcrm_defect INTO TABLE it_defect WHERE division = division.
      LOOP AT it_defect INTO wa_defect.
        value-key = wa_defect-def_code.
        value-text = wa_defect-def_text.
        APPEND value TO list.
        CLEAR value.
      ENDLOOP.
      SORT LIST BY TEXT.
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING
          id              = 'DEFECT'
          values          = list[]
        EXCEPTIONS
          id_illegal_name = 1
          OTHERS          = 2.
    } Try this

  • Powershell script calling batch file, how to "echo" or otherwise pass in two or more values asked for by batch file

    I've been having a lot of problems trying to get an old batch file we have laying around, to run from my powershell script. The batch file actually asks for two inputs from the user. I've managed to put together a powershell that echos a response, but of
    course, that only will answer one of the prompts. As usual, I've simplified things here to get my testing done. The batch file looks like this:
    @ECHO OFF
    SET /P CUSTID=Customer Number:
    SET /P DBCOUNT=Number of Live Databases:
    ECHO Customer Id was set to : %CUSTID%
    ECHO Database Count was set to : %DBCOUNT%
    Two inputs, two echos to verify values have been set. Now, the powershell looks like this:
    Param(
     [string]$ClientADG,
        [string]$ClientDBCount,
        [scriptblock]$Command
    $ClientADG = '1013'
    $ClientDBCount = '2'
    $Response = $ClientADG + "`r`n" + $ClientDBCount
    $Command = 'Invoke-Command -ComputerName localhost -ScriptBlock {cmd /c "echo ' + $ClientADG + ' | E:\Scripts\Setup\Company\DatabaseSetupTest.bat"}'
    powershell -command $Command
    Output looks like:
    Customer Number: Number of Live Databases: Customer Id was set to : 1013
    Database Count was set to :
    As expected, as I'm only passing in one value. I can't figure out how to get a second value passed in for the second prompt. Instead of $ClientADG, I tried to mash the two value together in the $Response variable with a cr/lf or a cr or a lf in between,
    but no go there either. The first input gets set to the second value, and second input is blank still. In the essence of time, I need to get this batch file called from Powershell to get some folks productive while I actually rewrite what the batch file does
    in another powershell, so it can be integrated into other things. (I'm automating what a bunch of people spend hours doing into multiple scripts and eventually one BIG script so they can focus on doing their real jobs instead).
    How do I get this right in powershell? I don't want to modify the batch file at all at this point, just get it running from the powershell.
    Thanks in advance!
    mpleaf

    It's a "simple" test so I can figure out how to get the arguments passed from ps to bat. The bat file looks like this:
    @ECHO OFF
    SET CUSTID = %1
    SET DBCOUNT = %2
    ECHO Customer Id was set to : %CUSTID%
    ECHO Database Count was set to : %DBCOUNT%
    That's it. The PS script looks like this:
    Invoke-Command-ComputerName myserver-ScriptBlock{cmd/c"E:\Scripts\Setup\Company\DatabaseSetupTest.bat
    1013 2"}
    That's it. The bat file exists on "myserver", and I'm getting the echo back, but without the values.
    mpleaf

  • Pass Arguments to EXE with Powershell

    I haven't done much with this cmdlet, but Start-Process seems like it should be able to do what you want with it's -ArgumentList parameter. So something like this may work:
    PowershellGet-Content C:\File.txt | foreach { Start-Process myexe.exe -ArgumentList $_ }Using you example of myexe.exe -hostname testserver, each line of the text file would look something like this.
    Text-hostname testserver

    So I have an EXE that needs some arguments an examble is myexe.exe - hostname testserver.
    I want to have a powershell script that can look at a text file and pass the results as parameters to the exe.  
    So the text document would look like this :
    Hostname = Server 12
    So I'm hoping the - hostname argument it can be passed to the exe with a result of server 12.  
    In the end I want to have something a end user can fill out and have the results used as parameters for some exe files.  
    Thanks! 
    This topic first appeared in the Spiceworks Community

  • Powershell script to count number of list and library items in site collection

    We are identifying large lists in our 2010 SP environment and I'm attempting to write code to output the total number of list items in a site collection.   I'm using the code below but it only displays column data for title and url. 
    What do I need to add so it can count the number of items in each sharepoint list and library? 
    Get-SPSite -WebApplication http://sharepoint -Limit All |
       Select -ExpandProperty AllWebs |
       Select -ExpandProperty Lists |
       Select ParentWebUrl, Title
    I'm referencing
    http://sharepointpromag.com/sharepoint/windows-powershell-scripts-sharepoint-info-files-pagesweb-parts

    Please find belwo script, it will iterarte through all the folder/Subfoder to get the item counts from all list and library, you can modify this script to run this at site collection scope:
    Note: save the script in .ps1 file and execute the script as described below to get log file, it will save the log file out.txt in seleted directory:
    e.g.PS D:\PowershellScripts> .\ListItemCount.ps1 > out.txt
    $SPWebApp = Get-SPWebApplication "http://weburl.com/"
    foreach ($SPSite in $SPWebApp.Sites)
    if ($SPSite -ne $null)
    foreach ($SPWeb in $SPSite.AllWebs)
    foreach ($list in $SPWeb.Lists)
    $ListURL = $SPWeb.url + "/" + $list.RootFolder.Url
    Write-Output $ListURL
    [Microsoft.SharePoint.SPQuery]$query = New-Object Microsoft.SharePoint.SPQuery
    #$query.Folder = fldr;
    #Recursive Scope....
    $query.ViewAttributes = "Scope='Recursive'"
    $allitems = $list.GetItems($query);
    $filecount = $allitems.Count;
    Write-Output " No of item: " $filecount
    if ($SPWeb -ne $null)
    $SPWeb.Dispose()
    if ($SPSite -ne $null)
    $SPSite.Dispose()
    You can update the code to get any specific list type item count, using if($list.BaseType -eq "DocumentLibrary") condition:
    if($list.BaseType -eq "DocumentLibrary")
    $ListURL = $SPWeb.url + "/" + $list.RootFolder.Url
    Write-Output $ListURL
    [Microsoft.SharePoint.SPQuery]$query = New-Object Microsoft.SharePoint.SPQuery
    #$query.Folder = fldr;
    #Recursive Scope....
    $query.ViewAttributes = "Scope='Recursive'"
    $allitems = $list.GetItems($query);
    $filecount = $allitems.Count;
    Write-Output " No of item: " $filecount
    if ($SPWeb -ne $null)
    $SPWeb.Dispose()
    If my contribution helps you, please click Mark As Answer on that post and Vote as Helpful
    Thanks, ShankarSingh

  • PowerShell script to find a string of characters in office documents in Doc Libraries and List Item attachments?

    Hi there,
    For SharePoint 2010 site - Does someone have the PowerShell script to find a string of characters in Office/Word/Excel/PDF documents in document libraries or the ones attached to List Items?
    Thanks so much in advance.

    Hi,
    According to your description, my understanding is that you want to find some specific string character in list items using PowerShell Command.
    $w = Get-SPWeb "http://devmy131"
    $l = $w.GetList("http://devmy131/lists/fieldslist");
    $i = $l.Items[0]["Title"].ToString();
    if ($i -like '*document*')
    Write-Host "Title contains document character" $i;
    More information:
    PowerShell -contains -like
    Thanks
    Best Regards
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

Maybe you are looking for

  • Can't zoom in or out in iphone 5, can't zoom in or out in iphone 5

    Dear all, Now i faced on poblem is i can't zoom in or out in iphone5 by two fingers thanks Son

  • Java.lang.NullpointerException with update manager

    Install Solaris 10 11/06 and after doing updates and rebooting, unable to complete the check for updates. I get "java.lang.NullpointerException update manager" while anayzing the system. Can somebody help me here?

  • Lock input-fields on digitally signing the form

    Hi,     Is it possible to lock the input-fields once the form has been signed? Also I want to pass the digital Certificate along with the pdf. How do I do it? Please help me.  Thanks, Prasanna

  • Length of service calculation in payroll schema rules

    SAP allows you a few options with regard to length of service in months. F01KJ looks at date type 01 in infotype 0041.  It calculates months service based on complete months.  If you use option "N" as opposed to "K", then it counts complete and parti

  • How to read attachment data in mapping

    Hi, In my scenario I receive an XML file with another file as attachment. I need to map both the content of the XML file and the attachment to the target which will be sent as an attachment in a mail. I have used JavaMapping and I'm now able to send