Hi all,
I've set up a script to print to text and to copy from text to excel, but here's where I have a problem. The script immediately starts copying to excel while the print to text is running and often skips certain lines and meshes some lines together. I would like to know, when I print to text, a tray icon appears and when it's done, the print icon disappears. I've tried finding this icon in task manger to no avail.
I would like to know, how do I identify that tray icon's name for use purposes in autohotkey. Is it as simple as the text that appears when I mouse over it and then add .ico?
Also, how would I pause the script or halt the script to wait until this icon disappears before pasting to excel?
Identifying tray icon
Re: Identifying tray icon
If it takes a predictable amount of time, the easiet solution might be to just add a Sleep to your script.
I'm assuming the tray icon doesn't open any windows, so WinWaitClose isn't an option. Does your script use Run to open the print to text process? If so, could you use RunWait instead? If you can figure out the name of the process, you could also use Process, Exist in a while loop to wait out the program.
I'm assuming the tray icon doesn't open any windows, so WinWaitClose isn't an option. Does your script use Run to open the print to text process? If so, could you use RunWait instead? If you can figure out the name of the process, you could also use Process, Exist in a while loop to wait out the program.
Re: Identifying tray icon
Sorry, I communicated improperly. The program I'm using prints and the printer is set up to print to text instead, so when the program prints to text, a popup appears, this info might make the solution more attainable >.<. The popup is labeled "1 document pending for User" And I'm wondering if the solution is as simple as "1 document pending for User.ico"MaxAstro wrote:If it takes a predictable amount of time, the easiet solution might be to just add a Sleep to your script.
I'm assuming the tray icon doesn't open any windows, so WinWaitClose isn't an option. Does your script use Run to open the print to text process? If so, could you use RunWait instead? If you can figure out the name of the process, you could also use Process, Exist in a while loop to wait out the program.
Right now it is on a 4 second delay, but this delay has been reliable 90% of the time.
How would I get the process? Only way I've tried was via task manager to no avail. Is there perhaps a script I can run? Maybe a detecthidden type script?
Oh and the printer is called "generic/text only printer"
Re: Identifying tray icon
If there is a popup, that popup should be a window that Window Spy can identify. Try getting Window Spy up and ready, then when the popup appears mouse over it and quickly take a screenshot to preserve the info.
Re: Identifying tray icon
Spy, or at least my spy doesn't pick up any icons on the tray. All it picks up is Start button, the time and quicklaunch.MaxAstro wrote:If there is a popup, that popup should be a window that Window Spy can identify. Try getting Window Spy up and ready, then when the popup appears mouse over it and quickly take a screenshot to preserve the info.
Re: Identifying tray icon
Oh, so a tray icon appears but there isn't actually a popup. That does make things harder. You'd need to figure out what executable is associated with that tray icon, which could be tricky if it's a default windows function.
I'm not really familiar with how the generic text print driver works, unfortunately, so I'm not sure I can be much more help here.
I'm not really familiar with how the generic text print driver works, unfortunately, so I'm not sure I can be much more help here.
Re: Identifying tray icon
Thanks for trying though.MaxAstro wrote:Oh, so a tray icon appears but there isn't actually a popup. That does make things harder. You'd need to figure out what executable is associated with that tray icon, which could be tricky if it's a default windows function.
I'm not really familiar with how the generic text print driver works, unfortunately, so I'm not sure I can be much more help here.
Anyone else can provide some assistance on the matter? I've got literally everything else working in my code except this part. Right now it's running on the delay timer, but isn't fully reliable.
Re: Identifying tray icon
It's not gonna be easy, you'll need to call some API(s).
Apparently calling GetPrinter() should return some useful info on the chosen printer according to the Level parameter.
As stated on the EnumJobs page, a value of 2 for Level should return the number of print jobs (cJobs) in the printer queue (among others) while a value of 6 would return only the printer status. Calling GetPrinter() in a loop after the print job started and filtering out the desired response(s) should help you out in your quest. For best results - in case the printer incidentally gets other jobs unrelated to your target task - you might wanna call EnumJobs() too and filter out anything unrelated.
You need to know about using DllCall() in AHK, using structures, allocating/freeing libraries and memory etc. Good luck!
Apparently calling GetPrinter() should return some useful info on the chosen printer according to the Level parameter.
As stated on the EnumJobs page, a value of 2 for Level should return the number of print jobs (cJobs) in the printer queue (among others) while a value of 6 would return only the printer status. Calling GetPrinter() in a loop after the print job started and filtering out the desired response(s) should help you out in your quest. For best results - in case the printer incidentally gets other jobs unrelated to your target task - you might wanna call EnumJobs() too and filter out anything unrelated.
You need to know about using DllCall() in AHK, using structures, allocating/freeing libraries and memory etc. Good luck!
Part of my AHK work can be found here.
Re: Identifying tray icon
The following might help you to detect whether the printer icon is in the systray (system tray) (notification area):
[functions to list taskbar buttons/systray icons, require Acc:]
Windows Update: detect if important updates available - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 47#p126047
Acc library (MSAA) and AccViewer download links - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?t=26201
[Also there is TrayIcon.ahk mentioned here:]
Showing a process window from a hidden icon - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=28671
Basically you would loop until the tray icon disappears.
[functions to list taskbar buttons/systray icons, require Acc:]
Windows Update: detect if important updates available - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 47#p126047
Acc library (MSAA) and AccViewer download links - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?t=26201
[Also there is TrayIcon.ahk mentioned here:]
Showing a process window from a hidden icon - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=28671
Basically you would loop until the tray icon disappears.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: Identifying tray icon
Thanks all, gonna do some reading and testing and report back.
Who is online
Users browsing this forum: Ineedhelplz, mikeyww and 195 guests