Title: RE: (ROSE) Rose Script and directory structure
I think you'll either have to strip the directory name off.........................................
 
Function StripFileFromPath(inPath As String) As String
 StripFileFromPath = ""
 
 If Len(inPath) = 0 Then
  Exit Function
 End If
 'find last slash
 seperator% = 0
 tempPos% = 0
 Do
  tempPos = InStr(seperator + 1, inPath, "\", 0)
  If tempPos <> 0 Then
   seperator = tempPos
  End If
 Loop Until tempPos = 0
 If seperator > 0 Then
  If seperator <> Len(inPath) Then
   'found a slash and it's not the last character
   StripFileFromPath = Left(inPath, seperator)
  Else
   StripFileFromPath = inPath
  End If
 End If
End Function

Sub Main
 Dim f As String
 'get location of directory by selecting file in it
 f$ = OpenFilename$("Open","any file:*.*")
 If f$ <> "" Then
  thePath$ = StripFileFromPath (f$)
  MsgBox thePath$
 End If
 
End Sub
.....Or use a windows function call... for example here's a call to windows file
dialog box...............................................................................................
 
Type OPENFILENAMEX
 lStructSize As Long
 hwndOwner As Long
 hInstance As Long
 lpstrFilter As String
 lpstrCustomFilter As String
 nMaxCustFilter As Long
 nFilterIndex As Long
 lpstrFile As String
 nMaxFile As Long
 lpstrFileTitle As String
 nMaxFileTitle As Long
 lpstrInitialDir As String
 lpstrTitle As String
 flags As Long
 nFileOffset As Integer
 nFileExtension As Integer
 lpstrDefExt As String
 lCustData As Long
 lpfnHook As Long
 lpTemplateName As String
 End Type
 
Declare Function GetSaveFileName Lib "comdlg32.dll" Alias "GetSaveFileNameA" _
(pOpenfilename As OPENFILENAMEX) As Long

Sub Main
 
 Dim RoseHWND As HWND
 
 Set RoseHWND = WinFind("Rational Rose")
 
 Dim OFName As OPENFILENAMEX
 Dim Def As String
 
 def = "test"
 
 OFName.lStructSize = 76
 OFName.hwndOwner = RoseHWND.value
 OFName.hInstance = 0
 OFName.lpstrFilter = "Text Files (*.txt)" + Chr$(0) + "*.txt" + _
Chr$(0) + "All Files (*.*)" + Chr$(0) + "*.*" + Chr$(0)
 OFName.lpstrFile = def +Space$(254 - Len(def))
 OFName.nMaxFile = 255
 OFName.lpstrFileTitle = Space$(254)
 OFName.nMaxFileTitle = 255
 OFName.lpstrInitialDir = "C:\"
 OFName.lpstrTitle = "Open File"
 OFName.flags = 0
 
Dim zot As Long
 
zot = GetSaveFileName(OFName)
msgbox OFName.lpstrFileTitle
 
End Sub
 
Patrick Kennedy
 Rational Support
-----Original Message-----
From: Dan Liu [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 05, 2001 1:10 PM
To: 'Roger St-Amand'; '[EMAIL PROTECTED]'
Subject: RE: (ROSE) Rose Script and directory structure

Hi, Roger
 
OpenFileName$ function opens a selected file.
What I need is to browse the directory structure, and get the path of selected directory.
 
I know I could use OpenFileName$ to get file path, then strip off  the file name to get it's directory path. But this is very confusing for users, as they need to specify the directory path where several files containing rose model information will be stored.
 
Thanks / dan
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Roger St-Amand
Sent: Wednesday, September 05, 2001 3:38 PM
To: '[EMAIL PROTECTED]'
Subject: RE: (ROSE) Rose Script and directory structure

Try to use this function of Rose Extensibility

OpenFilename$[([title$ [,[extensions$] [,helpfile,context]]])]

It should be works

Regards,

Roger

-----Original Message-----
From: Dan Liu [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 05, 2001 3:09 PM
To: [EMAIL PROTECTED]
Subject: (ROSE) Rose Script and directory structure



Hi, All

Is there any way to display the directory structure of a computer and allow
a user to select a folder by using Rose Script?

Is SHBrowseForFolder of windows API supported by Rose Script?

Thanks for your help. / dan

************************************************************************
* Rose Forum is a public venue for ideas and discussions.
* For technical support, visit http://www.rational.com/support
*
* Admin.Subscription Requests: [EMAIL PROTECTED]
* Archive of messages: http://www.rational.com/support/usergroups/rose/rose_forum.jsp
* Other Requests: [EMAIL PROTECTED]
*
* To unsubscribe from the list, please send email
*
* To: [EMAIL PROTECTED]
* Subject:<BLANK>
* Body: unsubscribe rose_forum
*
*************************************************************************

Reply via email to