Jump to content




Help again


11 replies to this topic

#1 Leon669

  • Members
  • 57 posts
  • LocationGermany

Posted 21 February 2015 - 09:09 PM

shell.run"clear"
term.setBackgroundColor(colors.lightGray)
term.setTextColor(colors.white)
shell.run"clear"
---
Bild = paintutils.loadImage("OS/program.img")
paintutils.drawImage(Bild,1,1)
---

term.setCursorPos(1,7)
term.setBackgroundColor(colors.lightGray)

print("Enter name of the Background you want to choose")
print("")
write("Name:")

name = io.read()

shell.run"cd //"
shell.run"cd BG"

shell.run('rom/programs/move/', name..'OS/d1.img') -- why doesnt work this ? The picture exist

--shell.run"cd .."
--shell.run"cd OS"
--shell.run"desktop"

Edited by Leon669, 21 February 2015 - 09:10 PM.


#2 valithor

  • Members
  • 1,053 posts

Posted 21 February 2015 - 09:14 PM

the program rom/programs/move requires 2 arguments you only pass it one. It requires the file you want to move and where to move it, and you only supplied the file you want to move.

shell.run('rom/programs/move',name..'OS/d1.img',targetfile)

Even though you can accomplish what you want to do using shell.run you could also accomplish it using the fs api.

 fs.move('OS/d1.img',targetfile)


#3 Leon669

  • Members
  • 57 posts
  • LocationGermany

Posted 21 February 2015 - 09:26 PM

View Postvalithor, on 21 February 2015 - 09:14 PM, said:

the program rom/programs/move requires 2 arguments you only pass it one. It requires the file you want to move and where to move it, and you only supplied the file you want to move.

shell.run('rom/programs/move',name..'OS/d1.img',targetfile)

Even though you can accomplish what you want to do using shell.run you could also accomplish it using the fs api.

 fs.move('OS/d1.img',targetfile)

print("Enter name of the Background you want to choose")
print("")
write("Name:")

name = io.read()

shell.run"cd //"
shell.run"cd BG"

fs.move("name", "OS/d1.img")

nothing happend error no such file

#4 valithor

  • Members
  • 1,053 posts

Posted 21 February 2015 - 09:29 PM

View PostLeon669, on 21 February 2015 - 09:26 PM, said:

View Postvalithor, on 21 February 2015 - 09:14 PM, said:

the program rom/programs/move requires 2 arguments you only pass it one. It requires the file you want to move and where to move it, and you only supplied the file you want to move.

shell.run('rom/programs/move',name..'OS/d1.img',targetfile)

Even though you can accomplish what you want to do using shell.run you could also accomplish it using the fs api.

 fs.move('OS/d1.img',targetfile)

print("Enter name of the Background you want to choose")
print("")
write("Name:")

name = io.read()

shell.run"cd //"
shell.run"cd BG"

fs.move("name", "OS/d1.img")

nothing happend error no such file

Its the file you want to move and then where you want to move it. In that example you are trying to move the file "name" to "OS/d1.img" I am assuming you want to move "OS/d1.img" to "name", so you would want to do this

fs.move("OS/d1.img",name) --name without "" since it is a variable

Edited by valithor, 21 February 2015 - 09:29 PM.


#5 Leon669

  • Members
  • 57 posts
  • LocationGermany

Posted 21 February 2015 - 09:37 PM

View Postvalithor, on 21 February 2015 - 09:29 PM, said:

View PostLeon669, on 21 February 2015 - 09:26 PM, said:

View Postvalithor, on 21 February 2015 - 09:14 PM, said:

the program rom/programs/move requires 2 arguments you only pass it one. It requires the file you want to move and where to move it, and you only supplied the file you want to move.

shell.run('rom/programs/move',name..'OS/d1.img',targetfile)

Even though you can accomplish what you want to do using shell.run you could also accomplish it using the fs api.

 fs.move('OS/d1.img',targetfile)

print("Enter name of the Background you want to choose")
print("")
write("Name:")

name = io.read()

shell.run"cd //"
shell.run"cd BG"

fs.move("name", "OS/d1.img")

nothing happend error no such file

Its the file you want to move and then where you want to move it. In that example you are trying to move the file "name" to "OS/d1.img" I am assuming you want to move "OS/d1.img" to "name", so you would want to do this

fs.move("OS/d1.img",name) --name without "" since it is a variable

no such file ..
I want to move my name variable to d1.img

Edited by Leon669, 21 February 2015 - 09:44 PM.


#6 Leon669

  • Members
  • 57 posts
  • LocationGermany

Posted 21 February 2015 - 09:48 PM

So i have change it to
fs.move(name,"OS/d1.img")

but still no such file

Edited by Leon669, 21 February 2015 - 09:56 PM.


#7 valithor

  • Members
  • 1,053 posts

Posted 21 February 2015 - 10:11 PM

View PostLeon669, on 21 February 2015 - 09:48 PM, said:

So i have change it to
fs.move(name,"OS/d1.img")

but still no such file

You still have it backwards...

name is LAST

its fs.move("OS/d1.img",name)

notice name is after "OS/d1.img" not before

#8 Leon669

  • Members
  • 57 posts
  • LocationGermany

Posted 21 February 2015 - 10:16 PM

View Postvalithor, on 21 February 2015 - 10:11 PM, said:

View PostLeon669, on 21 February 2015 - 09:48 PM, said:

So i have change it to
fs.move(name,"OS/d1.img")

but still no such file

You still have it backwards...

name is LAST

its fs.move("OS/d1.img",name)

notice name is after "OS/d1.img" not before

No such file ..

again that we do not talk past each other, I would like the input name Renaming in d1.img

#9 Leon669

  • Members
  • 57 posts
  • LocationGermany

Posted 21 February 2015 - 10:37 PM

anybody ?

#10 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 21 February 2015 - 10:38 PM

View PostLeon669, on 21 February 2015 - 10:37 PM, said:

anybody ?

I'm not really sure what the problem is here, or what you are trying to accomplish. If you'd fill me in, I'd be happy to help.

#11 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 21 February 2015 - 10:44 PM

fs.move requires absolute paths, so you need to use fs.combine to tack on the first part of the path:

fs.move(fs.combine("/BG", name), "/OS/d1.img")


#12 Leon669

  • Members
  • 57 posts
  • LocationGermany

Posted 21 February 2015 - 10:50 PM

View PostKingofGamesYami, on 21 February 2015 - 10:38 PM, said:

View PostLeon669, on 21 February 2015 - 10:37 PM, said:

anybody ?

I'm not really sure what the problem is here, or what you are trying to accomplish. If you'd fill me in, I'd be happy to help.

The programm should change the background in the desktop. To do that there are two programmes one with witch one you create your custom background,and save it in the dir BG, that works fine. The other programm where the problem is should remove the old background d1.img is the name of it (that works), and rename (one file that have you painted and is in your BG dir) in d1.img so taht you have changed the background with your painted file.

View PostLyqyd, on 21 February 2015 - 10:44 PM, said:

fs.move requires absolute paths, so you need to use fs.combine to tack on the first part of the path:

fs.move(fs.combine("/BG", name), "/OS/d1.img")

It works thx man you save my day :D

Edited by Leon669, 21 February 2015 - 10:50 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users