Page 1 of 1

Why doesn't this work?

Posted: Wed Sep 15, 2010 1:41 pm
by magice
Why doesn't this work?
I saved an executable as a custom property of my stack using:

Code: Select all

set the cExecutable of stack "Setup" to url("binfile:" & Daily_Downloader.exe)
That part seemed to work fine

However when i do this Nothing happens.

Code: Select all

on mouseUp
   put field "PathField" into tPath
   do "create folder " & quote & tPath & "downloader" & quote
   put the cExecutable of stack "Setup" into url("binfile:" & tPath & "downloader/Daily_Downloader.exe")
   
end mouseUp
I have tried this with the value of field PathField as both c:/Program Files/MagicEngineerSoftware/ and c:\Program Files\MagicEngineerSoftware\. The code compiles ok and no errors are thrown up when it is executed. It just doesn't create a folder or my executable. Any suggestions?

Re: Why doesn't this work?

Posted: Wed Sep 15, 2010 1:50 pm
by Klaus
Hi Magice,

no need to use "DO"!

Code: Select all

...
put field "PathField" into tPath
create folder (tPath & "downloader")
if the result <> empty then
  answer error "Could not create folder!" & CR & "Error was:" && the result
  exit mouseup
end if
put the cExecutable of stack "Setup" into url("binfile:" & tPath & "downloader/Daily_Downloader.exe")
...
Make sure that the path in fld "PathField" ends with an / (SLASH)!


Best

Klaus

Re: Why doesn't this work?

Posted: Wed Sep 15, 2010 2:23 pm
by magice
Thank you, i think that has put me on the right path. It seems though that i can only create one directory at a time so giving the end user control of the file path is going to take a bit more scripting then I hoped for. Now I understand why software manufacturers put a "change" button on the installation path instead of letting you just type it in.

Re: Why doesn't this work?

Posted: Wed Sep 15, 2010 2:27 pm
by Klaus
Hi Magice,

yep, the user is the weakest part in the chain and needs a LOT of errorchecking to make him a happy camper :D

But you CAN create more than one folder at a time (e.g.in a repeat loop)?
What do I miss?


Best

Klaus

Re: Why doesn't this work?

Posted: Wed Sep 15, 2010 3:04 pm
by magice
Klaus wrote:Hi Magice,

yep, the user is the weakest part in the chain and needs a LOT of errorchecking to make him a happy camper :D

But you CAN create more than one folder at a time (e.g.in a repeat loop)?
What do I miss?


Best

Klaus
What I meant, is that in the create folder command, the entire file path needs to be in place, all but the final folder. I was trying to create a directory and sub directory (MagicEngineerSoftware/Downloader) within the same command. I think I have that problem solved by using the answer folder command in a "change" button and locking the text in field "PathField".

Re: Why doesn't this work?

Posted: Wed Sep 15, 2010 3:23 pm
by Klaus
Ah, yes, I see, thanks!