xlabel %[droppath]% ignores quotes Thread last updated on 2006-03-14 01:13:08

Posted by member 280260 on 2006-03-09 21:12:20

I'm trying to set up a drag-n-drop launcher bar, but I can't seem to save the variable that defines the path properly. No matter how I wrap it, the xlabel %[dropppath]% keeps cutting itself off at the first space. Anyone know of a fix for this issue?

Posted by member 212670 on 2006-03-09 23:15:22 link

Well, it's hard to say exactly what you're doing wrong since you don't include that, but the example in the xlabel help file works perfectly fine for me.
!xtextsaveevar @$configdir$save.rc@ @dropped@ @%[droppath]%@

I also tested it using !xtextappend...
!xtextappend @$configdir$save.rc@ @"%[droppath]%"@

Both wrote the path with quotes. Note: No quotes were needed around %[droppath]% in the first example. The var used there, of course, is "dropped."

Also Tested - LabelOnDrop shortcut "$ThemeDir$"
It properly created a shortcut to the file (or directory) in the theme's directory.

One thing I had problems with was sticking the %[droppath]% in an mzscript var and saving that. It wouldn't save with quotes, even if I used the mz escape for quotes.

Posted by member 280260 on 2006-03-10 20:47:24 link

Just realized that I forgot to mention I was using mzscript. :P
Not a problem doing it w/ xTextEdit, though.

Posted by member 248213 on 2006-03-10 21:44:43 link

wheres your code then!?

Posted by member 280260 on 2006-03-11 00:28:03 link

I was just testing to make sure it worked before I went and did the full code. If you really want it, though:

button0OnDrop !msgbox "%[droppath]%"

Posted by member 280260 on 2006-03-12 20:27:35 link

In case anyone's wondering, I figured out the trick to getting %[droppath]% into an mzscript var.

You use xTextEdit to save it into an mzvarfile, reload the varfile and then reference the path using the var's :line modifier.

(Did that make sense?)

Posted by member 1 on 2006-03-12 22:36:47 link

You shouldn't need to do that. You should be able to import it as a passed variable.

Posted by member 280260 on 2006-03-13 20:24:40 link

Trust me, I tried. But
!varSet path %[droppath]%
!varSet path "%[droppath]%"
!varSet path '%[droppath]'
!varSet path "(%droppath)"

all get cut off at the first space. (xcal, back me up here?)

At any rate, it's working now.
Time to tackle xlabel icon extraction....

Posted by member 212670 on 2006-03-13 21:07:31 link

Ok, first, one problem you might have is that "path" is already a Windows environment variable. So don't use that. :P

Next, and this might be what DeV was getting at, you can use the full path while it's in memory. If you want to see an example, try this:

TheLabelOnDrop !bang "%[droppath]%"

*Script bang !bang
*Script exec !varset tmp "%{args:1}"
*Script exec !alert "%{tmp}"
*Script exec "$FileManager$" "%{args:1}"
*Script exec !xTextSaveEvar @$ConfigDir$test.rc@ @test@ @%{args:1}@
*Script ~bang

That sends the droppath as an argument, which includes the entire path. You'll see it uses the entire path properly by the way !alert shows it, and the way it opens your filemanager to the path.

Now, if you want to save that, you can do !varsave tmp (assuming you have a var named "tmp" in your vars file), BUT you don't want to. mzscript won't include the quotes, even if you surrounded the argument with mz's escapes for quotes (atleast it wouldn't for me), which of course will be a problem next time you load your var file.

So, you can play with the full path while its in memory, when you want to actually write it, just use xTextEdit.

I hope I made sense in there somewhere. :D

Now, back to the topic: There is a problem with %[droppath]% and writing paths in to vars and trying to save them. I use comdlgls to set vars all the time, and mzcript saves the variables with no problems at all.

Posted by member 280260 on 2006-03-13 23:21:17 link

It was the !varset tmp that I was having trouble with, but like I said, I was able to fix it with xlabel. Not that Andymon doesn't have enough on his plate already, but has this issue been brought up with him?

I wasn't actually using path as a variable Do $evars$ actually interfere with the Windows environment variables? Interesting.

Posted by member 212670 on 2006-03-14 01:13:08 link

As far as I know, it hasn't been brought up to him. It's pretty minor, and doesn't get used much, so it's under the radar, I guess.

And yup, it can cause issues, if you're expecting something else to be returned. Put this in a command (needs xlabel loaded):

!ParseEvars !alert "%#path%#"
(or even: !ParseEvars !alert "%#processor_identifier%#")

You'll notice "path" expands perfectly using the Windows var. If you have !alert $path$ in an mz script, it'll also expand to the Windows var. *Script exec !alert %{path} won't, though, since that indicates an mzscript var. But, you can do !varset path $path$, then !alert %{path}, and, of course, it'll return the Windows var.

Anyway, I seem to be rambling on tonight...