Need Help on how to gather part of a filename

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Martin_SBT
    Forum Member
    • Jun 2002
    • 173

    Need Help on how to gather part of a filename

    Hello Boys and Girl

    I have a file called "CAMONW0078_Ins_DB.atom.fdb.DB". In my AMS4 project i searched for the file and stored the filename and ext into a variable called "%FileName%. The first part of the filename (everything that is before "_Ins_") represent a computer name. I would like to have an easy way to keep ONLY what appears before "_Ins_" and store it into a global list. Since the numbers of caracters in the computer name will differ from computer to computer, i cant see how to accomplish that. If anyone can help me out, i will be the happiest man in the world!

    thanks in advance

    Martin
  • Corey
    Indigo Rose Staff Alumni
    • Aug 2002
    • 9741

    #2
    Re: Need Help on how to gather part of a filename

    Hi. Just use a STRING > GET DELIMITED STRING action setting the delimiter to _ and your item at index 0 will be the computer name then just use a GLOBAL LIST > ADD action to add it to your global list...

    Corey Milner
    Creative Director, Indigo Rose Software

    Comment

    • Martin_SBT
      Forum Member
      • Jun 2002
      • 173

      #3
      Re: Need Help on how to gather part of a filename

      You are the man! :0) Thanks!

      now here another one for you. Now that i have my global list populated, i am trying to add the its content to an object list box but at run time it give me an error: "Could not add item to the listbox object. The object was not found on this page 'listbox2'." But the listbox object really exist!! Any idea on what is wrong? here the action from my project:

      IR_ACTIONS_LIST>
      <Action name="Get Item">
      <Type>112</Type>
      <Function>0</Function>
      <DTIndentLevel>0</DTIndentLevel>
      <Enabled>1</Enabled>
      <ErrorHandling>
      <UserNotificationMode>2</UserNotificationMode>
      <CustomErrorMessage/>
      <OnErrorAction>0</OnErrorAction>
      <JumpToLabel/>
      </ErrorHandling>
      <TargetList>Computers</TargetList>
      <GetType>1</GetType>
      <Index/>
      <IndexDelimiter>;;</IndexDelimiter>
      <Variable>%ListItem%</Variable>
      <VarDelimiter>;;</VarDelimiter>
      </Action>
      <Action name="Add">
      <Type>118</Type>
      <Function>0</Function>
      <DTIndentLevel>0</DTIndentLevel>
      <Enabled>1</Enabled>
      <ErrorHandling>
      <UserNotificationMode>2</UserNotificationMode>
      <CustomErrorMessage/>
      <OnErrorAction>0</OnErrorAction>
      <JumpToLabel/>
      </ErrorHandling>
      <TargetListBox>ListBox2</TargetListBox>
      <AddType>1</AddType>
      <Index/>
      <ItemToAdd>%ListItem%</ItemToAdd>
      <ItemDelimiter>;;</ItemDelimiter>
      </Action>
      </IR_ACTIONS_LIST>

      Comment

      • TJ_Tigger
        Indigo Rose Customer
        • Sep 2002
        • 3159

        #4
        Re: Need Help on how to gather part of a filename

        Works fine here.
        TJ-Tigger
        "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
        "Draco dormiens nunquam titillandus."
        Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

        Comment

        • Martin_SBT
          Forum Member
          • Jun 2002
          • 173

          #5
          Re: Need Help on how to gather part of a filename

          ummmm...It doesnt here! I even tried to move to actions on "Page show" instead of "On Initialize" but still the same error!! I am running WinXP! Should i contact Technical Support?

          Comment

          • Corey
            Indigo Rose Staff Alumni
            • Aug 2002
            • 9741

            #6
            Re: Need Help on how to gather part of a filename

            Simply add a small application sleep action, i.e. .5 seconds before your listbox action and every thing will be fine. The problem in this case is that AMS is getting a bit ahead of your computer...

            Corey Milner
            Creative Director, Indigo Rose Software

            Comment

            • Martin_SBT
              Forum Member
              • Jun 2002
              • 173

              #7
              Re: Need Help on how to gather part of a filename

              Yeah, that made it! Thanks gents.


              AMS ROCKS!!

              Comment

              • Corey
                Indigo Rose Staff Alumni
                • Aug 2002
                • 9741

                #8
                Re: Need Help on how to gather part of a filename

                No probs, glad it works... [img]/ubbthreads/images/icons/smile.gif[/img]

                Corey Milner
                Creative Director, Indigo Rose Software

                Comment

                Working...
                X