Can I use Shell command for .exe with LiveCode Server 4.6.3?

Are you using LiveCode to create server scripts or CGIs?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
BarrySumpter
Posts: 1201
Joined: Sun Apr 24, 2011 2:17 am

Can I use Shell command for .exe with LiveCode Server 4.6.3?

Post by BarrySumpter » Sat Aug 13, 2011 12:08 am

Still trying to get my head around LiveCode Scripting Server.

I've been successful in setting up the LiveCode Scripting Server on WinXP32 IIS 5.1.
LiveCode Server 4.6.3 - Setup on WinXP32 IIS 5.1
http://forums.runrev.com/viewtopic.php? ... t=0#p41010

I can't seem to get LiveCode Server 4.6.3 to shell to an executable

Nor can I get start using to work.

Are both of these commands reserved for On-Rev only?

Also, this is my first adventure into CGI - common gateway interface.
Can anyone reply with a super short (and easy to understand) explaination
on how LiveCode fits in with CGI?

I wish we had an easier way to identify the LiveCode Server (for web scripting)
and a different way to identiry the LiveCode Server OnRev features and quesions and answers.

Any positive constructive suggestions would be greatly appreciated.


Dir.lc

Code: Select all

<html>

<?lc 

set the shellcommand to "/bin/sh"     --?????


 put shell("dir") -- WORKS

  put "<br><br>***  Command Starting ...   <br><br>"

 set the defaultFolder to "C:\"  
 
  -- Get shell("start M:\Inetpub\wwwroot\myApp.exe MyUserID MyPW") -- does NOT work

  -- Get shell("M:\Documents and Settings\Barry\Desktop\MyAppFolder\MyApp.exe") -- does NOT work

-- start using stack "M:\Documents and Settings\Barry\Desktop\MyAppFolder\MyApp.exe"
--  set the defaultStack to "M:\Documents and Settings\Barry\Desktop\MyAppFolder\MyApp.exe"

start using stack "c:\MyApp.livecode"    --  doesn't work  --  no controls - just script in openStack


 put "<br><br>***  Command Completed   ***<br><br>"
 
 ?>

</html>

All my best,
Barry G. Sumpter

Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.

wsamples
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 262
Joined: Mon May 18, 2009 4:12 am

Re: Can I use Shell command for .exe with LiveCode Server 4.6.3?

Post by wsamples » Sat Aug 13, 2011 12:41 am

Barry, "/bin/sh" is another one that is only useful in a Unix environment. I don't know what value there is in specifying the shellpath in Windows, but it has to point to something that exists. Since you're running in a Windows environment, you're probably going to run into other examples where paths and commands might need to be altered, or may not be applicable in any form, because they were formulated under Linux. It can be frustrating sometimes to run a minority OS, but usually it's not Windows users who are suffering ;)

What is it you want to accomplish with the apps you would be opening with a shell command? Is it appropriate (and necessary) to be doing this in a server environment? Are you hoping to have an app interact with the server? Is this server running headless? If so, is the app you're trying to open faceless, or can it run faceless? Have you experimented much with using shell() on the desktop and seeing what works, and doesn't work, there in Livecode?

Good luck!

BarrySumpter
Posts: 1201
Joined: Sun Apr 24, 2011 2:17 am

Re: Can I use Shell command for .exe with LiveCode Server 4.6.3?

Post by BarrySumpter » Sat Aug 13, 2011 1:28 am

Thanks for the reply.

Yes, windows users certainly suffer as well.
There's just more of us. :D

Thanks for the heads up on that Unix stuff.
Just stumbling me way thru posts that look anything like what I'm looking for.

The shell command I'm using fires MyApp.exe.
MyApp.exe has NO interface other than the command line parameters.
MyApp.exe accesses the internat and writes an .xml file to the same folder MyApp.exe is on.
Thats it.
The shell command in LiveCode waits until MyApp.exe finishes before continuing to the next command.
OK by me since it only pauses about 5 seconds.

Don't know what is meant by HEADless.

Faceless may be without a graphical interface.
In realbasic is was just script. i.e. a console app.
i.e. not even a window/form/stack.

LiveCode ide requires a stack.
Which is a graphical interface with script behind.
Unless there is some other way to create a console type LiveCode .exe.

In LiveCode Scripting Server I'm supposed to be able to: Start Using Stack "myStack.livecode"
Which I can't get to work either.

And in LiveCode Scripting Server it reads like I should be able to Start Using Stack
with a stack that uses any control other than a button.
Or so my haphazard research indicates.

In LiveCode Standalone executable the shell command works properly.
With the exact executable and its parameters that I can't get to fire from the LiveCode server.


Anyone using the shell command in LiveCode Scripting Server for anything other than OS commands?
More on Windows but on ANY platform and working or not?
All my best,
Barry G. Sumpter

Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.

wsamples
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 262
Joined: Mon May 18, 2009 4:12 am

Re: Can I use Shell command for .exe with LiveCode Server 4.6.3?

Post by wsamples » Sat Aug 13, 2011 4:57 am

Is it possible that the server is refusing to allow the executable to run because of its location, as a security issue? It seems plausible, at least. Is there a directory you can put it in and tell the server it's safe to run it from there? Where are the stack files you're trying to use? They could also be affected by security issues.

BarrySumpter
Posts: 1201
Joined: Sun Apr 24, 2011 2:17 am

Re: Can I use Shell command for .exe with LiveCode Server 4.6.3?

Post by BarrySumpter » Sat Aug 13, 2011 5:32 am

Yes, it certainly could be the securities permissions related to the folder and virtual web etc.

I've set every permission I could see and research.

Unless there is some step-by-step procedure I've missed.
All my best,
Barry G. Sumpter

Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: Can I use Shell command for .exe with LiveCode Server 4.6.3?

Post by bangkok » Sat Aug 13, 2011 5:55 am

BarrySumpter wrote:I wish we had an easier way to identify the LiveCode Server (for web scripting)
and a different way to identiry the LiveCode Server OnRev features and quesions and answers.
What do you mean ?

There is no difference between LiveCode Server and On-Rev, as far as scripting and functions are concerned.

On-Rev is just a webhosting service, with LiveCode Server installed in standard, plus (that's the only difference) a "special editor" allowing you to edit scripts in an easier way.

As for CGI, nothing fancy. Just a mechanism allowing a webserver to call an external program, passing data to it and getting back a result.

BarrySumpter
Posts: 1201
Joined: Sun Apr 24, 2011 2:17 am

Re: Can I use Shell command for .exe with LiveCode Server 4.6.3?

Post by BarrySumpter » Sat Aug 13, 2011 6:51 am

Is there a way I can create a LiveCode cgi executable?
All my best,
Barry G. Sumpter

Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Can I use Shell command for .exe with LiveCode Server 4.6.3?

Post by sturgis » Sun Aug 21, 2011 6:44 pm

Assuming you have no controls on the stack that you're trying to "start using", and have no errors thrown, the problem is most likely that "start using" won't execute its initilization scripts, it just loads as a library. So any opencard or openstack handlers will have no affect.

You can see if the stack is actually loading like so

start using stack "c:\MyApp.livecode"
put the stacksinuse

If your stack appears its loaded but you'll have to manually call any handlers/functions you want to use from that stack.

I found that yes having a button, with or without a script is a bad thing with stacks you're trying to use, but while other controls don't necessarily cause a hard crash you can't really use them. IE no using fields for storage, stick with properties etc. Thx to others on the forum for fixing my misconception on that score.

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Can I use Shell command for .exe with LiveCode Server 4.6.3?

Post by sturgis » Sun Aug 21, 2011 7:04 pm

Took a closer look at the shell calls too..

This
-- Get shell("M:\Documents and Settings\Barry\Desktop\MyAppFolder\MyApp.exe") -- does NOT work

is passed without surrounding quotes , so the spaces in the path are most likely at least part of the issue.

You can build your string before hand to solve this IE
put quote & "M:\Documents and Settings\Barry\Desktop\MyAppFolder\MyApp.exe" & quote into tShell
get shell(tUrl)

Alternatively, I believe you can do the following (untested, but think it will work?)
get shell(shortfilepath("M:\Documents and Settings\Barry\Desktop\MyAppFolder\MyApp.exe"))

Which will convert the path you to 8.3 format making the problematic spaces dissapear.

BarrySumpter
Posts: 1201
Joined: Sun Apr 24, 2011 2:17 am

Re: Can I use Shell command for .exe with LiveCode Server 4.

Post by BarrySumpter » Mon Aug 22, 2011 1:47 am

Solved here:

http://forums.runrev.com/viewtopic.php? ... 779#p42070

It was pretty much me.

I needed to control all these files under the LiveCode Scripting Server under IIS 5.1.
MyApp.exe
MyApp.dll
MyApp.xml

All have to be on a folder under IIS 5.1 knowledge.
I've been running them on my WinXP platorm from the c:\ drive for years.
i.e. executing from the win pc desktop - not from iis 5 etc

I had mistaken thought that since the app was on my server hard drive
that all hard drive files and folder were availabel to IIS 5.1 and LiveCode Scripting Server.

I think wSamples was right on the money with permissions.
But I'll certinaly keep on the lookout for spaces in hyperlinks.
Last edited by BarrySumpter on Wed Mar 07, 2012 2:31 am, edited 3 times in total.
All my best,
Barry G. Sumpter

Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Can I use Shell command for .exe with LiveCode Server 4.6.3?

Post by sturgis » Mon Aug 22, 2011 1:18 pm

K gotcha. Glad its solved!

Post Reply

Return to “CGIs and the Server”