mIRC Homepage

Need a script to copy a certain part of text

Posted By: Aeldwulf

Need a script to copy a certain part of text - 11/07/21 07:08 AM

I have been browsing around in the documentation and I think it may be possible, but I am unsure.

I need a script that will copy a particular section of a phrase when it pops up in chat.
Example:
Code
MessageBot: Alert! User is in "Phoenix Arizona"

The script will then automatically copy "Phoenix Arizona" to the clipboard (without the quotes)

Another Example:
Code
MessageBot: Alert! User is in "San Diego California"

The script will then automatically copy "San Diego California" to the clipboard (without the quotes)

How do I go about doing this? So far I understand it as:

Code
On *:Text:*:#:{ 
if (Alert! isin $1-) {
 <copy only text between " " to clipboard>
}
} 
Posted By: New_One

Re: Need a script to copy a certain part of text - 11/07/21 08:26 AM

you can try this one
Code
 on *:text:*:#channel: {
  if  (Alert! isin $1-) {
    /clipboard  $remove($5-,")
  }
} 

Posted By: Aeldwulf

Re: Need a script to copy a certain part of text - 11/07/21 05:57 PM

Originally Posted by New_One
you can try this one
Code
 on *:text:*:#channel: {
  if  (Alert! isin $1-) {
    /clipboard  $remove($5-,")
  }
} 




okay so the command I needed to copy from is:

Code
ALERT!Case #8 PC (Odyssey) – CMDR ashzv – System: "TASCHETER SECTOR FB-X A1-0" (Brown dwarf 105.5 LY from Sol) – Language: English (United States) (en-US) (PC_SIGNAL)


and that managed to copy
Code
(7Odyssey) – CMDR ashzv – System: TASCHETER SECTOR FB-X A1-0 (Brown dwarf 105.5 LY from Sol) – Language: English (United States) (en-US) (PC_SIGNAL)


I need it to only copy
Code
TASCHETER SECTOR FB-X A1-0


I feel like its getting there, just need to figure this small last part out...
Posted By: New_One

Re: Need a script to copy a certain part of text - 11/07/21 07:34 PM

well i see ..
Code
 on *:text:#channel: {
if ($nick == Nickbot) && (Alert!pc isin $1-) {
/clipboard $gettok($1-,2,34)
   }
}
Posted By: Aeldwulf

Re: Need a script to copy a certain part of text - 11/07/21 09:48 PM

It still isn't grabbing what is ONLY between the quotes.

Bot msg that popped up:
Code
<%Nickbot> Alert! Case #1 PC – CMDR Marcallus – System: "KOTENBU" (Invalid system name) – Language: English (United States) (en-US) (PC_SIGNAL)

what it copied:
Code
– CMDR Marcallus – System: KOTENBU (4Invalid system name) – Language: English (United States) (en-US) (PC_SIGNAL)


It should have only copied KOTENBU

hmm crazy Has to be a way, right? The message that comes up from Nickbot is always different, but it always has key parts that remain. like PC and the System: "name stuff here changes"
Posted By: New_One

Re: Need a script to copy a certain part of text - 12/07/21 12:42 PM

Originally Posted by Aeldwulf
It still isn't grabbing what is ONLY between the quotes.

Bot msg that popped up:
Code
<%Nickbot> Alert! Case #1 PC – CMDR Marcallus – System: "KOTENBU" (Invalid system name) – Language: English (United States) (en-US) (PC_SIGNAL)

what it copied:
Code
– CMDR Marcallus – System: KOTENBU (4Invalid system name) – Language: English (United States) (en-US) (PC_SIGNAL)


It should have only copied KOTENBU

hmm crazy Has to be a way, right? The message that comes up from Nickbot is always different, but it always has key parts that remain. like PC and the System: "name stuff here changes"


well if you make that //echo $gettok(Alert! Case #1 PC – CMDR Marcallus – System: "KOTENBU" (Invalid system name) – Language: English (United States) (en-US) (PC_SIGNAL),2,34) you will see KOTENBU , i don't know why its not working on you , maybe you should take the lastet version of mIRC v.7.66 or 7.65
try to make it like this to see what happen
Code
 on *:text:*:# {
if ($nick == NickBot) && (Alert! isin $1) {
msg Yournick(or #youchannel) i make a copy to $gettok($1-,2,34) 
  }
}
© 2021 mIRC Discussion Forums