Posts: 473
Threads: 33
Joined: Aug 2007
With the code below I keep receiving the error: Error (RT) in Red Wings: array is not created
Macro ( Red Wings )
str Src Message url
ARRAY(str) Game
url.from("http://redwings.nhl.com/")
IntGetFile url Src
Src.setclip
if findrx(Src "<DIV class=teamName></DIV>" 0 0 Game)
,Message.formata("%s %s" "Red wings vs. " Game[1])
,mes Message "Red wings Game" "isa"
Any idea why? I tried removing the [1] from game and then the message will work but I receive the word [null], instead of the team thats playing.
Taking on Quick Macros one day at a time
Posts: 576
Threads: 97
Joined: Aug 2007
i tryed this and it works perfectly!
Function ( Function )
str Src Message url
ARRAY(str) Game
url.from("http://redwings.nhl.com/")
IntGetFile url Src
Src.setclip
if findrx(Src "<DIV class=teamName></DIV>" 0 0 Game)
,Message.formata("%s %s" "Red wings vs. " Game)
,mes Message "Red wings Game" "isa"
Posts: 473
Threads: 33
Joined: Aug 2007
I get the message but I dont recieve the team there playing. I get Redwings vs. [null].
Taking on Quick Macros one day at a time
Posts: 576
Threads: 97
Joined: Aug 2007
Yes i get the same thing...hmm
Posts: 12,140
Threads: 142
Joined: Dec 2002
Please read findrx help. It returns -1 if does not find.
Posts: 473
Threads: 33
Joined: Aug 2007
I understood that, but I was just confused on why it wasn't finding anything. I just can't get the hang of findrx.
Taking on Quick Macros one day at a time
Posts: 12,140
Threads: 142
Joined: Dec 2002
It isn't there. I pasted in wordpad and tried to find <DIV class=teamName></DIV>, and it did not find. But there is <div class="teamName">Los Angeles</div>.
Posts: 473
Threads: 33
Joined: Aug 2007
Yeah, I removed the actual teams name from there, because I was trying to have the macro find out who they were playing and paste it in a message, but its not going to be Los Angeles every time. Thats why I was confused why I was not getting anything back. Is it a necessity to keep the actual teams name in there?
Taking on Quick Macros one day at a time
Posts: 12,140
Threads: 142
Joined: Dec 2002
In regular expressions unknown text is replaces to special characters. It is similar to when you press Win+F and want to find any file that ends with .gif you type *.gif.
Posts: 473
Threads: 33
Joined: Aug 2007
Oh I see, so there is probably a special character to find the team name? I'll look through it again and see if I can find something. Thanks.
Taking on Quick Macros one day at a time
Posts: 473
Threads: 33
Joined: Aug 2007
Hmmm, I tried it on one of the pictures, but it says too many parts, and when I trimmed it down it couldn't find it. It's no biggie, I was just bored so I was experimenting. :?
Taking on Quick Macros one day at a time
Posts: 473
Threads: 33
Joined: Aug 2007
Going back to this, anyone good with findrx want to help me out? I'm struggling to get this to find the information, and i'm not sure what i'm doing wrong.
Macro ( Red Wings )
str Src Message url
ARRAY(str) Game
url.from("http://redwings.nhl.com/")
IntGetFile url Src
Src.setclip
if findrx(Src "<DIV class=teamName></DIV>" 0 0 Game)
,Message.formata("%s %s" "Red wings vs." Game)
,mes Message "Red wings Game" "isa"
And here I tried it with the other Teams name, yet it still doesn't find the text.
Macro ( Red Wings )
str Src Message url
ARRAY(str) Game
url.from("http://redwings.nhl.com/")
IntGetFile url Src
Src.setclip
if findrx(Src "<DIV class=teamName>Colorado</DIV>" 0 0 Game)
,Message.formata("%s %s" "Red wings vs." Game)
,mes Message "Red wings Game" "isa"
Any help is greatly appreciated.
Taking on Quick Macros one day at a time
Posts: 12,140
Threads: 142
Joined: Dec 2002
Because findrx returns 0-based character index, or -1 if not found,
if findrx(...) means 'if found not at the beginning or not found at all'
if findrx(...)>=0 means 'if found'
Posts: 473
Threads: 33
Joined: Aug 2007
Is there something better I should try? I've tried implementing >=o and taking out if. Findrx just aint' my cup of tea
.
Taking on Quick Macros one day at a time
Posts: 12,140
Threads: 142
Joined: Dec 2002
In your example I don't see regular expression special characters. It is simple string. You can use find instead. The result will be the same.
Posts: 473
Threads: 33
Joined: Aug 2007
Okay, I tried it with find and findw, unfortunately, I recieved the same results.
Macro ( Red Wings )
str Src Message url
ARRAY(str) Game
url.from("http://redwings.nhl.com/")
IntGetFile url Src
Src.setclip
find(Src "<DIV class=teamName></DIV>" 0 Game)
,Message.formata("%s %s" "Red wings vs." Game)
,mes Message "Red wings Game" "isa"
And once again I tried it with the teams name inside and without the teams name.
Macro ( Red Wings )
str Src Message url
ARRAY(str) Game
url.from("http://redwings.nhl.com/")
IntGetFile url Src
Src.setclip
find(Src "<DIV class=teamName>Colorado</DIV>" 0 Game)
,Message.formata("%s %s" "Red wings vs." Game)
,mes Message "Red wings Game" "isa"
Taking on Quick Macros one day at a time
Posts: 473
Threads: 33
Joined: Aug 2007
Okay, i've given up on this, time to just go to the website and look for the information.
hock:
Taking on Quick Macros one day at a time