Kinook Software Forum

Go Back   Kinook Software Forum > Visual Build Professional > [VBP] General Discussion

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 09-07-2007, 09:34 AM
jeffnc jeffnc is online now
Registered User
 
Join Date: 04-03-2007
Posts: 2
How to retrieve and parse current directory?

Basically what I'd like to do is retrieve part of the current directory name. For example, if the directory (that the Visual Build Pro .bld file exists in) is

C:\whatever\dir 1234 abcd

what I'd like to get is "1234". So first, I need a way to retrieve the dir name and then I need a way to parse it. Thanks.
Reply With Quote
  #2  
Old 09-07-2007, 10:02 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
[vbld_FSO.GetBaseName("%PROJDIR%")]

will give you the directory name of the current .bld file.

It's not clear exactly how you want to parse the value (first item found after a space, first set of digits, etc.). To retrieve the first value between spaces, use

[Split(vbld_FSO.GetBaseName("%PROJDIR%"))(1)]

The code above assumes VBScript is set as the default script language.
Reply With Quote
  #3  
Old 09-07-2007, 10:23 AM
jeffnc jeffnc is online now
Registered User
 
Join Date: 04-03-2007
Posts: 2
OK thanks. So 2 more questions.

What step type would I create to put your code in?

For parsing, it looks like it can be this simple.

blah blah blah 1.2.3.4

I want 1.2.3.4, so it could be as simple as getting the last "token", or whatever comes after the last space.
Reply With Quote
  #4  
Old 09-07-2007, 10:37 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
Quote:
Originally posted by jeffnc
What step type would I create to put your code in?
It depends on what you want to do with the parsed value. You might just use the expression inline in the field(s) that need it. Or you could assign it to a macro (via a Set Macro step or by using the expression as the value of a macro) and use the macro as needed.

Quote:
For parsing, it looks like it can be this simple.

blah blah blah 1.2.3.4

I want 1.2.3.4, so it could be as simple as getting the last "token", or whatever comes after the last space.
[Mid("%PROJDIR%", InStrRev("%PROJDIR%", " ")+1)]
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT -5. The time now is 04:09 AM.


Copyright © 1999-2023 Kinook Software, Inc.