Standalone with launch command
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Standalone with launch command
My standalone consists of a "main stack" (splash) that opens a "substack" (effective standalone) that launches (at the preOpenStack) an application that must ever remain open, and NOT minimized, in the background. The command "launch" does work correctly and opens the application "SMTP Server". My question is: how auto bringing to the fore my standalone? I'll explain. The command launch at the preOpenStack is the following:
on preOpenStack
-- connect to DB
DataBaseConnect
-- launches the mail host SMTPServer
launch "C:\Program Files\Free SMTP Server\localsrv.exe"
end preOpenStack
The "SMTPServer" opens correctly but remains in front of my standalone. How can I place it back automatically without having to use a manual "mouse click" on the standalone to bring it to the front?
Can someone help me? Thanks a lot.
on preOpenStack
-- connect to DB
DataBaseConnect
-- launches the mail host SMTPServer
launch "C:\Program Files\Free SMTP Server\localsrv.exe"
end preOpenStack
The "SMTPServer" opens correctly but remains in front of my standalone. How can I place it back automatically without having to use a manual "mouse click" on the standalone to bring it to the front?
Can someone help me? Thanks a lot.
-
- VIP Livecode Opensource Backer
- Posts: 256
- Joined: Sun May 27, 2007 8:19 pm
Re: Standalone with launch command
Hi
I am not sure if you can do this in Windows but If you are using a Mac you can use Applescript to do this.
I have an app that starts copying a file in the Finder and I wanted the Finder to come to the foreground so the user will see the copy progress dialog while the copying is happening then when copying is finished I wanted to have my standalone come back to the foreground.
I am using the glx_app_getProp() function from the GLX application framework to get the name of my application to use in the Applescripts (http://www.bluemangolearning.com/liveco ... framework/)
I don't know how to get the application name without using GLX. I guess you could hardcode it.
This is the code to create and run the applescript to find the process ID of my application for use in the later Applescript, then bring the finder to the foreground to see the copy progress dialog, then start the copying of the file.
Then later in my script I have more code to create Applescript code and execute it that switches back to my application when the copy is done.
Not sure how to do the equivalent thing in Windows but if there is a similar scripting architecture perhaps that could be a way to handle that.
Hope that helps.
Martin
I am not sure if you can do this in Windows but If you are using a Mac you can use Applescript to do this.
I have an app that starts copying a file in the Finder and I wanted the Finder to come to the foreground so the user will see the copy progress dialog while the copying is happening then when copying is finished I wanted to have my standalone come back to the foreground.
I am using the glx_app_getProp() function from the GLX application framework to get the name of my application to use in the Applescripts (http://www.bluemangolearning.com/liveco ... framework/)
I don't know how to get the application name without using GLX. I guess you could hardcode it.
This is the code to create and run the applescript to find the process ID of my application for use in the later Applescript, then bring the finder to the foreground to see the copy progress dialog, then start the copying of the file.
Code: Select all
if the environment is "development" then
put "LiveCode-Commercial" into tAppName
else if the environment is "standalone application" then
put glxapp_getProp("application name") into tAppName
end if
# get the process ID of this app
put "tell application" && quote & "System Events" & quote & CR & \
"return (id of first process whose name is" && quote & tAppName & quote & ")" & CR &\
"end tell" into tScript
do tScript as applescript
put the result into tMyProcessID
# Switch to Finder to see copy progress
do "tell application " & quote & "Finder" & quote & CR & "activate" & CR & "end tell" as applescript
revCopyFolder tSourceFolder, tDestinationFolder
Code: Select all
# Switch back to this application using processID when copying is finished
put "tell application" && quote & "System Events" & quote & CR & \
"tell process id" && tMyProcessID & CR & \
"set the frontmost of it to true" & CR &\
"end tell" & CR &\
"end tell" into tScript
do tScript as applescript
Hope that helps.
Martin
Re: Standalone with launch command
Hi Martin
unfortunately I have to work on Windows but I do not know if there is a kind of AppleScript for this OS.
The second "script" of your procedure is just what I need (.. set the frontmost of it to true). My intention was to use only LiveCode architecture, something such as "set the systemWindow of this stack to true", but it is not working. It would seem a simple thing, but instead is not.
Thank you anyway for your suggestion that I'll consider whether possible use with Windows..
Greetings
Sandro
unfortunately I have to work on Windows but I do not know if there is a kind of AppleScript for this OS.
The second "script" of your procedure is just what I need (.. set the frontmost of it to true). My intention was to use only LiveCode architecture, something such as "set the systemWindow of this stack to true", but it is not working. It would seem a simple thing, but instead is not.
Thank you anyway for your suggestion that I'll consider whether possible use with Windows..
Greetings
Sandro
Re: Standalone with launch command
Hi
someone else can help me?
thanks
someone else can help me?
thanks
Re: Standalone with launch command
Hi xanant,
the Windows equivalent to Mac OS Applescript is VBScript!
Do a websearch for: vbscript bring application to front
and check the 99300 results
Sorry, no idea how to do it, I'm a Mac guy.
But you can also:
...
do fld "vbscript" as vbscript
...
in Livecode!
Best
Klaus
the Windows equivalent to Mac OS Applescript is VBScript!
Do a websearch for: vbscript bring application to front
and check the 99300 results
Sorry, no idea how to do it, I'm a Mac guy.
But you can also:
...
do fld "vbscript" as vbscript
...
in Livecode!
Best
Klaus
Re: Standalone with launch command
Hi Klaus
thanks for your reply.
I'm also a "Mac guy" (little), but this time I have to work in windows, of which I have very little knowledge. I thought the question was simpler in Livecode. Does that mean I will review the proposed 99300 ...
Ciao
Xanant
thanks for your reply.
I'm also a "Mac guy" (little), but this time I have to work in windows, of which I have very little knowledge. I thought the question was simpler in Livecode. Does that mean I will review the proposed 99300 ...
Ciao
Xanant
-
- VIP Livecode Opensource Backer
- Posts: 256
- Joined: Sun May 27, 2007 8:19 pm
Re: Standalone with launch command
I am a totally Mac guy but if LiveCode can run scripts in vbScript with "do ------- as vbScript" then you should be able to do it. I looked up bring window to front and found this following which is probably what you need.
https://msdn.microsoft.com/en-us/librar ... s.84).aspx
Martin
https://msdn.microsoft.com/en-us/librar ... s.84).aspx
Martin
Re: Standalone with launch command
Hi xanant,
[quote="xanant"Does that mean I will review the proposed 99300 ...[/quote]
well, better you than us, buddy!
Oh, Martin did it for you, lazybone!
Best
Klaus
[quote="xanant"Does that mean I will review the proposed 99300 ...[/quote]
well, better you than us, buddy!
Oh, Martin did it for you, lazybone!
Best
Klaus
Re: Standalone with launch command
Hi
thank you guys for the tips that made me discover new and interesting things, but above all to have solved my problem.
It would be nice, in a future LiveCode version, a command revTalk to make it easier.
P.S. I'm sorry for Klaus, but I'm happy to avoid view the 99300 results
thank you guys for the tips that made me discover new and interesting things, but above all to have solved my problem.
It would be nice, in a future LiveCode version, a command revTalk to make it easier.
P.S. I'm sorry for Klaus, but I'm happy to avoid view the 99300 results