| Register Log In | ForumsActive ThreadsSearchWho's OnlineHelp |
| ![Run scripts from a different file (1) Run scripts from a different file (1)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==)
Run scripts from a different file #23958209/11/12 07:47 AM | Joined: Nov 2012 Posts: 18 Judgebot OP Pikka bird | OP![Run scripts from a different file (3) Run scripts from a different file (3)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) Pikka bird Joined: Nov 2012 Posts: 18 | What sample of code would I use to run set commands in a different file, even though I have a 'master' file with the main commands in it. |
![Run scripts from a different file (4) Run scripts from a different file (4)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==)
Re: Run scripts from a different file Judgebot#23958409/11/12 11:15 AM | Joined: Oct 2004 Posts: 8,330 Riamus2![Run scripts from a different file (6) Run scripts from a different file (6)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) Hoopy frood | ![Run scripts from a different file (7) Run scripts from a different file (7)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) Hoopy frood Joined: Oct 2004 Posts: 8,330 | Just $read the file. Without the n parameter in $read, it will evaluate anything that is read. Be very careful doing that if anyone has access to write something to the file besides you. Doing that sort of thing can be a significant security risk. Invision Support #Invision on irc.irchighway.net
|
![Run scripts from a different file (9) Run scripts from a different file (9)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==)
Re: Run scripts from a different file Riamus2#23958509/11/12 03:06 PM | Joined: Nov 2012 Posts: 18 Judgebot OP Pikka bird | OP![Run scripts from a different file (11) Run scripts from a different file (11)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) Pikka bird Joined: Nov 2012 Posts: 18 | So what would the code be like? $read C:\file.text ? |
![Run scripts from a different file (12) Run scripts from a different file (12)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==)
Re: Run scripts from a different file Judgebot#23959009/11/12 06:07 PM | Joined: Oct 2004 Posts: 8,330 Riamus2![Run scripts from a different file (14) Run scripts from a different file (14)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) Hoopy frood | ![Run scripts from a different file (15) Run scripts from a different file (15)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) Hoopy frood Joined: Oct 2004 Posts: 8,330 | For syntax and examples: /help $read Again, be aware that running commands this way leaves you open to security risks if you aren't careful. Never run a command from a file that people can write to. Edit: I thought $read() was a little less secure. After I had a chance to test, simply using $read isn't quite enough, but here's one option: Code: alias command { noop $read(commands.txt,w,$1*)} commands.txt file: Quote: echo_hello | echo -a hello echo_bye | echo -a bye
Use: /command echo_hello /command echo_bye You can set the text file up with a command name to use followed by a pipe character and then followed by the command. The just specify the command name when using the command as shown and it will run the command in the text file that matches the command name you used. You would of course have to adjust this to fit your needs. It's just a basic example. Last edited by Riamus2; 09/11/12 06:22 PM. Invision Support #Invision on irc.irchighway.net
|
![Run scripts from a different file (17) Run scripts from a different file (17)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==)
Re: Run scripts from a different file Riamus2#23959309/11/12 06:59 PM | Joined: Nov 2012 Posts: 18 Judgebot OP Pikka bird | OP![Run scripts from a different file (19) Run scripts from a different file (19)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) Pikka bird Joined: Nov 2012 Posts: 18 | |
![Run scripts from a different file (20) Run scripts from a different file (20)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==)
Re: Run scripts from a different file Judgebot#23960209/11/12 09:04 PM | Joined: Nov 2006 Posts: 1,559 Horstl![Run scripts from a different file (21) Run scripts from a different file (21)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) Hoopy frood | ![Run scripts from a different file (22) Run scripts from a different file (22)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) Hoopy frood Joined: Nov 2006 Posts: 1,559 | Or use the /play command and the -c switch. With /play, you don't need that external alias and the other switches allow you to set further parameters, if required. |
![Run scripts from a different file (23) Run scripts from a different file (23)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==)
Re: Run scripts from a different file Horstl#23960510/11/12 12:29 AM | Joined: Nov 2012 Posts: 18 Judgebot OP Pikka bird | OP![Run scripts from a different file (25) Run scripts from a different file (25)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) Pikka bird Joined: Nov 2012 Posts: 18 | Originally Posted By: Horstl Or use the /play command and the -c switch. With /play, you don't need that external alias and the other switches allow you to set further parameters, if required. Do you have an example/snippet of code that i could look at? |
![Run scripts from a different file (26) Run scripts from a different file (26)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==)
Re: Run scripts from a different file Judgebot#23961110/11/12 11:42 AM | Joined: Nov 2006 Posts: 1,559 Horstl![Run scripts from a different file (27) Run scripts from a different file (27)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) Hoopy frood | ![Run scripts from a different file (28) Run scripts from a different file (28)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) Hoopy frood Joined: Nov 2006 Posts: 1,559 | Create for instance a file "example.txt" and add a set of commands to it: Code: window -a "status window" | echo -st starting exampleecho -s ...minimizing and restoring mIRC...showmirc -nshowmirc -recho -st done! Now within mIRC, if you use the following command: Code: /.play -spc "example.txt" 500 mIRC will execute all commands in that file. Of course you can put the play command inside a custom alias like: Code: alias example { .play -spc "example.txt" 500 } The -c switch tells mIRC to treat all the line in the file as commmands. The -p switch tells mIRC to give priority to this play request (just in case there are other playbacks running at the moment). Note that /play requires some target window, therefore I put the -s switch (in mIRC, there will always be a status window). "500" specifies the per-line playback delay in milliseconds, i.e. the time offset between the different command lines of your file. Note that as the first line in example.txt has two commands on it, there will be no delay in-between the two. You can put "0" for delay to have mIRC execute all the commands without any line delay. The play command syntax is documented in detail at "playing files" in your mIRC helpfile. For example, you could use an ini-file and have mIRC play a given topic (as the command register, with one or more command line associated to it). |
![Run scripts from a different file (29) Run scripts from a different file (29)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==)
Re: Run scripts from a different file Horstl#23961210/11/12 12:33 PM | Joined: Nov 2012 Posts: 18 Judgebot OP Pikka bird | OP![Run scripts from a different file (31) Run scripts from a different file (31)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) Pikka bird Joined: Nov 2012 Posts: 18 | Originally Posted By: Horstl Create for instance a file "example.txt" and add a set of commands to it: Code: window -a "status window" | echo -st starting exampleecho -s ...minimizing and restoring mIRC...showmirc -nshowmirc -recho -st done! Now within mIRC, if you use the following command: Code: /.play -spc "example.txt" 500 mIRC will execute all commands in that file. Of course you can put the play command inside a custom alias like: Code: alias example { .play -spc "example.txt" 500 } The -c switch tells mIRC to treat all the line in the file as commmands. The -p switch tells mIRC to give priority to this play request (just in case there are other playbacks running at the moment). Note that /play requires some target window, therefore I put the -s switch (in mIRC, there will always be a status window). "500" specifies the per-line playback delay in milliseconds, i.e. the time offset between the different command lines of your file. Note that as the first line in example.txt has two commands on it, there will be no delay in-between the two. You can put "0" for delay to have mIRC execute all the commands without any line delay. The play command syntax is documented in detail at "playing files" in your mIRC helpfile. For example, you could use an ini-file and have mIRC play a given topic (as the command register, with one or more command line associated to it). So there has to be a separate text file for every external command? you can't compile them into one external file? |
![Run scripts from a different file (32) Run scripts from a different file (32)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==)
Re: Run scripts from a different file Judgebot#23963912/11/12 04:13 AM | Joined: Nov 2006 Posts: 1,559 Horstl![Run scripts from a different file (33) Run scripts from a different file (33)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) Hoopy frood | ![Run scripts from a different file (34) Run scripts from a different file (34)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) Hoopy frood Joined: Nov 2006 Posts: 1,559 | Not if you use the .ini file structure. You could place every command (or set of commands) under a distinct [topic] header of a single .ini file. What goal are you trying to attain by out-sourcing your commands, if I may ask?
|
![Run scripts from a different file (35) Run scripts from a different file (35)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==)
Re: Run scripts from a different file Horstl#23964712/11/12 03:59 PM | Joined: Nov 2012 Posts: 18 Judgebot OP Pikka bird | OP![Run scripts from a different file (37) Run scripts from a different file (37)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) Pikka bird Joined: Nov 2012 Posts: 18 | Originally Posted By: Horstl Not if you use the .ini file structure. You could place every command (or set of commands) under a distinct [topic] header of a single .ini file. What goal are you trying to attain by out-sourcing your commands, if I may ask? Say i give someone access to a file called "user1.txt(/.ini)" then they have access to add command to that file. But then i'd want the main file "remote.ini" to use the commands in that file for said channel. Then it would go on to add more external files such as user2,3,4,5,6... The main file structure would then be something like Code: on *:text:*:#: { if ( $chan == #user1 ) { $read(user1.txt) }}on *:text:*:#: { if ( $chan == #user2 ) { $read(user2.txt) }} and so on, permissions and commands would be pulled from the different files. I'd like the commands in each external file to look like: Code: on *:text:*!commandexample*:#: { msg $chan command example} this is a command example which it would look like in each file. So standard command format. Last edited by Judgebot; 12/11/12 04:02 PM. |
![Run scripts from a different file (38) Run scripts from a different file (38)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==)
Re: Run scripts from a different file Judgebot#23965412/11/12 11:24 PM | Joined: Oct 2004 Posts: 8,330 Riamus2![Run scripts from a different file (40) Run scripts from a different file (40)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) Hoopy frood | ![Run scripts from a different file (41) Run scripts from a different file (41)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) Hoopy frood Joined: Oct 2004 Posts: 8,330 | You wouldn't be able to use event syntax like that. At least, not without considerable work, or unless you want to load the file and use it that way as just another script file. As far as what you are attempting, you should absolutely never do this. Consider what happens if someone decides it would be "fun" to put in a command to delete things from your computer or grab your password file from your browser or other history and cookie information from you browser and download it? It would be VERY easy for someone to do basically anything they wanted to your computer. And with that kind of control, they could make it so you don't even notice... write the command to do what they want, then change it back to something innocuous until they are ready to do something bad again. Never, never, never let someone create their own command on your computer and execute it. This is a really dangerous idea for a script. Unless you and only you have access to write commands, or you can absolutely trust those who have access (I wouldn't trust anyone besides very close family and perhaps very close real life friends). It would never be a good idea to give that kind of control to anyone you meet online no matter how good you think you know them. Invision Support #Invision on irc.irchighway.net
|
![Run scripts from a different file (43) Run scripts from a different file (43)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==)
Re: Run scripts from a different file Riamus2#23967413/11/12 12:49 PM | Joined: Nov 2012 Posts: 18 Judgebot OP Pikka bird | OP![Run scripts from a different file (45) Run scripts from a different file (45)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) Pikka bird Joined: Nov 2012 Posts: 18 | Originally Posted By: Riamus2 You wouldn't be able to use event syntax like that. At least, not without considerable work, or unless you want to load the file and use it that way as just another script file. As far as what you are attempting, you should absolutely never do this. Consider what happens if someone decides it would be "fun" to put in a command to delete things from your computer or grab your password file from your browser or other history and cookie information from you browser and download it? It would be VERY easy for someone to do basically anything they wanted to your computer. And with that kind of control, they could make it so you don't even notice... write the command to do what they want, then change it back to something innocuous until they are ready to do something bad again. Never, never, never let someone create their own command on your computer and execute it. This is a really dangerous idea for a script. Unless you and only you have access to write commands, or you can absolutely trust those who have access (I wouldn't trust anyone besides very close family and perhaps very close real life friends). It would never be a good idea to give that kind of control to anyone you meet online no matter how good you think you know them. Ok, so is there a script snippet that does: Code: !addcommand isop !command command example Code: !addcommand public !command command example !addcommand = the script isop/public = the permissions !command = the command you want adding (trigger) command example = the text of the command (reply) isop: public: Code: on *:text:*!command*:#:{ msg $chan command example } |
![Run scripts from a different file (46) Run scripts from a different file (46)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==)
Re: Run scripts from a different file Judgebot#23968313/11/12 11:05 PM | Joined: Sep 2005 Posts: 2,881 hixxy![Run scripts from a different file (47) Run scripts from a different file (47)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) Hoopy frood | ![Run scripts from a different file (48) Run scripts from a different file (48)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) Hoopy frood Joined: Sep 2005 Posts: 2,881 | Do you just want the script to be able to send messages or does it have to be able to execute other commands? If the former, there's a much easier (and better) way of achieving what you want. |
![Run scripts from a different file (49) Run scripts from a different file (49)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==)
Re: Run scripts from a different file hixxy#23969314/11/12 03:48 PM | Joined: Nov 2012 Posts: 18 Judgebot OP Pikka bird | OP![Run scripts from a different file (51) Run scripts from a different file (51)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) Pikka bird Joined: Nov 2012 Posts: 18 | Originally Posted By: hixxy Do you just want the script to be able to send messages or does it have to be able to execute other commands? If the former, there's a much easier (and better) way of achieving what you want. I'd like a way of someone else adding commands to the bot, without them touching/giving me the command script to be added. So any way of doing that (pretty much) I would be great full |
![Run scripts from a different file (52) Run scripts from a different file (52)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==)
Re: Run scripts from a different file Judgebot#23969414/11/12 06:07 PM | Joined: Feb 2003 Posts: 3,432 sparta![Run scripts from a different file (53) Run scripts from a different file (53)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) Hoopy frood | ![Run scripts from a different file (54) Run scripts from a different file (54)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) Hoopy frood Joined: Feb 2003 Posts: 3,432 | You can yes, but it's a bad bad idea, i could format your whole computer (or worse) if you give that type of access so it's not a good idea. Last edited by sparta; 14/11/12 06:08 PM. if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) } |
![Run scripts from a different file (55) Run scripts from a different file (55)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==)
Re: Run scripts from a different file sparta#23969814/11/12 11:57 PM | Joined: Nov 2012 Posts: 18 Judgebot OP Pikka bird | OP![Run scripts from a different file (57) Run scripts from a different file (57)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) Pikka bird Joined: Nov 2012 Posts: 18 | Originally Posted By: sparta You can yes, but it's a bad bad idea, i could format your whole computer (or worse) if you give that type of access so it's not a good idea. I'd still like to see this script/code please. the bot is running on a server and all of the programs are backup-ed away from the computer |
![Run scripts from a different file (58) Run scripts from a different file (58)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==)
Re: Run scripts from a different file Judgebot#23970715/11/12 11:19 AM | Joined: Oct 2004 Posts: 8,330 Riamus2![Run scripts from a different file (60) Run scripts from a different file (60)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) Hoopy frood | ![Run scripts from a different file (61) Run scripts from a different file (61)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) Hoopy frood Joined: Oct 2004 Posts: 8,330 | You know that the things people can do aren't limited to just that computer, right? If you're on a home network, they can gain access to other computers on the network. They can also easily get you banned from the IRC network and can send out viruses to people from your computer. They can also very easily set your computer up (outside of mIRC) to do things it shouldn't, such as passing on viruses or doing DDOS attacks on places. You are attempting to make it possible for someone to do anything they want from your computer as if they were sitting at the computer itself. This goes beyond whether you have a backup on that computer. It is just a really bad idea. Invision Support #Invision on irc.irchighway.net
|
![Run scripts from a different file (63) Run scripts from a different file (63)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==)
Re: Run scripts from a different file Riamus2#23970815/11/12 08:25 PM | Joined: Nov 2012 Posts: 18 Judgebot OP Pikka bird | OP![Run scripts from a different file (65) Run scripts from a different file (65)](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==) Pikka bird Joined: Nov 2012 Posts: 18 | Originally Posted By: Riamus2 You know that the things people can do aren't limited to just that computer, right? If you're on a home network, they can gain access to other computers on the network. They can also easily get you banned from the IRC network and can send out viruses to people from your computer. They can also very easily set your computer up (outside of mIRC) to do things it shouldn't, such as passing on viruses or doing DDOS attacks on places. You are attempting to make it possible for someone to do anything they want from your computer as if they were sitting at the computer itself. This goes beyond whether you have a backup on that computer. It is just a really bad idea. The bot is used on TwitchTv, and I have spoken and know the twitch admins and they know me and the people who the bot will first be used for. |
| Forum Rules ·Mark All ReadContact Us·Help·mIRC Homepage | | |