mIRC Home    About    Download    Register    News    Help

Print Thread
Need a script to copy a certain part of text #269178 11/07/21 07:08 AM
Joined: Jul 2021
Posts: 3
A
Aeldwulf Offline OP
Self-satisfied door
OP Offline
Self-satisfied door
A
Joined: Jul 2021
Posts: 3
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>
}
} 

Re: Need a script to copy a certain part of text [Re: Aeldwulf] #269180 11/07/21 08:26 AM
Joined: Jan 2021
Posts: 17
N
New_One Offline
Pikka bird
Offline
Pikka bird
N
Joined: Jan 2021
Posts: 17
you can try this one
Code
 on *:text:*:#channel: {
  if  (Alert! isin $1-) {
    /clipboard  $remove($5-,")
  }
} 


Last edited by New_One; 11/07/21 08:29 AM.
Re: Need a script to copy a certain part of text [Re: New_One] #269181 11/07/21 05:57 PM
Joined: Jul 2021
Posts: 3
A
Aeldwulf Offline OP
Self-satisfied door
OP Offline
Self-satisfied door
A
Joined: Jul 2021
Posts: 3
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...

Last edited by Aeldwulf; 11/07/21 07:36 PM.
Re: Need a script to copy a certain part of text [Re: Aeldwulf] #269182 11/07/21 07:34 PM
Joined: Jan 2021
Posts: 17
N
New_One Offline
Pikka bird
Offline
Pikka bird
N
Joined: Jan 2021
Posts: 17
well i see ..
Code
 on *:text:#channel: {
if ($nick == Nickbot) && (Alert!pc isin $1-) {
/clipboard $gettok($1-,2,34)
   }
}

Re: Need a script to copy a certain part of text [Re: New_One] #269184 11/07/21 09:48 PM
Joined: Jul 2021
Posts: 3
A
Aeldwulf Offline OP
Self-satisfied door
OP Offline
Self-satisfied door
A
Joined: Jul 2021
Posts: 3
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"

Re: Need a script to copy a certain part of text [Re: Aeldwulf] #269187 12/07/21 12:42 PM
Joined: Jan 2021
Posts: 17
N
New_One Offline
Pikka bird
Offline
Pikka bird
N
Joined: Jan 2021
Posts: 17
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) 
  }
}

Last edited by New_One; 12/07/21 03:40 PM.