FactoryTalk SE project directory from VBA

pof@

Member
Join Date
Mar 2013
Location
CPH
Posts
5
Hi everyone

From my FactoryTalk SE VBA code I need to determine what directory contains the FactoryTalk SE project.

I need a way to have the "C:\Documents and Settings\All Users\Documents\RSView Enterprice\SE\HMI Projects\My Project\" or whatever it is, returned to my VBA code. I'm sure this is possible but I can't find it.

Any comments?

Thanks in advance
Peter
 
I might add that DisplayClient.Application.ApplicationName only returns "My Project" and not the "C:\Documents and Settings\All Users\Documents\RSView Enterprice\SE\HMI Projects\" and this seems to be variable according to the selected OS, eg. XP or Win 7.
 
You should be able to do a VB call and use the following.
Dim mypath as string
Mypath = app.path
You would then have to link mypath to where ever you need it.
 
I think that app.path is more Excel related and not FactoryTalk SE related.

Is there any suggestions?
 
You are right about that being an excel or access call.
I spent over an hour looking for your answer and came up with nothing. All sample codes where ususally for excel, access or word. It may be possible to use a shell32 call.
The only path I could find in Studio was
MyPath = FileSystem.CurDir
but this returned the last working directory.
The easiest route may be to call a GetINI and embed the path
in it.
Here is the code:

Dim X As Integer
Dim sFileName As String
Dim sRetBuf As String, iLenBuf As Integer
sFileName$ = "C:\test.ini"
sRetBuf$ = String$(100, 0) '60 null characters
iLenBuf% = Len(sRetBuf$)
X = GetPrivateProfileString("Config", "FilePath", "", sRetBuf, iLenBuf%, sFileName$)
NetworkDataBase = Mid(sRetBuf, 1, X)

Create a module and paste the following as well.
Declare Function GetPrivateProfileString Lib "kernel32" Alias_
"GetPrivateProfileStringA" (ByVal lpApplicationName As String,_
ByVal lpKeyName As Any, ByVal lpDefault As String, _
ByVal lpReturnedString As String, ByVal nSize As Long, _
ByVal lpFileName As String) As Long
 
Hi Mark

Thank you for your answer.

The Rockwell support told me that the projects is always installed in the Windows shared folder. So I made a API call to read the registry for this. And with DisplayClient.Application.ApplicationName I was able to find my complete answer:O)
 

Similar Topics

Does anybody know if it is possible to change the default project folder for FactoryTalk Studio ME projects? Running FactoryTalk Studio ME...
Replies
8
Views
6,288
Good morning, I have a project coming up that will require my HMI runtime to toggle from English to Spanish via selector switch. What is the...
Replies
0
Views
459
I have a FTV project that was moved. The person moved the folder for the project and did not create an .apa file. How can I add this project...
Replies
6
Views
1,674
Hello All! Please help me figure out how to use multiple recipes in the same FT project. My cell contains two production lines and I`d like to...
Replies
0
Views
1,310
I have a client's project file that is in FactoryTalk 8.0. We are currently running 10.0 and when I open up the project it wants me to convert...
Replies
1
Views
1,054
Back
Top Bottom