How to use a BrowseForFolder box in my powershell script?

Hello,
I have the following script where I want to ask the user to select the folder they want the script to process the instructions from.  I've added a function for Select-Folder as follows:
function Select-Folder($message='Select a folder', $path = 0) {
$object = New-Object -comObject Shell.Application
$folder = $object.BrowseForFolder(0, $message, 0, $path)
if ($folder -ne $null) {
$folder.self.Path
Select-Folder 'Select the folder where the move scripts reside'
$files=Get-ChildItem $folder -Filter "*.txt"
foreach ($file in $files){
$outFileName=[IO.Path]::GetFileNameWithoutExtension($file.Name) + "_StartVMs.txt"
Get-Content $file.FullName | foreach{
Add-Content $folder\$outFileName "Start-ClusterResource ""$($_.Split('"')[1])"""
Issue #1:
The .txt files I am creating live in the same location as where this script lives. What I've found is the path I choose in the browseforfolder box that pops up is ignored and the files are converted in the location where the script lives.
Issue #2:
How do I get the Cancel button to work so the script will exit if the user selects Cancel?
Any help you can provide would be greatly appreciated.
Thank you.

Hi,
You're not setting a variable with the output of your function, so you don't have anything to test on. Give this slight modification a try (you'll need to work this back into your script, this is demo stuff only):
function Select-Folder($message='Select a folder', $path = 0) {
$object = New-Object -comObject Shell.Application
$folder = $object.BrowseForFolder(0, $message, 0, $path)
if ($folder -ne $null) {
$folder.self.Path
$folderPath = Select-Folder 'Select the folder where the move scripts reside'
Write-host "The selected folder path is $folderPath"
If ($folderPath) { Write-Host 'I have a folder, so keep processing in here' }
Else { Write-Host 'I do not have a folder path' }
Don't retire TechNet! -
(Don't give up yet - 12,420+ strong and growing)

Similar Messages

  • How to use the Combo Box In MAtrix Colums

    HI Experts,
    Good Mornong.How to use the Combo Box In MAtrix Colums?
    Regards And Thanks,
    M.Thippa Reddy

    hi,
    loading data in to the combobox on form load.but, it should be done when atleast one row is active.
    the values what ever you are inserting in to combo should  be less than or eqhal to 100 or 150.if it exceeds beyond that performance issue arises.it takes more time to load all the data.so, it is better to have 100 or less.
    oMatrix.AddRow()
    RS = Nothing
    RS = ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
    RS.DoQuery("select ItemCode,ItemName from oitm")
    oCombo = oMatrix.Columns.Item("ColumnUID").Cells.Item(oMatrix.RowCount).Specific
    For i = 1 To RS.RecordCount
          If RS.EoF = False Then
                oCombo.ValidValues.Add(RS.Fields.Item("ItemCode").Value,RS.Fields.Item("ItemName").Value)
                RS.MoveNext()
          End If
    Next
    the above code is inserting data from database to column combobox.
    you can fill combo directly also as shown below.
    oCombo.ValidValues.Add("x","1")
    oCombo.ValidValues.Add("y","2")
    oCombo.ValidValues.Add("z","3")
    oCombo.ValidValues.Add("","")
    and what ever the values you are filling into combo should be unique.other wise it shows valid value exists.
    regards,
    varma

  • How to use dynamic list box in survey builder?

    Hello,
    Could someone give me a little bit of thread? How to use dynamic list box in survey builder?

    Hi Liu,
    Dynamic combo boxes::A combo box is dynamic if it references a document property for which a value set is defined in the configuration (System Administration ® System Configuration ® Content Management ® Global Services ® Property Metadata ® Properties ® Parameter Allowed Values).
    At runtime (when you open the creation form) the system reads these values from the configuration and displays them in the dropdown list.
    If you link a combo box for which list entries already exist to a document property with a value set, the system asks whether you want to delete the list entries. it is recommend that you accept this suggestion and delete the list entries from the XML Forms Builder. Otherwise inconsistencies could arise between the entries in the XML Forms Builder and the value set in the configuration. This can cause errors when saving.
    Also you may Refer the Link for Further help:
    http://help.sap.com/saphelp_crm50/helpdata/en/29/c40d3d2a83752de10000000a114084/frameset.htm
    http://help.sap.com/saphelp_crm50/helpdata/en/00/9e7f41969e1809e10000000a155106/frameset.htm
    http://help.sap.com/saphelp_crm50/helpdata/en/a7/5a874174a8050de10000000a1550b0/frameset.htm
    Hope it Answers your Queries..
    Thanks and Regards,
    RK.

  • How to use a check box in smart forms????

    Hi All,
    Pls let me know how to use check boxes in smartforms.....??
    there are check boxe available which are crossed (i.e,, selected checkboxes) in the smartforms..
    But i need a checkbox which are not selected.( i.e.., which are not crossed).
    Its really urgent...
    Quick responses are highly appreciable..
    Bye

    Refer this thread
    Re: how to display symbols in smartforms
    We can create symbols in smartforms. For this, change the editor to text editor and then goto insert->characters->SAP Symbols and select the symbol you want.
    You cannot see the symbols in print preview, it'll appear only on a hard copy.
    You can also create as Text Element. In the left side of the right window,you can see a icon called Editor.Click it.
    Then in the Menu,
    go to->Change Editor
    Then in the menu,
    Insert->Characters->Displayable characters,select the character you want.Otherwise,if you want to insert SAP Icon,select that option instead of Displayable Character.

  • How to Use Open Dialog Box, & Save Dialog Box

    Hi Frens,
    Can You tell me how can i use open dialog box, and save
    dialog box using Flex. Because there is no such components are
    given here.
    Also How can i Do when I click on some button, or some event
    Please tell me abt this, Thks in advance frens
    Ashish Mishra

    for input requested try this
    String ar = JOptionPane.showInputDialog("Please, enter artist name");for any sort of message box try this
    int answer = JOptionPane.showConfirmDialog(null, "Enter another record?",
                                "???",JOptionPane.YES_NO_OPTION);This might help you buddy.

  • How to use Multiple Check Box control  to make a list of items in check box

    I have a use case where i have to save update list of items required, and i want to implement it through viewobject and use Multiple check box control, how do i go about it? Code snippet will be helpful........
    Edited by: jDev_08 on Nov 17, 2012 8:31 PM

    Hi,
    Always mention your JDev version.
    Check out the ADF Faces Demo : http://jdevadf.oracle.com/adf-richclient-demo/faces/components/index.jspx#%2Fcomponents%2FselectManyCheckbox.jspx (Hint : Code snippet is available in there itself).
    -Arun

  • How To use a dialog box??

    Sorry i am asking a very basic question.............But i would like to know how can i use a dialog box in swing.

    for input requested try this
    String ar = JOptionPane.showInputDialog("Please, enter artist name");for any sort of message box try this
    int answer = JOptionPane.showConfirmDialog(null, "Enter another record?",
                                "???",JOptionPane.YES_NO_OPTION);This might help you buddy.

  • How to use the place call step in the script

    I am new to uccx and the document does not explain alot for me related to this step so much.
    In the destination field : i use a  variable of string that matched before.
    The call contol group id : i use the integer of 2 ,the same as configured in the call control group number on UCCXadmin page.
    Dialog group: the same as call control group id.
    Here is my problem,the call contact field.
    If i create a variable of contact with value null and choose it in the contact field of the place a call.
    Call is not placed to the extension.
    Also with reactive debug : i see that this field should get filled with a value to make the call works,but i don't know how to use it.
    Thanks in advance.

    1. I'm not sure what you are asking.  Do you want to enter in all of the holidays for the next 10 years?
    2. For this specific date literal example, you can find it in the scripting volume 3.
    Here is the excerpt from the documentation on date literals:
    Date Literals
    The date literal is always of type Date. The following are the  different syntax formats you can use to enter a date.
    DateLiteral:
         DateDeclarator [n o w ]
         DateDeclarator [DateDesignator TimeDesignatoropt]
    DateDeclarator [ DateDesignator TimeDesignatoropt ]
    DateDeclarator: one of
         d D
    DateDesignator:
         FullDatePattern:
                Defined by the pattern "EEEE, MMMM d, yyyy"
         LongDatePattern:
                Defined by the pattern "MMMM d, yyyy"
         MediumDatePattern:
                Defined by the pattern "MMM d, yyyy"
         ShortDatePattern:
                Defined by the pattern "M/d/yy"
    TimeDesignator:
         FullTimePattern:
                Defined by the pattern "h:mm:ss a z"
         LongTimePattern:
                Defined by the pattern "h:mm:ss a z"
         MediumTimePattern:
                Defined by the pattern "h:mm:ss a"
         ShortTimePattern:
                Defined by the pattern "h:mm a"
    Example Date Literals:
    D[12/13/52]
    D[Dec 13, 1952]
    D[Thu, July 4, 2002]
    D[July 5, 2002]
    D[July 7, 2002]
    D[7/6/02]
    D[Thu, July 4, 2002 5:59 PM]
    D[July 5, 2002 5:59 PM]
    D[July 7, 2002 5:59 PM]
    D[7/6/02 5:59 PM]
    D[Thu, July 4, 2002 12:23:59 AM]
    D[July 5, 2002 12:23:59 AM]
    D[July 7, 2002 12:23:59 AM]
    D[7/6/02 12:23:59 AM]
    D[Thu, July 4, 2002 12:23:59 AM CST]
    D[July 5, 2002 12:23:59 AM CST]
    D[July 7, 2002 12:23:59 AM CST]
    D[7/6/02 12:23:59 AM CST]
    D[now]
    Details for the date and time patterns are available in the  documentation of the java.text.DateFormat class. If the string now is used, then  the literal corresponds to the current date in the server's default timezone at  the time the literal is evaluated for the first time.
    Each date literal is a reference to an instance of class  java.util.Date.
    Copyright © 2002-2010, Cisco Systems, Inc. All rights  reserved.
    Anthony Holloway
    Please use the star ratings to help drive great content to the top of searches.

  • How to use classes of packages in flex mx:Script/ or mxml/

    Hi.I am just learning Flex using Flex Builder 3 facing one problem,
    Suppose I declare one package with name alert.as
    package
    import mx.controls.Alert;
    public class alert
    public function alertBtn()
    Alert("Hello btn 1");
    Now in want to use the function in mxml that I declared in a package.
    <mx:Button label="btn1" click="alertBtn();"  />
    I have few questions
    1)How to Import the class alert.as in <mx:Script> and where should i store the file alert.as in the directory folder of flex?
    2)How to call the function alertBtn() when btn1 is clicked.
    Thanks so much!
    Regards
    Ankur

    Hi Greg.I think I was not able to clear my problem properly.Let me try this time again.
    What I wanted to do was that in the below written code I have the full access of the id=panel1 in the  script tag .This works properly.
    <?xml version="1.0"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script><![CDATA[
    import flash.display.Sprite;
    import mx.core.UIComponent;
    private function addChildToPanel():void {
    var circle:Sprite = new Sprite();
    circle.graphics.beginFill(0xFFCC00);
    circle.graphics.drawCircle(0, 0, 20);
    var c:UIComponent = new UIComponent();
    c.addChild(circle);
    panel1.addChild(c);
    ]]></mx:Script>
    <mx:Panel id="panel1" height="100" width="100"/>
    <mx:Button id="myButton" label="Click Me" click="addChildToPanel();"/>
    </mx:Application>
    This above functionality when I tried to do using class Outside the code ,its not working !
    Here is with the package:-
    But suppose I make One package 
    package
    import flash.display.Sprite;
    import mx.core.UIComponent;
    class getPanel extends Sprite
    public function addChildToPanel():void {
    var circle:Sprite = new Sprite();
    circle.graphics.beginFill(0xFFCC00);
    circle.graphics.drawCircle(0, 0, 20);
    var c:UIComponent = new UIComponent();
    c.addChild(circle);
    panel1.addChild(c);
              }//class
                        }//package
    Now in MXML
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script><![CDATA[
    import getPanel;
    ]]></mx:Script>
    <mx:Panel id="panel1" height="100" width="100"/>
    <mx:Button id="myButton" label="Click Me" click="getPanel.addChildToPanel();"/>
    </mx:Application>
    So My problem is that this code doesnt do anything.
    Neither the addChild function is working in it ,Nor the Panel1 is accessible here.
    Can u pls help me here.
    Thanks
    Ankur

  • ¿How i do for unskip an activity by powershell script?

    Hi.
    Im looking a way for unskip an activity from a service request using a powershell script.
    I've obtained for example the review activities.....
    $activities
    = Get-SCSMRelatedObject
    -SMObject
    $srObj
    –Relationship
    $wiContainsActivity
    $reviewAct
    = $activities
    | Where {$_.ID -match
    'RA'}
    Now i need to unskip an specific activity filtering by name for example .
    Regards.

    Thanks Thomas.
    I've tested the solutions but none work. 
    My problem is that im looking a way for dont create many service request templates (only
    one service request template but many activities templates).  I thought about create a classification enum list in a service request template with authoring tool (VALUE EXAMPLES: email, printer, vm creation) and find the way to create a workflow that
    add automatically the activities when i change the list value.
    A member of the community told me this:
    "Hi,
    You can create a single SR template and add additional activities and skip them as by default. Then create a workflow (or use SCORCH) to unskip the required activities. It much easier than adding new activities 'on-fly'."
    And i've created an authoring tool WF that run when a service request is created and execute
    the next pwshell script for unskip the review activities skipped in the service request that by default are skipped in the template but is not running. Can you help me? what's wrong?
    set-executionpolicy -executionPolicy ByPass
    $a = (get-module|%{$_.name}) -join " "
    if(!$a.Contains("SMLets")){Import-Module SMLets -ErrorVariable err -Force}
    $srClass = Get-SCSMClass System.WorkItem.ServiceRequest$
    $srObj = Get-SCSMObject -Class $srClass | Where {$_.ID -eq $srID}
    $wiContainsActivity = Get-SCSMRelationshipClass System.WorkItemContainsActivity
    $activities = Get-SCSMRelatedObject -SMObject $srObj –Relationship $wiContainsActivity
    $reviewAct = $activities | Where {$_.ID -match 'AR'}
    $ACStatusSkipped = Get-SCSMEnumeration ActivityStatusEnum.Skipped
    $ACStatusReRun = Get-SCSMEnumeration ActivityStatusEnum.Rerun$
    If ($reviewAct.Stauts -eq $ACStatusSkipped) { 
      set-SCSMObject $reviewAct -Property Status -Value $ACStatusRerun
    }

  • How to use a SelectAll box / checkbox to select multiple checkboxes!!

    I have a question regarding checkboxes.
    My jsp page has the following layout generated dynamically based on a drop down selection box.
    ID State Initiated Released Locked
    US Initiated X
    Arg Released X X
    Ger Released X X
    Ita Locked X X X
    The Initated, Released & Locked columns are checkboxes. The checkboxes are enabled or disabled based on the State. This means that if the state is Initaited, the user will click the desired checkbox, while the others in the same row will be disabled, and so forth.
    Now all I want is the option of having a SelectAll button / checkbox (something like in yahoo,hotmail) for each column (Initiated,Released,Locked), which when clicked will select all the desired checkboxes under them.(which will select only those in the respective state).
    This is basically to make life easier for the user in case there are some 100 rows. Instead of selecting each individually, he can just click a single button for each column. He can then unselect whichever one he wants.
    I know this can be done using javascript. Remember that this list is not static, but dynamic. So I cannot send a fixed no. into my javascript function to iterate. Im using <nested:iterate> & <nested:checkbox> for iterating & displaying the checkboxes.
    If someone has a solution on it please do send me the code snippet.
    Thanks.

    Javascript is the only solution for something like this.
    I presume you are using struts indexed properties?
    Remember that this list is not static, but dynamic. So I cannot send a
    fixed no. into my javascript function to iterateTrue, but once your JSP is generated you know exactly how many controls you have generated using the varStatus of a iterate tag, or just looking at the size() of the list being iterated on. You can use that to generate the javascript function/call.
    Also you can use javascript without knowing exactly how many are there. You can actually discover the fields on the page.
    Hope this helps,
    evnafets

  • How to use a check box in ALV

    Hi All,
    I have a urgent requirement in my <b>ALV list</b>.
    Where in the output list i need to create a check box, which is followed by Sales order, quantity columns etc......
    Requirement:  1. tell me how to <b>create</b> a <b>check box</b>
    2.   i need to select the checkbox(Sales Order) and press  a push button which is above the list(push button) in the tool bar.
    I am able to see the output using  <b>reuse_alv_grid_display</b>.
    <b>But kindly let me know how to <b>link</b> the <b>check box</b> and the <b>push button</b> which is above the list for further processing.</b>
    Possibly a sample code will help a lot.
    Thanks in advance.
    Rajesh Kumar.

    TO create a check box, take one field in your internal table as:
    CHK TYPE C.
    Now, pass the LAYOUT by filling up the LAYOUT strucutre.
    LAYOUT-BOX_FIELDNAME = 'CHK' .
    This will provide you the BOX field in the GRID and Checkbox in the LIST.
    When you select the  checkbox the field value will set to 'X' in the table.
    Regards,
    Naimesh Patel

  • How to use the check box?

    How is the check box to be used? If I have 10,000 songs in my itunes library and have 1,000 of them checked, how can I place all 1,000 checked songs into a new playlist that I have created just for them. They are not located together in my library so I can't just hold down the SHIFT key and highlight them all for movement. Also, I would rather not have to hold down the CONTROL key and then search through 10,000 songs for the 1,000 I have checked. So what is the secret to accomplishing this?
    Can you sort your library by whether a songs is checked or not? If I could sort them all together as a group, then I could use the SHIFT key to highlight and move them all.
    Am I missing something here? How can you select and sort songs by whether they are checked or not in your library?
    Thanks so much for any help you can provide.

    If only the 1,000 songs you want are currently checked, create a Smart Playlist to collect them.
    How to Create a Smart Playlist
    - File=>New Smart Playlist
    - Playlist is 'whatever playlist you want to use'
    - Match only checked songs
    Note: There is no way to select the Main Library. If you're working with the Library as a base, you'll need un-check the 'Match the following rule' and check 'Limit to' and put a high enough number to capture all the songs.
    Several ways to creatively manage the issue.
    You may wish to create a Static Playlist once you are done, and drag those songs into it for more permanence.
    Post back if you have more questions.

  • How to use one Combo Box to control Two spreadsheet/charts in Web Analysis

    In Web Analysis panel, I have one data grid and one chart (two different data sources). I would like to have one combo box, e.g. Q1, Q2, Q3, Q4, in the selection (drop-down). When I select Q1, I would like to show Jan, Feb, Mar, Q1 ( ICHILDREN(Q1)) in my chart, and also only Q1 in my data grid.
    Any suggestions?
    Thanks

    I believe you can do this. For example you want to have a Chart and Graph linked to a drop down for products. When you select a product, the two POV's will change on the reports.
    Look at Panels in WA. I create a report with three panels. Make the first panel top aligned, the second top aligned and the third stretched. This should make the report "stretchy". Then add your dropdown to one panel and your reports to the other two panels.
    Finally link the reports to dropdown using the re-linking technique mentioned in the previous post.
    Hope this helps.
    Brian Chow

  • How to use 2 Dropdown box in webapplication for date range selection

    Dear all,
    I am working on a report that will show 2 drop down boxes. These should be used as a date range.
    This works fine if I use 2 variables as a date range on 0CALYEAR. However I dont want the user to fill in the dates but selecting the dates with 2 drop down boxes.
    I cannot manage to get this to work. I saw some comments about user exits in the forum but I cannot figure it out if there is an easier way.
    Could you give me an idea of what to do?
    Thanks a lot,
    Andreas

    Hi,
    If you want the user to select the date directly rather than entering, you need not to have a dropdown menu in WAD. Directly go to the query which you have selected for the object in WAD, there create a variable with calendar. Put it mandatory, so that the user selection of the date will be mandatory. The variable will be automatically be available when you execute the template inn the browser.
    Assign points if this helps u.
    Regards,
    Koundinya.

Maybe you are looking for