While my DXL script is running on a module I have it print "." during each loop.
I would like this to show in the output while it running, to reassure the user it isn't frozen since it takes a long time to run.
Currently the DXL windows is blocked from the moment the script starts, and when the script is completely done it prints everything at once.
Is there a way to overcome this?
you could use a GUI, a progress bar or write something to a file.
you could use timer callbacks to update your screen.
Related
I need to run a selfmade context menu entry via cmd.
The command is stored in
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\testCommand\command"
and contains
C:\Path\convert.exe %1 test1|test2
The problem is that windows seems to call the program associated with the command differently the first time. I don't know why and I can't get figured out how to avoid this.
So I want to call the program myself the first time before the user can call it.
If I execute the program myself directly via cmd it runs correctly, but if Windows executes it using the context menu entry it behaves different. After the first time it runs as supposed.
It couldn't find anything simmilar using google and stackoverflow ..
Whats the matter here? Also tried to run it using
RunDll32.EXE URL.DLL,FileProtocolHandler "C:\path\convert.exe"
But couldn't add the parameters requiered ..
Please help me ..
I have a script that's time critical. To speed up things I made a separate script that contains the code that is not time critical. In my main (time critical) script I want to start the non time critical script at the end before it returns nil. How do I start the second script without waiting on it? This without stopping the second script when returning nil in the first script.
You can use io.popen to start a new process (implemented in any language) and read its output when you are ready.
Thanks for reading. :)
Let's give an example of what I say. I press shift+g and I execute one function. In the middle of executing it, I want to stop it by pressing shift+h, then execute another function, and then return the script so as it to stay waiting for another keystroke.
I thought about reloading the program, but I couldn't execute the following commands that way. Or, I could execute another program and reload the first one, but it is getting too complicated.
Any ideas will be greatly appreciated! :)
The easiest way is to put the script in a separate file and run it as an external program. Use #SingleInstance Force to be sure only one copy is running, and if you want to kill it use Process, Close with the PID you can get back from the Run statement.
I do this all the time with long complicated scripts that fail frequently. I mostly do that so if the script fails I just hit the hotkey again to restart. It kills the first instance and restarts. Interrupting a running script is just another special case.
Note that you'll need to run AutoHotkey.exe and pass the name of the script and any parameters. Don't try to run the script itself.
As pointed out the easiest way is to put the script in a separate file and run it as an external program. something like this:
RunWait %A_AhkPath% test1.ahk
Then in test1.apk put ExitApp in a hotkey. like this:
+t::
msgbox killing myself!
Exitapp
very simple!
The AppleScript standard suite has a command that will print from an application, allowing for the specifying of certain options and printing without displaying a dialog box. For example:
tell application "Safari"
print document 1 with properties {copies:3} without print dialog
end tell
However, there appears to be a bug in the current version of Safari that prevents this from happening like it's supposed to.1 When specifying without print dialog, a sheet pops up in the window that should display progress in processing the print job, but instead of doing so it just hangs with a nondescriptive barberpole.
In trying to work around this, I realize that if I specify with print dialog, everything works as it's supposed to. The script pauses execution on that line after displaying the dialog, and then continues after the user has hit the print button in the dialog. The most elegant workaround for this would be to keystroke return after the dialog is shown, but I don't think this is possible given that the script is paused on that line until the dialog is dismissed.
A much less elegant workaround is this:
on printCopiesOfCurrentPage(copies)
tell application "System Events"
tell application process "Safari"
keystroke "p" using command down
keystroke copies as text
keystroke return
delay 3
end tell
tell
end printCopiesOfCurrentPage
Since there's no way to delay execution until the print job is sent off, we have to guess with a delay 3, which is either going to be inefficient or problematic.
Any other possibilities here? Maybe a way to watch for the print dialog disappearing after using the keystroke method, or a way to kick off the job after print with dialog is invoked?
1. The first time I tried this, it actually printed one and a half pages before kind of flipping out and causing a printer jam, of all things. I haven't been able to replicate it since, so if someone could confirm this bug for me, it would be appreciated.
Is it possible to force stop a .wlua file? I figured that I would have to use the Lua Command Line to do this, but I can't seem to find out how to stop them.
If it's possible, how can it be done?
Because wlua.exe doesn't open the console window (that's the purpose) and you can't send Ctrl-C, the only way to terminate such application is to use Processes window in Task Manager. Note, however, that the process name will be wlua.exe for every file opened that way.
Of course, it's meant only to be used when the application isn't responding. Your GUI application should provide a way to close it, such as close button, listening for ESC key etc.