| View previous topic :: View next topic |
| Author |
Message |
Sean
Joined: 12 Feb 2007 Posts: 1331
|
Posted: Fri Mar 09, 2007 10:07 am Post subject: |
|
|
| BoBo wrote: | | If not done already - wouldn't it make sense to provide it within a seperate post? |
I've done it now.
It was just a variation of my script (:not in AHK) to convert between ANSI and UTF8.
Moderator: It is in this post |
|
| Back to top |
|
 |
burtlo
Joined: 21 Apr 2006 Posts: 1 Location: Seattle, WA
|
Posted: Fri Mar 09, 2007 8:30 pm Post subject: Console Applications with Percentage Updates |
|
|
Recently, I've created an application to perform the creation of the image and then burning the image to a CD. Prior to this point, I used the RunWait function and displayed the command-line box, but was interested in getting a more live update of the percentages from the command-line application so I could move the information to a UI component (System Tray,Progress Bar,etc.)
I attempted to use CMDret_RunReturn and CMDret_Stream but both of them have failed to give live updates of the percentages of one application. I get the impression it is the particular application that is causing me grief but wanted to see if I was at fault in my execution.
Oscdimg
Oscdimg is the offending application. It allows me to creates boot-able images for Windows Recovery (WinPE) environments. During the creation process a percentage value increases. However, I cannot capture the real-time value of that percentage.
CMDRunReturn Example:
| Code: |
Output := CMDret_RunReturn("oscdimg -n -h -m -lWinRe -betfsboot.com C:\ImageCreation\CDROM WinRe.ISO")
MsgBox, %Output%
|
Output shows only after the process is complete. The output shows the application header information and all the percentages as they were updated in the application.
CMDret_Stream Example:
| Code: |
Gui, Add, Edit, x10 y10 r20 w280 vTestEdit, %Output%
Gui, Show, w300 h300 Center, Example
CMDret_Stream("oscdimg -n -h -m -lWinRe -betfsboot.com C:\ImageCreation\CDROM WinRe.ISO","optional",A_WorkingDir)
CMDret_Output(CMDOut, CMDname="")
{
global Output
Output := Output "`n" CMDOut
GuiControl,,TestEdit, %Output%
}
|
This will show the header information and then show 0% as the process starts but will not show any updated percentages through the process.
Is there an error in the execution of my code or are there issues with certain command-line application that make them unable to gather their output?
I appreciate the help and the assistance. |
|
| Back to top |
|
 |
corrupt
Joined: 29 Dec 2004 Posts: 2393
|
Posted: Sat Mar 10, 2007 7:13 pm Post subject: |
|
|
@washboard, Sean - Thanks for the info and workaround
@burtlo - Thanks for the information and example. I'll have a look. |
|
| Back to top |
|
 |
XavierGr
Joined: 15 Jul 2006 Posts: 42
|
Posted: Sat May 05, 2007 1:26 pm Post subject: |
|
|
corrupt thanks for this wonderful function.
I have a minor question:
I want to open a telnet connection with my router (telnet router-ip).
But then I have to enter username and password, which I can't find a way to do it through CMD_ret.
I think you've already said that there is no STDIn but I just want a confirmation.
Also is it possible to run multiple commands from the first instance?
e.g if in the end I manage to log on on my router it would be good not to have to re-log on it for every command I have to put in.
Thanks in advance. _________________ One hotkey to rule them all! |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 3624 Location: Belgrade
|
Posted: Sat May 05, 2007 2:39 pm Post subject: |
|
|
| Quote: | | But then I have to enter username and password, which I can't find a way to do it through CMD_ret. |
You will have to create batch script, that executes your telenet connection and use some of the "console automatition tools". I don't remember what was the name for the Windows, but on Linux its known as expect.
So, this problem has nothing to do with CMDRet. _________________
 |
|
| Back to top |
|
 |
corrupt
Joined: 29 Dec 2004 Posts: 2393
|
Posted: Sat May 05, 2007 6:34 pm Post subject: |
|
|
| XavierGr wrote: | | I think you've already said that there is no STDIn but I just want a confirmation. | StdIn is planned for the next (and possibly final) release but it might be a couple weeks before its released. The next release may also fix a few issues with CMDret_Stream not producing all output when expected. If you need something sooner, the dll version of CMDret supports StdIn (and a few other options) and I think the set of functions that Sean is working on (StdoutToVar) might have an option to specify StdIn. Future versions of CMDret after the next release will likely be in the form of updates to the dll version except for bug fixes (if any). Although, it's tempting to reconsider this since the latest AutoHotkey release supports optional ByRef params...
| XavierGr wrote: | Also is it possible to run multiple commands from the first instance?
e.g if in the end I manage to log on on my router it would be good not to have to re-log on it for every command I have to put in.
Thanks in advance. | It's not supported at the moment because of a lack of StdIn functionality but adding StdIn support to CMDret_Stream might provide some functionality for this. Thanks for the suggestion . majkinetor and a few others had also expressed an interest in being able to have similar functionality. I'll try and include the functionality in the next version.
Edit: added links to the other topics mentioned |
|
| Back to top |
|
 |
Supercalifragilistic Guest
|
Posted: Tue Jun 19, 2007 7:36 pm Post subject: |
|
|
| corrupt wrote: | In the interest of efficiency and keeping somewhat up to date, these functions, CMDret and a few others will be updated to use the new numspagetti and numnuts functions, callbacks and other current features in the current beta once they are offically released . | We all are very impatient to see the result  |
|
| Back to top |
|
 |
corrupt
Joined: 29 Dec 2004 Posts: 2393
|
Posted: Wed Jun 20, 2007 12:56 am Post subject: |
|
|
| Supercalifragilistic wrote: | We all are very impatient to see the result  | I'll see what I can do. I don't usually get much time to work on coding during the week due to my day job, family/kids, life in general... but I might have a chance to release one of them later tomorrow...  |
|
| Back to top |
|
 |
Supercalifragilistic Guest
|
Posted: Wed Jun 20, 2007 4:32 am Post subject: |
|
|
Impatient, certainly, but not avid. Take your time  |
|
| Back to top |
|
 |
corrupt
Joined: 29 Dec 2004 Posts: 2393
|
Posted: Mon Aug 06, 2007 7:37 pm Post subject: |
|
|
| Supercalifragilistic wrote: | Impatient, certainly, but not avid. Take your time  | I guess I have so far... Sorry for the delay... If structs were implemented in AutoHotkey in a user friendly way (struct.member = "blah", myresult := struct.somemember), I would probably update this script (and release a few others) more often ... |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5811
|
Posted: Sun Oct 21, 2007 7:19 am Post subject: |
|
|
Dear corrupt,
Thank you for this wonderful utility.
I seek some advice from you.
I am polling per second my UPS ( with the CLI provided by the Vendor ) to retrieve line-in Voltage and Battery charge level and constantly update my always-visible GUI.
The Output of CLI is around 1K and a sample follows:
| Code: | APC : 001,038,1052
DATE : Sun Oct 21 11:33:57 India Standard Time 2007
HOSTNAME : SKAN-PC
RELEASE : 3.14.2
VERSION : 3.14.2 (15 September 2007) Win32
UPSNAME : SKAN-PC
CABLE : USB Cable
MODEL : Back-UPS ES 500
UPSMODE : Stand Alone
STARTTIME: Sun Oct 21 09:05:13 India Standard Time 2007
STATUS : ONLINE
LINEV : 224.4 Volts
LOADPCT : 42.0 Percent Load Capacity
BCHARGE : 094.0 Percent
TIMELEFT : 20.1 Minutes
MBATTCHG : 5 Percent
MINTIMEL : 3 Minutes
MAXTIME : 0 Seconds
SENSE : High
LOTRANS : 195.0 Volts
HITRANS : 255.0 Volts
ALARMDEL : Always
BATTV : 13.7 Volts
LASTXFER : Unacceptable line voltage changes
NUMXFERS : 2
XONBATT : Sun Oct 21 11:09:34 India Standard Time 2007
TONBATT : 0 seconds
CUMONBATT: 248 seconds
XOFFBATT : Sun Oct 21 11:09:48 India Standard Time 2007
SELFTEST : NO
STATFLAG : 0x07000008 Status Flag
SERIALNO : BB0426007951
BATTDATE : 2004-06-22
NOMOUTV : 2300
NOMINV : 230
NOMBATTV : 12.0
FIRMWARE : 850.m3.I USB FW:m3
APCMODEL : Back-UPS ES 500
END APC : Sun Oct 21 11:33:58 India Standard Time 2007 |
Given the fact that that the script will poll 57600 times, 16 Hours per day :
Is it less strenuous to use the DLL instead of AHK version of CmdRet ?
Is it less strenuous to the system to use CmdRet than outputting to a file and use FileReadLine ?
Is it less strenuous than CmdRet to the system if I output the file to a RAMDRIVE and use FileReadLine ?
Please advise.
Regards,  |
|
| Back to top |
|
 |
corrupt
Joined: 29 Dec 2004 Posts: 2393
|
Posted: Sun Oct 21, 2007 7:08 pm Post subject: |
|
|
Hi Skan,
Using the beta version of the DLL is probably a better idea until I put together an updated version of the AHK function. The latest patched version of the DLL has a few significant changes, but only for a couple functions ATM. Sorry, I've been a bit tied up lately but will see about updating CMDret soon...  |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5811
|
Posted: Mon Oct 22, 2007 8:27 am Post subject: |
|
|
| corrupt wrote: | | Using the beta version of the DLL is probably a better idea until I put together an updated version of the AHK function. |
Thanks.  |
|
| Back to top |
|
 |
Mkbailey755
Joined: 20 Aug 2007 Posts: 168
|
Posted: Wed Oct 31, 2007 3:59 pm Post subject: |
|
|
*Bump
I'm trying to use this program to look for text inside of a telnet window so I can automate it basically I want to send keystrokes to it after the telnet script "NEWhoip" stops running. basically I WANT TO "RTFM" but cant find any instruction just prewritten code that I can't understand? Thank you in advance.
also is this the correct route or should I do more of an ORC |
|
| Back to top |
|
 |
shEiD Guest
|
Posted: Sat Nov 17, 2007 2:29 pm Post subject: CMDret_Stream output only after finished |
|
|
I'm having same problem as burtlo.
When I use CMDret_Stream with command line svf creating soft: cfv-1.18.1.exe.
when I use with winrar, all works perfectly, though with cfv - I get output only
when cfv is finished.
heres my code:
| Code: |
FileSelectFolder, destFolder
cfvCMD = C:\WINDOWS\cfv.bat -p "%destFolder%" -C -v
Gui, Add, Edit, x10 y10 r20 w280 vTestEdit, %Output%
Gui, Show, w300 h300 Center, Example
CMDret_Stream(cfvCMD,"optional",A_WorkingDir)
return
GuiClose:
ExitApp
CMDret_Output(CMDOut, CMDname="")
{
global Output
Output := Output "`n" CMDOut
GuiControl,,TestEdit, %Output%
}
|
Or maybe any1 knows some other commandline sfv creating soft, which I could use instead of this one? I tried "Command Line SFV Checker" and bloody thing doesnt even work on my system for some reason (winXP).
Thanks in advance. |
|
| Back to top |
|
 |
|