i have the executable files, now how to create the GUI

Deploying to Windows? Utilizing VB Script execution? This is the place to ask Windows-specific questions.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

maverickalex
Posts: 108
Joined: Sun Mar 15, 2009 11:51 pm

Post by maverickalex » Wed Mar 18, 2009 3:30 pm

aah , i see. that clears that up ok.
Thank you very much.

My other query, My mainstack is the standard size.
as mentioned i am opening new cards for the options for each tool.
Some of the tools have only two options, whereas some have maybe 6 or seven and take more space.

I read the tutorial regarding the resizing of a stack, but whenever i try and resize a single card it resizes all of them.
Thanks for the assistance

maverickalex
Posts: 108
Joined: Sun Mar 15, 2009 11:51 pm

Post by maverickalex » Wed Mar 18, 2009 5:16 pm

This is very frustrating.. :shock:
I am trying to do exactly the same thing from my first card that i did from the mainstack.

ie open up the path to the toolset or folders.
using

Code: Select all

on mouseUP
   answer folder "please select output folder"
put it into tPath
if tPath is not empty then
   put tPath into tWinPath
   replace "/" with "\" in tWinPath
end if
put tWinPath into field "fldpath"
end mouseUP
The only thing that is different between the mainstack and the 1st card is the filed name which is changed from fldtoolsetchoice to fldpath.

But now i always get this error.
button "go":compilation error at line 3(chunk: cant create variable with that name(explicit variables?))

Do i need to do something different because i am on a card rather than the mainstack?
These probably sound stupid questions, but its frustrating as anything.

SparkOut
Posts: 2943
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Wed Mar 18, 2009 6:15 pm

Well, a stack is a "holder" for your collection of cards. Every object you have placed so far has not gone onto "the mainstack" - it has gone onto the first card in the stack - there is always at least one card in any stack, it will be an empty one created at the time the mainstack is.
All cards are the size of the stack they are in. If you resize a stack, you will change the size of all the cards in the stack. If need be, you can set a preOpenCard handler to set the size of the card before it is opened, and/or use the Geometry Manager to rescale/reposition the controls on a card according to the size. (The Geometry Manager will need a whole learning experience on its own, and - although I use it quite extensively - it isn't always what you may call "robust" and a lot of old-timers roll-their-own resizing handlers.)
If you're getting that error, it will be because strict compilation mode is on in the debugger/editor preferences, so you (and I think this is good practice) need to explicitly declare variables in the context they are to be used before they are available. In this case in the mousUp handler, make the first line

Code: Select all

local tPath
Being declared inside the mouseUp handler means that variable has a context only inside the mouseUp handler and will be lost after the handler exits. Its value cannot be shared with other handlers. If you have say a card script, you can declare a variable as "local sVariableName" just the same, but if you put it at the top of the card script outside any handlers, it will be available to all the handlers on that card script. (That's a script local variable.) You can also declare

Code: Select all

global gVariableName
in any script and that will retain its value between scripts and stacks - ie globally.

maverickalex
Posts: 108
Joined: Sun Mar 15, 2009 11:51 pm

Post by maverickalex » Wed Mar 18, 2009 7:05 pm

lovely i have that working now.

So far then, with your help i'm here.

I have my first card of the mainstack. where i can choose the required tool from a pulldown menu.
Image

selecting hgtchop i then get passed to the second card which is the hgtchop options card.
Image

here i can put the options in (there is only a choice between 1 or 3 so no need for a checkbox or menu)

can choose the hgt.zip folder needed (those are all downloaded and the folders prepared prior to using this application)

choose the output folder (again this is made ready beforehand0

So should be able to just press create and the tool goes to work.

here is the script i have tried.

Code: Select all

 on mouseUp
   get shell  ("start hgtchop" && tresolutionfield && tzipfield && tfldpath)
end mouseUp
i havent put the hidesonsolewindows set to true in as i wanted to see the command output.

I can see that when i run it, it doesnt seem to be finding the resolution as i get a resolution error in the command box.

Can you see where i have gone wrong?

ps i know the tool actually works as i ran the script

Code: Select all

on mouseUp
get shell  ("start hgtchop" 3 e:\terragear\w07n071.ght.zip e:\terragear\work)
end mouseUp
and it ran perfectly

SparkOut
Posts: 2943
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Wed Mar 18, 2009 7:57 pm

Well I'd still put the two options 1 & 3 into a radio group say, and thereby prevent anything but 1 or 3 from being input by accident, and also if labelled, you can indicate "normal" or "high-res" to make it more obvious what the settings do - a bit more meaningful than expecting someone to put 1 or 3.
Anyway, apart from checking that the variables you have specified are actually set (you would need to

Code: Select all

put field "fldpath" into tfldpath
etc. I would put all the parameters for the start command in quotes as below. If you build up the string of quoted parameters and then (while testing) answer the whole string, you can check that after the variables are resolved it looks like the proper command line should. Note the caveat about the dummy console title for when the setHideConsoleWindows is true.

Code: Select all

on mouseUp
   local tShellCommand

   --put space & quote & quote into tShellCommand
   --the above line puts an empty pair of quotes to be the
   --first parameter passed to the shell command which is 
   --necessary to act as the dummy console window "title"
   --if setHideConsoleWindows is true
   --so you will need to uncomment the line when you do that.

   put space & quote & "hgtchop" & quote after tShellCommand
   put space & quote & tresolutionfield & quote after tShellCommand
   put space & quote & tzipfield & quote after tShellCommand
   put space & quote & tfldpath & quote after tShellCommand
   answer "About to:" && quote & "start" & tShellCommand & quote 
   get shell ("start" & tShellCommand)
end mouseUp

maverickalex
Posts: 108
Joined: Sun Mar 15, 2009 11:51 pm

Post by maverickalex » Wed Mar 18, 2009 8:18 pm

sorry i guess that bit went over my head.

As you can tell from the posts ALL DAY, i have been working on this, trying to get the hand of it.

Should i putting some of the command lines in the quotes etc.

i did this.

Code: Select all

put field "resolutionfield" into tresolutionfield
put field "zipfield" into tzipfield
put field "fldpath" into tfldpath
on mouseUp 
local tShellCommand 

--put space & quote & quote into tShellCommand 
--the above line puts an empty pair of quotes to be the 
--first parameter passed to the shell command which is 
--necessary to act as the dummy console window "title" 
--if setHideConsoleWindows is true 
--so you will need to uncomment the line when you do that. 

put space & quote & "hgtchop" & quote after tShellCommand 
put space & quote & tresolutionfield & quote after tShellCommand 
put space & quote & tzipfield & quote after tShellCommand 
put space & quote & tfldpath & quote after tShellCommand 
answer "About to:" && quote & "start" & tShellCommand & quote 
get shell ("start" & tShellCommand) 
end mouseUp
I get the "about to start" box pop up.
but then "get sorry windows can't find tresolution"

My head is a shed today, from 7am this morning i have been sat here.

Garrett
Posts: 386
Joined: Sat Apr 08, 2006 8:15 am
Contact:

Post by Garrett » Wed Mar 18, 2009 8:20 pm

Rev has this horrible way of first making you feel and look like a newbie, but then sneaking up from behind you after a while and biting you, infecting you and then you start saying crazy things like "OH! I GET IT NOW!". :-)
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)

maverickalex
Posts: 108
Joined: Sun Mar 15, 2009 11:51 pm

Post by maverickalex » Wed Mar 18, 2009 8:21 pm

i think i've been mauled!!! not just bitten. :D

SparkOut
Posts: 2943
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Wed Mar 18, 2009 8:55 pm

declare the variables tfieldpath etc along with the declaration "local tShellCommand" and put the field contents into the variables by including those statements inside the on mouseUp handler.
Then what happens when you press the button. Do you get a whole "About to: "start "hgtchop" "3" "e:\terragear\w07n071.ght.zip" "e:\terragear\work"" string answered?

maverickalex
Posts: 108
Joined: Sun Mar 15, 2009 11:51 pm

Post by maverickalex » Wed Mar 18, 2009 9:03 pm

ah, yes i have put the variable inside mouseUp and i get the entire string shown in the "about to Start" popup.

But although the "3" option is shown in the string, i get an error message saying "windows cannot find "3" make sure yu typed the name correctly" etc..?

this is what i have now.

Code: Select all

on mouseUp 
   local tShellCommand 
   put field "resolutionfield" into tresolutionfield
put field "zipfield" into tzipfield
put field "fldpath" into tfldpath

--put space & quote & quote into tShellCommand 
--the above line puts an empty pair of quotes to be the 
--first parameter passed to the shell command which is 
--necessary to act as the dummy console window "title" 
--if setHideConsoleWindows is true 
--so you will need to uncomment the line when you do that. 

put space & quote & "hgtchop" & quote after tShellCommand 
put space & quote & tresolutionfield & quote after tShellCommand 
put space & quote & tzipfield & quote after tShellCommand 
put space & quote & tfldpath & quote after tShellCommand 
answer "About to:" && quote & "start" & tShellCommand & quote 
get shell ("start" & tShellCommand) 
end mouseUp
i get this string
Image

then clicking ok gets this.

Image

i tried taking out the put space & quote & tresolutionfiled after tshellcommand, and although it takes the error away and the application find the .hgt.zip file it doesnt run the actual tool.

maverickalex
Posts: 108
Joined: Sun Mar 15, 2009 11:51 pm

Post by maverickalex » Wed Mar 18, 2009 10:02 pm

HUrraaaaahhhh

all by myself too.

Code: Select all

put space & "hgtchop" & space after tShellCommand 
put space & tresolutionfield & space after tShellCommand 
put  tzipfield after tShellCommand 
put  space & tfldpath after tShellCommand 
answer "About to:" && quote & "start" & tShellCommand & quote 
get shell ("start" & tShellCommand) 
end mouseUp
It just needed the spaces and quotes putting in or taking out

It Worked!! THANKS A MILLION SPARKOUT!!! :lol: without your help and guidance i would have gone nowhere..

I Shall try to use all you have told me and that i have larnt to create the other four now, without the need for too much assistance. (he says not holding his breath) :shock:

SparkOut
Posts: 2943
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Wed Mar 18, 2009 11:08 pm

Well done, glad it worked in the end!
I usually find that Windows likes all the arguments to be quoted, so that it knows which are which in turn - and it's vital if there are any spaces in any of the paths. Sometimes if you try and start "aprogram.exe param1 param2" it can take the whole string as the one program name. I usually have to fiddle with the quotes and spaces (for that reason I suggested building it up bit by bit, and gettting rev to answer the string before setting it off) but I couldn't test with your app and paths, so I might have been a little out here or there. If you have any user selectable paths involved in the installation, then make sure you test for the possibility of needing spaces in the paths and therefore require them to be wrapped in quotes. Well done again and good luck.

maverickalex
Posts: 108
Joined: Sun Mar 15, 2009 11:51 pm

Post by maverickalex » Wed Mar 18, 2009 11:14 pm

I think it may be that the actual tools are originally written under linux (i think) and have been converted to run under windows.
That may be the reason why.
I know that when i have been trying to run them straight from the command line, they seem to want the spaces in the correct places.

Thanks again for all your help.

I'm certain i will be asking for advice again, but i'm already half way through the second tool now, having gained enough knowledge to move forward somewhat.
Thanks again for your patience and help.
I know it's not easy trying to explain things to someone with little grasp of the terminology.
Alex

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Post by mwieder » Wed Mar 18, 2009 11:45 pm

Alex-

When in doubt ,always put spaces around file paths. You can go wrong not having quotes when they're needed but you can (almost) never go wrong having quotes when they're not explicitly needed.

maverickalex
Posts: 108
Joined: Sun Mar 15, 2009 11:51 pm

Post by maverickalex » Wed Mar 18, 2009 11:57 pm

Thank you for that info.

If i wish to use a full stop . or period can i just use it as it is, or is there a function for it?
I was looking in the dictionary but couldnt find it.

one of the tools needs a
& space & .

Post Reply