It is currently March 29th, 2024, 9:04 am

[SOLVED]Problem with a Bang in LUA that works half of the ti

Discuss the use of Lua in Script measures.
Bezerker
Posts: 7
Joined: May 9th, 2013, 12:52 pm

[SOLVED]Problem with a Bang in LUA that works half of the ti

Post by Bezerker »

I just found the Rainmeter program the other day and am very excited to get going with it and refresh my rusty scripting skills but im hitting a wierd wall here so i hope someone can help me.

Im tinkering about in an old utorrent skin that uses a lua script for API download from the webui. Sofar all my modifications are working great except one. I added a LeftMouseUp action to the name of the torrent file based on the savedpath variable obtained from the utorrent API.

Code: Select all

SKIN:Bang("!SetOption Meter"..tTORRENTQUEUEORDER[i].."Name Text \""..tNAME[i].."\"")
SKIN:Bang("!SetOption Meter"..tTORRENTQUEUEORDER[i].."Name LeftMouseUpAction "..tSAVEFOLDER[i])
This is what i have setup for the name of the torrent but now the problem is when i add a torrent that doesnt have a directory structure in itself which in my case get dropped into "D:\Downloads\ActiveDL\" it works perfect and opens the folder when i click on the torrent name.
However if the torrent uses a parent directory so i get something like "D:\Downloads\ActiveDL\something.HD-(2013)\"
Then the click option doesnt get added to the torrent name so i have nothing to open.

I tried using the specific directory links directly in the skin ini and works fine in there.
Tried various parent folder options with and without extra signs like . - ( [ ect... in the LUA but under no circumstance will it add the link option to the torrent name.

I bet its something really simple im completely overlooking or some limitation im not aware of
Last edited by Bezerker on May 10th, 2013, 3:26 pm, edited 2 times in total.
Bezerker
Posts: 7
Joined: May 9th, 2013, 12:52 pm

Re: Problem with a Bang in LUA that works half of the time

Post by Bezerker »

After some more trouble shooting and checking the log entries which were looking like this

Error -> Bang: Skin "something" not found
(note only for files with a parent directory)

I then changed the Bang line to

Code: Select all

SKIN:Bang("!SetOption Meter"..tTORRENTQUEUEORDER[i].."Name LeftMouseUpAction \""..tSAVEFOLDER[i].."\"")
With this the error goes away and on screen i now get the mousecursor to change to a hand icon but still no luck in actually opening the link.

Links to torrent without a parent directory going to "D:\Downloads\ActiveDL\" are still working perfectly.

Anyone have any idea's?
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Problem with a Bang in LUA that works half of the time

Post by smurfier »

Try this:
SKIN:Bang('!SetOption', 'Meter' .. tTORRENTQUEUEORDER[i] .. 'Name', 'LeftMouseUpAction', '[' .. tSAVEFOLDER[i] .. ']')
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
Bezerker
Posts: 7
Joined: May 9th, 2013, 12:52 pm

Re: Problem with a Bang in LUA that works half of the time

Post by Bezerker »

smurfier wrote:Try this:
SKIN:Bang('!SetOption', 'Meter' .. tTORRENTQUEUEORDER[i] .. 'Name', 'LeftMouseUpAction', '[' .. tSAVEFOLDER[i] .. ']')
Thanks for the reply.
I gave it a go and no luck sadly.
No log error's and it still runs as i explained earlier
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Problem with a Bang in LUA that works half of the time

Post by smurfier »

I recommend that you do two different things. Use print('[' .. tSAVEFOLDER[i] .. ']') to see what is actually being set. It will display in the About dialog. Then if it is displaying correctly, copy and paste the string directly onto the meter and see if that works.
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
Bezerker
Posts: 7
Joined: May 9th, 2013, 12:52 pm

Re: Problem with a Bang in LUA that works half of the time

Post by Bezerker »

Usefull trick printing to the logs. i use a bang to push the variable string to an output text in the ini file
Anyway did as asked and heres what i got

With parent directory from a test torrent output =
[D:\Downloads\ActiveDL\Re-Generator 2013 DVDRip Xvid UnKnOwN]
Used this in ini file with no response to opening the folder
LeftMouseUpAction=[D:\Downloads\ActiveDL\Re-Generator 2013 DVDRip Xvid UnKnOwN]

Without a parent directory from a test torrent output =
[D:\Downloads\ActiveDL]
Used this in ini file and worked like a charm to open the folder
LeftMouseUpAction=[D:\Downloads\ActiveDL]

Now in the same light i created a dummy folder and tried the link in the ini
LeftMouseUpAction=[D:\Downloads\ActiveDL\regenerator] works
LeftMouseUpAction=[D:\Downloads\ActiveDL\re-generator] works
LeftMouseUpAction=[D:\Downloads\ActiveDL\re-generator.test] works
LeftMouseUpAction=[D:\Downloads\ActiveDL\re-generator test] fails

So it would seem that a space will make it fail.
In my initial post i didnt think about testing spaces but did every other char possible so thats where i went wrong to start with.
Is there anyway around this like using a string.gsub to replace the spaces with something that would work without changing the physical save folder path?
Last edited by Bezerker on May 10th, 2013, 3:13 pm, edited 1 time in total.
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Problem with a Bang in LUA that works half of the time

Post by smurfier »

Just need to add some quotes. Try this instead:

SKIN:Bang('!SetOption', 'Meter' .. tTORRENTQUEUEORDER[i] .. 'Name', 'LeftMouseUpAction', '["' .. tSAVEFOLDER[i] .. '"]')
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
Bezerker
Posts: 7
Joined: May 9th, 2013, 12:52 pm

Re: Problem with a Bang in LUA that works half of the time

Post by Bezerker »

HA i knew it had to be something simple that definitely did the trick
Thank you very much!!