Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Findrx Problem.
#1

With the code below I keep receiving the error: Error (RT) in Red Wings: array is not created




Macro ( Red Wings )
Code:
Copy      Help
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
#2
i tryed this and it works perfectly!

Function ( Function )
Code:
Copy      Help
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"
#3

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
#4
Yes i get the same thing...hmm
#5
Please read findrx help. It returns -1 if does not find.
#6

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
#7
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>.
#8

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
#9
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.
#10

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
#11

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
#12

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 )
Code:
Copy      Help
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 )
Code:
Copy      Help
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
#13
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'
#14

Is there something better I should try? I've tried implementing >=o and taking out if. Findrx just aint' my cup of tea Sad.
Taking on Quick Macros one day at a time
#15
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.
#16

Okay, I tried it with find and findw, unfortunately, I recieved the same results.


Macro ( Red Wings )
Code:
Copy      Help
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 )
Code:
Copy      Help
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
#17

Okay, i've given up on this, time to just go to the website and look for the information. Confusedhock:
Taking on Quick Macros one day at a time


Forum Jump:


Users browsing this thread: 1 Guest(s)