Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
altered variable contents
#1
I have two macros on two different computers. One of them controls the other. The first computer passes on one or more mp3's to another computer. The second computer only seems to be processing every other file, starting with the first one, regardless of how many I select.

The first computer macro:
Code:
Copy      Help
;This macro accepts one or more mp3 filenames from
;the system to be played or enqueued on a remote computer

function $mp3 $action

str m=mp3
m.findreplace("\\zeners\music" "e:" 2)
;action is Play or Enqueue
str a=action

int p=net("zeners" "" "Play in Winamp" 0 a m)

The second computer macro:
Code:
Copy      Help
;This macro accepts input from remote computer to play or enqueue mp3's

function $operation $mp3

str a="/ADD "
str o=operation
str m=mp3
str q="''"
str ply.from(q m q)
str enq.from(a q m q)
str winamp="C:\Program Files\Winamp\winamp.exe"

if o = "Play"
,run winamp ply
else if o = "Enqueue"
,run winamp enq

My test would seem to indicate that the concatenation operation is striping the extra songs out of the mp3 variable.

Thanks for the help...
#2
What is contents of:

mp3 in the first function

m in the first function

mp3 in the second function

ply

?
#3
Example #1:

first macro
------------
mp3 = \\zeners\music\MP3's\Berlin-Take My Breath Away.mp3
m = e:\MP3's\Berlin-Take My Breath Away.mp3
------------
second macro
------------
mp3 = e:\MP3's\Berlin-Take My Breath Away.mp3
ply = "e:\MP3's\Berlin-Take My Breath Away.mp3"
------------

Example #2:

first macro
------------
{the out command shows each file on a seperate line}
mp3 = \\zeners\music\MP3's\Berlin-Take My Breath Away.mp3
\\zeners\music\MP3's\Avril Lavigne-I'm With You.mp3
\\zeners\music\MP3's\Clash-Rock The Casbah.mp3
\\zeners\music\MP3's\Devo-Whip It.mp3
m = e:\MP3's\Berlin-Take My Breath Away.mp3
e:\MP3's\Avril Lavigne-I'm With You.mp3
e:\MP3's\Clash-Rock The Casbah.mp3
e:\MP3's\Devo-Whip It.mp3
------------
second macro
------------
mp3 = e:\MP3's\Berlin-Take My Breath Away.mp3
e:\MP3's\Clash-Rock The Casbah.mp3
ply = "e:\MP3's\Berlin-Take My Breath Away.mp3"
"e:\MP3's\Clash-Rock The Casbah.mp3"
------------

The first macro is called from a context menu. I right click on one or more mp3's to "send" them to the macro. The command I'm using is:
"C:\Program Files\Quick Macros 2\qmcl.exe" M "Play music on zener's" A "%1" Play

Thanks!
#4
Make net to run synchronously. The simplest way - replace 0 (4-th argument) to _s.
#5
I tried your suggestion. Nothing changed.

The problem is definately on the receiving end and not the "sender" as you referenced.

Through comenting out one line at a time from the bottom, I've found the culprit to be:
Code:
Copy      Help
run winamp ply

For some reason the run command seems to be reducing the number of entries in the ply variable.
#6
Do you send one path at a time, or all paths as multiline string?
#7
Convert first macro to function. Convert second macro too. Use _s in first macro.

Now first macro not always runs because already running.

Or select 'Wait' in Properties of first macro. I think this is better than converting to function.
#8
At the end of the second macro:
Code:
Copy      Help
out ply
shows exactly:
"e:\MP3's\Berlin-Take My Breath Away.mp3"
"e:\MP3's\Clash-Rock The Casbah.mp3"

When I comment out the run line, I see:
"e:\MP3's\Berlin-Take My Breath Away.mp3"
"e:\MP3's\Avril Lavigne-I'm With You.mp3"
"e:\MP3's\Clash-Rock The Casbah.mp3"
"e:\MP3's\Devo-Whip It.mp3"

The one or more mp3's are being "dumped" into the "%1" variable from windows explore to the registry which in turn executes the command line I listed to call the macro on the first computer.
#9
In my tests, if multiple files are selected, first macro is called multiple times, for each file. See my previous post.
#10
hooray, hooray, hooray...:~)

Your suggestion about converting the macros to functions and swapping the 0 for an _s worked!

Thanks so much! :~)
Just say HEMP!
#11
I am not sure, but if the first macro is function, maybe still exists error possibility, because net may be called in two threads simultaneously. Before it insert

lock

(it is available only from QM 2.2.0).
#12
I'm using QM 2.2.0.11

Everything seems to be working perfectly for now. I've not had the time to torture test it yet. :~)

Regarding the multi-thread theory... Where do you think the source is? Explorer maybe? And at what consequence? Are we talking two or more entries being submitted simultaneously? If there are multi-threads going on here, why two and not more?

Consider the following straight from the registry: {HKCR\Applications\Winamp.exe\shell\Play\command}
"C:\Program Files\Winamp\Winamp.exe" "%1"

Now whether somebody selects one or one hundred files, those all get loaded into %1 and Winamp processes the files sequentially. I don't see any multi-tasking going on here?
Just say HEMP!
#13
Explorer executes the registry command for each file. In this case, the macro is called multiple times, for each file. If it is macro, and it is still processing first file when called for second file, the macro for second file does not run, because two macros cannot run simultaneously. If it is function, and it is still processing first file when called for second file, two instances (threads) run simultaneously. Of course can be more than two. I don't remember what synchronization is used in net, and afraid that it can fail (possibly on the receiving computer) if called simultaneously by several threads. That is why I suggest to use lock. Or use macro with 'Wait' selected in Properties.


Forum Jump:


Users browsing this thread: 1 Guest(s)