Page 1 of 2
[Actual coding thread]A simple moving application
Posted: Tue Oct 11, 2011 8:54 pm
by Mgalekgolo
I got xcode and shit for programming, and I want to make an application, cross-platform (If I can only do windows thats fine, its not really for a mac application), that basically moves a file to another location. I would like some tips on what I should write this with, how I should do it, and if at all possible a quick tutorial. I have basically no coding experience except for a small amount of hex and some java from modding minecraft. Oh and HTML from a website design class I took.
Re: [Actual coding thread]A simple moving application
Posted: Wed Oct 12, 2011 6:24 am
by Sparky
Moving files is the same as renaming their pathnames.
So you get the path of a file that the user opens (or that is found by the program in other ways) and you change the path to include another directory. If that directory doesn't exist, it's created.
If you rename a directory, it will actually change that directory's name. The same principle applies to files.
Get the file's path and insert it into a variable.
Redefine the variable when you write to the filesystem.
Re: [Actual coding thread]A simple moving application
Posted: Wed Oct 12, 2011 6:46 pm
by Mgalekgolo
How would I have the user select the install folder and have the game folder [in this case ( I don't remember the windows format so if I do something wrong please correct it. "C:/Program files/JAN_ Realms (Demo 1.1)/Graphics/Characters/[$Male.png/$ralph.png]". I think I wrote that right. Well I want to program it so it doesn't need to be in program files, also copying 1 file, renaming it to the 2 files (the two are the same, but one seems not to do anything and the other actually changes the sprite, but I still want to replace both) and backing up the existing files [$male and $ralph].
Edit: I keep trying to find this on google but all I see is how to move a file to an external drive and other dumb shit. Sparky im not sure how to implement that. If someone could maybe write the code [in java maybe? something cross platform] With an example path (not the path to the game, maybe C:/Example/example/example) ect. Then I would analyze that code and test some things, then I would understand that part of the coding language. And that's how I learned what I know of java (very little, but its more than I ever though I would <_<).
Re: [Actual coding thread]A simple moving application
Posted: Thu Oct 13, 2011 2:11 pm
by Monoman
Since you are looking to move files in Windows, why not just create a bat file that moves them?
Re: [Actual coding thread]A simple moving application
Posted: Thu Oct 13, 2011 6:14 pm
by Mgalekgolo
I'm not sure how to make a .bat to move files. That would work though, providing someone can tell me how.
Re: [Actual coding thread]A simple moving application
Posted: Thu Oct 13, 2011 6:29 pm
by Excend
Code: Select all
move /-y "Directory\file" "New_Directory"
pause
The -y prompts an error if there is a duplicate file, use /y if you're over writing files.
Re: [Actual coding thread]A simple moving application
Posted: Thu Oct 13, 2011 6:53 pm
by Mgalekgolo
Ok, so I create a document in notepad and save as bat?
Went and did that. Thanks man, it works. Now If I could have the user choose the file to move's location...
Re: [Actual coding thread]A simple moving application
Posted: Fri Oct 14, 2011 1:21 am
by Excend
What do you mean?
Re: [Actual coding thread]A simple moving application
Posted: Fri Oct 14, 2011 5:46 am
by Mgalekgolo
Basically It would be nice if I could have the user type the path of the file that is being moved instead of it being a single path.
Re: [Actual coding thread]A simple moving application
Posted: Fri Oct 14, 2011 6:41 am
by Sparky
You could probably either change the properties of one of these files or drag the file to be moved onto the .bat file. Research .bat file commands.
Re: [Actual coding thread]A simple moving application
Posted: Fri Oct 14, 2011 7:23 am
by Excend
Mgalekgolo wrote:Basically It would be nice if I could have the user type the path of the file that is being moved instead of it being a single path.
To save a string to a temporary file.
Code: Select all
ECHO ←[13;0;64;13p
COPY CON USRINPUT.TMP
ECHO ←[13;13p
CLS
All you really need is the copy con, but if you use that you have to use f6 + enter to send a line of text.
Re: [Actual coding thread]A simple moving application
Posted: Fri Oct 14, 2011 5:47 pm
by Mgalekgolo
I don't see how I could set a path with that ^.
What sparky said (drag and drop the file) seems good. I basically want to have a path set for destination but an open ended original file. The .bat I have now works well enough though.
Re: [Actual coding thread]A simple moving application
Posted: Fri Oct 14, 2011 8:13 pm
by Excend
If you want to drag and drop a selected file onto a direct file path can't you just create an alias?
Re: [Actual coding thread]A simple moving application
Posted: Fri Oct 14, 2011 8:43 pm
by Mgalekgolo
If I understand you right that would seem to require knowledge of where the destination directory is, which is what im trying to avoid.
Re: [Actual coding thread]A simple moving application
Posted: Sat Oct 15, 2011 6:24 am
by Excend
I'm still very confused about what exactly you're trying to do... Here's what I have: You want to be able to move any file you want to a specific directory, the directory being the same everytime, but with the user having no actual knowledge of where the directory is?