Page 1 of 2
revMoveFolder (solved)
Posted: Sat May 03, 2014 5:51 am
by Da_Elf
I did a forum search and didnt come up with anything on this. i must be missing something here. I created a small card with 1 button on it with this code
Code: Select all
on mouseUp
revMoveFolder "folder","D:/"
end mouseUp
the app was in a folder containing a folder called "folder" containing a demo .txt file.
it should have moved the folder and its contents to the D:/ drive but it doesnt do anything
not sure if this makes a difference but its livecode 6.5.0 on windows7 and yes there is a d:/ drive.
Re: revMoveFolder
Posted: Sat May 03, 2014 6:15 am
by Simon
Hi Da_Elf,
is "folder" in the default folder?
With just what you have there and nothing else the default folder is where the stack is (best to save the stack somewhere you know or the default folder will be deep in (x86) Program Files).
Simon
Re: revMoveFolder
Posted: Sat May 03, 2014 6:48 am
by Da_Elf
my folders are like this
g:\test\untitled.exe
g:\test\folder\
g:\test\folder\test.txt
Re: revMoveFolder
Posted: Sat May 03, 2014 7:00 am
by FourthWorld
I believe you'll need to specify the full path for the desintation, and you may also want to use a full path for the source as well so you needn't keep track of the default folder.
Re: revMoveFolder
Posted: Sat May 03, 2014 3:59 pm
by Da_Elf
i slept on it and came back with this this morning. but it still doesnt work
im getting the absolute path to the folder. and D:\ is the absolute path to where i want it moved to but it still isnt moving the folder
Code: Select all
on mouseUp
answer folder "Please choose your media folder destination"
put it into fVar
put the effective filename of this stack into tPath
set the itemDelimiter to slash
delete last item of tPath
put tPath & slash & "media" & slash into tImediaFolder
revMoveFolder tImediaFolder,fVar
answer tImediaFolder & " moved to " & fVar
end mouseUp
Re: revMoveFolder
Posted: Sat May 03, 2014 4:38 pm
by dave.kilroy
Hi Da-Elf
What debugging have you tried? The dictionary says that the actual work of moving is done by AppleScript or Shell (depending on platform obviously) and errors are put in the result function. I note in the script you posted that you aren't using this function (maybe you are and you just posted a simpler version of your real code) - if not then maybe try something like the following just after calling revMoveFolder:
Code: Select all
put the result into tResult
answer tResult
Also, again just in case you are not actually calling revMoveFolder from a mouseUp, please note that i don't think you can call it too early (certainly after preOpenStack) in the start up sequence.
There are other things you could try such as: what platform and version of LC you are using, have you checked for LC bugs agains those versions, have tried the functionality with brand new test stacks, have you tried with different locations, with different OS's, with different versions of LC, with different files? - um that's all I can think of - good luck!
Dave
Re: revMoveFolder
Posted: Sat May 03, 2014 4:42 pm
by Da_Elf
i added the result thing you said and the result was "1" no clue what that means
Re: revMoveFolder
Posted: Sat May 03, 2014 5:01 pm
by dave.kilroy
Aha! Well LiveCode error number 1 is "Handler: running low on memory, script aborted" - does that give you any clues?
There are quite a few ways to find out what cryptic error numbers are - this is one of them
http://livecodeshare.runrev.com/stack/7 ... ror-Lookup
Re: revMoveFolder
Posted: Sat May 03, 2014 5:16 pm
by dave.kilroy
actually I showed you a sloppy way to use the result - this is better:
Code: Select all
if the result is not empty then
answer the result
end if
Richard has written a great piece on LiveCode errors:
http://livecodejournal.com/tutorials/ha ... s-001.html in it he shows (among other things) how to turn cryptic error numbers in to something easier to understand
Re: revMoveFolder
Posted: Sat May 03, 2014 5:31 pm
by Da_Elf
hmm my last post didnt seem to post. The thing about low on memory doesnt make sense sense since there is more than enough room n my drives. "rename folder" works for moving the folder however only if its on the same drive. What recommendations would you have to move a folder from one drive to another drive?
Re: revMoveFolder
Posted: Sat May 03, 2014 5:50 pm
by dave.kilroy
Sorry I don't think I'll be much use to you from now on (but somebody from the LiveCode community will). I don't think I've ever moved folders with LiveCode - I usually check for the existence of a folder/file, create it if it's not there and then recursively copy across any files needed.
Actually regarding you remark about memory - I took it that it was referring to RAM rather than space on your drive!
Re: revMoveFolder
Posted: Sat May 03, 2014 6:17 pm
by jacque
Da_Elf wrote:The thing about low on memory doesnt make sense sense since there is more than enough room n my drives. "rename folder" works for moving the folder however only if its on the same drive. What recommendations would you have to move a folder from one drive to another drive?
Memory and disk space are different things, of course. If LC is running out of RAM then use Dave's suggestion of recursively copying files, then deleting the originals. To see if RAM really is the problem, try moving a folder with only a single small text file in it. If that works, then RAM is the problem.
Re: revMoveFolder (Solved)
Posted: Sat May 03, 2014 7:31 pm
by Da_Elf
i tried with a single file and i tried with the full folder ive tried with no subfolders in the folder to be moved and with subfolders. The revMoveFolder is using absolute paths as found with the "answer folder" and the "effective filename". Ive tried moving to the D:/ drive and to the same volume as the original path but nothing worked. Ive got 32gigs of ram since im a 3d animator and i popped open task manager and monitored my ram usage when clicking the button to move and it didnt flinch. While looking into the whole thing on copying the files over to do the recursive method i decided to use the revCopyfolder and low and behold it worked. But when i tried deleting the original folder it wouldnt delete it. This leads me to believe it might be a permissions thing and thats why it didnt want to move but tried running as administrator but didnt work
EDIT... i got it to work using revDeleteFolder since i noticed delete folder wont work if its got stuff in it. Thanks for all of the help guys
Code: Select all
on mouseUp
answer folder "Please choose your destination folder"
put it into fVar
put the effective filename of this stack into tPath
set the itemDelimiter to slash
delete last item of tPath
put tPath & slash & "media" & slash into tImediaFolder
revCopyFolder tImediaFolder,fVar
revDeleteFolder tImediaFolder
answer tImediaFolder & " moved to " & fVar
end mouseUp
Re: revMoveFolder
Posted: Sat May 03, 2014 7:51 pm
by FourthWorld
If you can make a simple example stack that fails when moving from one user-writable space to another, please test this under v6.6.2 RC3 and if the problem persists please include the sample stack in a bug report:
http://quality.runrev.com/
Re: revMoveFolder (solved)
Posted: Sun May 04, 2014 10:53 am
by Da_Elf
i dont see that version