Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
String parsing problem
#1
Hi all, Hi Gintaras

i can't find the solution to this, though i suspect i miss something plain and easy.

I want to interact with Directory Opus (DO°, but for some reason (personal setup), I can't use shell menu trigger, so I need
to pass selected files in DO to a QM macro using the _command parameter.

The problem is that files are passed to _command variable as this:

u:\myfile.txt u:\my file with space u:\myfolder u:\my folder with space (each file/folder name separated by space)

As you have guessed, i must parse files and folders names into str or ARRAY(str) variable.

I trid tok function, regex etc and I always fail because of the spaces in the files/folders name.

Solution?

Thanks.
#2
Macro Macro1703
Code:
Copy      Help
out
;str s="u:\myfile.txt u:\my file with space u:\myfolder u:\my folder with space"
str s="u:\myfile.txt u:\my file with space \\x\y\myfolder \\x\y\my folder with space"

ARRAY(str) a; int i
;if(!findrx(s "[a-z]:.+?(?= [a-z]:|$)" 0 1|4 a)) ret ;;simpler, does not work with \\x\y\...
if(!findrx(s "([a-z]:|\\\\).+?(?= ([a-z]:|\\\\)|$)" 0 1|4 a)) ret ;;supports \\x\y\...

for i 0 a.len
,out a[0 i]
#3
Wonderful, as usual.
In fact i did try that but forgot the (?= thing to not grab
the next u:\ from the next file name. I knew i was close.
What are the \\x\y\?

UNC?
#4
yes
#5
OK, thanks


Forum Jump:


Users browsing this thread: 1 Guest(s)