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.
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
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.
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
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