Oyvind Odegard Posted November 17, 2008 Posted November 17, 2008 I have a problem that possibly has more than one solultion, and would be most grateful for any comments or ideas on what would be the best way to solve it. I have a database where every record has a unique number (year + serial 000-999) e.g. 2008186. The records correspond to folders in a known location on a HDD. The foldernames all start with the number + keywords that are entered on creation by users. For instance "2008186 shipwreck dredging North Sea". The folders contain all documents pertaining the respective records in the DB (FMP9). I have made a button "go to folder", with a send event script that finds the directories of the folders and should open the folder in explorer. But - as the DB only knows the number-part of the foldername, and not the keywords - the script won't work. I have looked for a batch command for the "Tab - autocomplete" function in the (WIN XP) cmd.exe, but no success so far. No two folders start with the same number, so this should work at least in theory. One obvious solution is to rename all folders to the number only, but unfortunately that is not possible as the keywords are used for browsing folder directories manually as well. I guess VBS is a viable way to go, but as I have very limited VBS knowledge I was hoping there was a simpler solution. For instance maybe could FM read a folder directory and find/match foldername to the unique recordnumber, or something...? I hope my explanation of the problem makes sense... Any ideas or comments? Oyvind Odegard
Søren Dyhr Posted November 18, 2008 Posted November 18, 2008 You might be right here, as long as you keep this in mind: http://www.databasepros.com/FMPro?-DB=resources.fp5&-lay=cgi&-format=list.html&-FIND=+&resource_id=DBPros000823 http://www.databasepros.com/FMPro?-DB=resources.fp5&-lay=cgi&-format=list.html&-FIND=+&resource_id=DBPros000842 But to get to the OS, should you perhaps start here: http://my.advisor.com/articles.nsf/aid/13345 ...including pokes into these techniques: http://www.connectingdata.com/downloads.htm --sd
Oyvind Odegard Posted November 20, 2008 Author Posted November 20, 2008 Thank you very much Søren! Those links were very useful, hopefully I'll report my success in a few days. Oyvind
Oyvind Odegard Posted November 20, 2008 Author Posted November 20, 2008 After trying to bend my brain around more and more complex FM scripting, I decided to at least have a look at VBS - and lo and behold - it wasn't as hard as I had feared. It works perfectly now I can post a copy of the script if anyone is interested. Oyvind
Søren Dyhr Posted November 20, 2008 Posted November 20, 2008 Why not put them in a "code" clause here? --sd
Oyvind Odegard Posted November 20, 2008 Author Posted November 20, 2008 I found a script here http://www.tek-tips.com/faqs.cfm?fid=5515 that I modified a bit. "strDir = " & Quote($path) &" ¶ Set FSO = CreateObject("Scripting.FileSystemObject")¶ Set objShell = CreateObject("WScript.Shell")¶ Set objDir = FSO.GetFolder(strDir)¶ getInfo(objDir)¶ ¶ Sub getInfo(CurrentDir)¶ For Each Item In CurrentDir.SubFolders¶ If Left(Cstr(Item.name),7)=" & Quote($Folder) & " Then¶ objshell.run "cmd /c explorer.exe """ & Item.path & """"¶ End If¶ Next¶ End Sub¶ " $path and $Folder are variables from the record. Oyvind
Recommended Posts
This topic is 5889 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now