mIRC Home    About    Download    Register    News    Help

Print Thread
Possible to rename files / images? #248611 13/10/14 06:25 PM
Joined: Aug 2014
Posts: 42
K
Krawalli Offline OP
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Aug 2014
Posts: 42
Hey,
i found the way to rename files ^^
/rename E:\example.txt E:\renamed.txt

Now i want to create with that a script an i stuck at it...
My idea is: i have a Dir with 3 files (1,2,3.png) and want to rename them when someone write:

!test 1 = rename file 1.png to choosen.png
!test 2 = rename file 2.png to choosen.png
!test 3 = rename file 3.png to choosen.png

Important: i need a "backup" function and thats my problem - when someone changed files 3 to choosen it needs to rename back when for example file 2 is changed!

I hope you guys understand what im talkin about laugh
I tryd out and got so far, but i guess its totaly wrong... it isnt working so far.

Code:
on *:TEXT:!test*:#: {
  if (%backup != $null) {
  /rename C:\Users\Computer\Desktop\bla\choosen.png $+(C:\Users\Computer\Desktop\bla\,%backup,.png) 
  set %backup $2
  /rename $+(C:\Users\Computer\Desktop\bla\,$2,.png) C:\Users\Computer\Desktop\bla\choosen.png
 }
 if (%backup == $null) {
  /rename $+(C:\Users\Computer\Desktop\bla\,$2,.png) C:\Users\Computer\Desktop\bla\choosen.png
  set %backup $2
 }
}

Last edited by Krawalli; 13/10/14 07:23 PM.
Re: Possible to rename files / images? [Re: Krawalli] #248643 14/10/14 07:14 PM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Looks fine to me.

What's not happening?

You should maybe check the file exists with $isfile() before you try to /rename anything.