mIRC Homepage
Posted By: craE Need a little help from the great people here. - 19/04/07 01:20 PM
Ok here's the deal i'm trying to write a script to search a website that has music artist profiles cataloged on there now you can search by: All, Artist, Label, Title, Catalogue Number , or Artist 's website. Now the way the site searches the address comes out like this:

For the "All" option it comes up as:

http://www.siteinquestion.com/search/all/"what you searched for"

For the "Artist" option it shows as:

http://www.siteinquestion.com/artist/"what you searched for"

For the "Label" option it shows as:

http://www.siteinquestion.com/search/label/"what you searched for"

For the "Title" option it shows as:

http://www.siteinquestion.com/search/title/"what you searched for"

For the "Catalogue" option it shows as:

http://www.siteinquestion.com/search/catalogue/"what you searched for"

For the "Website" option it shows as:

http://www.siteinquestion.com/search/link/"what you searched for"
----------------------------------------------------------

Now I've written a script already with a little help of copy and paste but this is what I've come up with.

Paste this line under remote:

alias siq { url -an http://www.siteinquestion.com/search/all/ $+ $htmlfrm($1-) }

Paste this code under aliases:

htmlfrm {
var %i = 1,%r
while (%i <= $len($1-)) {
if ($mid($1-,%i,1) isalnum) { %r = %r $+ $v1 }
else { %r = %r $+ % $+ $base($asc($mid($1-,%i,1)),10,16,2) }
inc %i
}
return %r
}
Command :

/siq "place artist name or album name or cat num ectt.. here"
---------------------------------------------------------------
Now their are a few problems with this
1. If there is a space in the name you search for it gives you a 404 error.
2. It only searches the all function I would like to create a dialog that will allow you to choose which option to choose from aswell as a way to write it out in the command line ie:
"/siq label Palm Recordings"

If anyone has any ideas and/or help I would greatly appreciate it and I thank everyone in advance you guys on this site have ALWAYS helped me out and then gave me some of your ideas and added them in and I love the results always you are all a great help and I look forward to seeing the replies!
Quote:
1. If there is a space in the name you search for it gives you a 404 error.
This is an issue with spaces and variables, explained here.

Quote:
2. It only searches the all function I would like to create a dialog that will allow you to choose which option to choose from aswell as a way to write it out in the command line ie:
"/siq label Palm Recordings"
Try this:
Code:
alias siq url -an $+(http://www.siteinquestion.com/search/,$$1,/,$htmlfrm($$2-))
alias htmlfrm return $regsubex($1,/(\W)/g,% $+ $base($asc(\1),10,16,2))

This is the command-line version only, if you want a dialog with options (eg radio buttons) you'll have to learn mirc dialogs, starting by typing /help dialogs
thanks listen i have a few more questions when i save this as a script fomr a friend to load how would i get a splash screen to show that will close when you click it and have a small mp3 file to play with it?
/help on load
/help $input
/help picture windows
/help /splay
if anyone else has any suggestions please feel free to post them and qwerty thanks alot man for that code it did work and is so much smaller than what i was using.
© mIRC Discussion Forums