How pass parameters to exe
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
How pass parameters to exe
Hi,
I have a little utility that perfom an update to one database but I need to call it from the windows task manager. How can pass some parameter to the app? is posible?
I need pass a value or string.
Salut,
Josep M
I have a little utility that perfom an update to one database but I need to call it from the windows task manager. How can pass some parameter to the app? is posible?
I need pass a value or string.
Salut,
Josep M
Re: How pass parameters to exe
Code: Select all
launch theParameter with "yourPath/YourApp.exe"
Code: Select all
get shell("explorer"&"e&"yourPath/YourApp.exe theParameter""e)
Knowledge is meant to be shared.
Re: How pass parameters to exe
Hi,
But I need call from the windows task manager.
Any help about how call it from cmd window?
But I need call from the windows task manager.
Any help about how call it from cmd window?
Re: How pass parameters to exe
zaxos is right, shell() function is what you need, for example:
Code: Select all
put shell("dir")
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
Re: How pass parameters to exe
Hi,
Nop. I need call the .exe outside Livecode, I want schelude a task from the Windows task manager and I can't use "put xXXX", isn't?
Nop. I need call the .exe outside Livecode, I want schelude a task from the Windows task manager and I can't use "put xXXX", isn't?
Re: How pass parameters to exe
Hi Josep,
that depends on your database EXE!
Most of the time these command line tools have a build-in help that you can call in the DOS prompt like:
name_of_your_db.exe /?
Or maybe:
name_of_your_db.exe -h
Best
Klaus
that depends on your database EXE!
Most of the time these command line tools have a build-in help that you can call in the DOS prompt like:
name_of_your_db.exe /?
Or maybe:
name_of_your_db.exe -h
Best
Klaus
Re: How pass parameters to exe
Hallo Klaus,
Yes. But I don't know how pass the parameter to the application and how handle it from livecode.
I have a livecode an app that perform some actions when the user click on the buttons. I need execute the app with parameter to auto-execute the actions.
myapp.exe -auto
From livecode if I get the parameter "auto", the app must perform the actions and quit as unattended mode.
Salut,
Josep M
Yes. But I don't know how pass the parameter to the application and how handle it from livecode.
I have a livecode an app that perform some actions when the user click on the buttons. I need execute the app with parameter to auto-execute the actions.
myapp.exe -auto
From livecode if I get the parameter "auto", the app must perform the actions and quit as unattended mode.
Salut,
Josep M
-
- VIP Livecode Opensource Backer
- Posts: 9823
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: How pass parameters to exe
You can obtain the arguments passed to a LiveCode app with the global variables $1, $2, etc. You can get the number of such arguments with $#.
In a future version this will be even easier:
http://quality.runrev.com/show_bug.cgi?id=12108
In a future version this will be even easier:
http://quality.runrev.com/show_bug.cgi?id=12108
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: How pass parameters to exe
Hi,
So from DOS command line myapp.exe myfirstparam mysecondparam
And from Livecode...
on preopenstack
global $1,$2
put $1 into tParamOne
put $2 into tParamTwo
... do something
end preopenstack
This way?
Salut,
Josep M
So from DOS command line myapp.exe myfirstparam mysecondparam
And from Livecode...
on preopenstack
global $1,$2
put $1 into tParamOne
put $2 into tParamTwo
... do something
end preopenstack
This way?
Salut,
Josep M
-
- VIP Livecode Opensource Backer
- Posts: 9823
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: How pass parameters to exe
Yep. And if you want the app to run without a UI, you can add -ui as the first of those arguments and the engine will boot faster with less RAM, bypassing all UI initialization, e.g.:
Code: Select all
myapp.exe -ui arg1 arg2
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: How pass parameters to exe
Hi,
Nice Exist any other parameters? like -ui ?
The params are separated by comma or space from DOS command? or -param1 -param2 ?
On the Macosx terminal is the same?
Salut,
Josep M
Nice Exist any other parameters? like -ui ?
The params are separated by comma or space from DOS command? or -param1 -param2 ?
On the Macosx terminal is the same?
Salut,
Josep M
-
- VIP Livecode Opensource Backer
- Posts: 9823
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: How pass parameters to exe
Args passed to an app are not normally separated by commas. I've corrected my example above to remove the errant comma that had been there.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: How pass parameters to exe
Thanks
Salut,
Josep M
Salut,
Josep M
Re: How pass parameters to exe
Hi,
Works perfect! but now I want exit the app when finish. I use the quit command but the app still reside on memory and don't auto-quit.
What I'm doing wrong?
On preopenstack I get the params.
On openstack if exist any param I execute the actions and quit the app.
I tryed the same from the preopenstack without success.
UPDATE: I tryed also lock messages and quit, but not success, the app remain on memory...
Salut,
Josep M
Works perfect! but now I want exit the app when finish. I use the quit command but the app still reside on memory and don't auto-quit.
What I'm doing wrong?
On preopenstack I get the params.
On openstack if exist any param I execute the actions and quit the app.
I tryed the same from the preopenstack without success.
UPDATE: I tryed also lock messages and quit, but not success, the app remain on memory...
Salut,
Josep M
Re: How pass parameters to exe
Hi,
Solved it with calling the stack in VB with "vbhidden", but that's not always possible.
Other idea would be to check $# in preopenstack, and if > 1 (means there are cmd line arguments), set the visible of the stack to false.
Seems it has to do with visual actions in the stack, for instance:
So that the engine tries to update the gfx of the field, but fails since it has no gfx stuff loaded ...
Not sure, maybe someone of the pros has more insight ;-)
Have fun!
PS: I find it useful to have a flag in stacks that have an auto-quit feature - I use such in the openstack script:
Where autorun is a global that is checked before the "quit" cmd. Then start it with Shift pressed and it will stay alive, for better usability ;-)
Had similar problems with using -ui, the stack would not close properlyJosepM wrote:Works perfect! but now I want exit the app when finish. I use the quit command but the app still reside on memory and don't auto-quit.
Solved it with calling the stack in VB with "vbhidden", but that's not always possible.
Other idea would be to check $# in preopenstack, and if > 1 (means there are cmd line arguments), set the visible of the stack to false.
Seems it has to do with visual actions in the stack, for instance:
Code: Select all
put $1 into field OneField
Not sure, maybe someone of the pros has more insight ;-)
Have fun!
PS: I find it useful to have a flag in stacks that have an auto-quit feature - I use such in the openstack script:
Code: Select all
if the shiftkey is down then put false into autorun else put true into autorun
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!