Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Extract filename
#1
Hi,

can somebody please help me with the folowing:

I want to extract the path and store it in a string... the path is like this: v:\ RTS\REAL 2 REAL\real_20081201.xls

Thanks
#2
there is a button on the QM toolbar called 'get file info'. just fill in the info and you'll be able to have it do it all for you.
An old blog on QM coding and automation.

The Macro Hook
#3
Thx for the reply...

what i need is the regular expression for the path... i cannot get it done. i have the files 'read' in a string and want it extracted in another string so i can open this file.

thanks for your time
#4
sounds like you now have two problems.
In doing this you shouldn't use regex because, by definition, you already have a way to do it and you should avoid the performance hit with regex (even with little macros) and use already available functions in the prog. if you run than quick dialog, you'll have a good template for the other files you need as well.
An old blog on QM coding and automation.

The Macro Hook
#5
Function Function2
Code:
Copy      Help
out
str FileName FileNameExt Path

str s="v:\ RTS\REAL 2 REAL\real_20081201.xls "
FileName.getfilename(s)
out FileName

FileNameExt.getfilename(s 1)
out FileNameExt

Path.getpath(s)
out Path
#6
HA!
string functions!!! oh, man I gotta keep a notebook of this stuff! when did those get created?
An old blog on QM coding and automation.

The Macro Hook
#7
They've been there as long as I've been working with QM.

Geeze...I know what you mean though. I feel like I've probably read the QM help file about 100 times, and my mind still gets blown away by the stuff that I'll stumble across. It's amazing on how parts of it start to make sense after a while. Believe me though there are still a lot of parts I read and I sit back and think, "Huh?"

Glad I could help,
Jimmy Vig
#8
Hey Jimmy and Ken,
I feel the same way about the helpfile...I used to think it was unclear or needed some English translation polishing and over time I realized that it is already is extremely clear once you are "ready" for the Jedi knowledge within. I love typing things into the helpfield at the top of the QM panel and seeing all the various references dropping down.

One of the things I would like to better understand is the relationship between QM functions, WIndows API functinos and the MSDN library. Gintaras sometimes refers to that as a resource to solve problems as a way to extend QM.

In the helpfile for the file strings above, it says
Quote:Tips

There are many easy to use Windows API functions that can be used to work with paths and URLs. For example, PathFindExtension finds file extension. They are documented in the MSDN Library.

and elsewhere in the Helpfile

Quote:MSDN Library (Windows API function reference)
In QM can be used Windows API functions and interfaces. They are documented in the MSDN Library on the Internet. The library can be browsed online, or downloaded. For example, you can download Windows API documentation as part of Platform SDK.
and much more in the help file called Declarations: Dll functions, types, COM classes, typelib, etc..

To understand these would be taking things to a much higher level. As an example, what Gintaras helped me to do with Sqlite is amazing.....

http://www.quickmacros.com/forum/showthr...6#pid13256

Stuart


Forum Jump:


Users browsing this thread: 1 Guest(s)