practical application of parashell "read"

2014-01-02
2014-06-21
  • Chalk-X CPG

    Chalk-X CPG - 2014-01-02

    Obviously parashell will read the bits of the parallel port and display the result on the DOS command line as a numeric value between 0 and 255. But how can the returned value be used in subsequent DOS commands to achieve conditional results. I'd like to do some simple automation from DOS batch files that will read the bits of the parallel port, then log the results or possibly launch apps based on the read result. Does someone out there know how to incorporate the read result into DOS "If, then" statements, or otherwise make practical use of the read in DOS? Thanks in advance for your help.

     
  • Brett Carroll

    Brett Carroll - 2014-02-10

    Sounds like you want to capture the result from parashell and execute another process based on that result. This can easily accomplished with an IF statement in a DOS batchfile. (run if /? for more information)

    The attached DOS batch file contains an example of what I think you are looking for. Just change the if statements to suite your needs.

    @echo off
    
    REM capture STDOUT from parashell in a variable named parashell
    for /f "tokens=*" %%a in ('parashell.exe') do set parashell=%%a
    
    REM print the captured value
    echo %parashell%
    
    REM execute a command based on the value from parashell
    if %parashell% EQU 0 dir /w C:
    if %parashell% EQU 1 dir /w C:\Windows
    if %parashell% EQU 2 type C:\Windows\System32\drivers\etc\hosts
    if %parashell% EQU 3 route print
    if %parashell% EQU 4 ipconfig
    if %parashell% EQU 5 arp -a
    if %parashell% GTR 5 echo parashell output is greater than 5
    if %parashell% LSS 50 echo parashell output is less than 50
    
    REM you can use nested if statements to get even more input possibilities
    if %parashell% GTR 49 (
        if %parashell% LSS 200 (
            echo parashell output is greater than 50 and less than 200
        )
    )
    
     
  • Chalk-X CPG

    Chalk-X CPG - 2014-05-09

    I know it's been a while...but I successfully tested this today and implemented it in an automation application. I had to slow down my polling loops to avoid an error message from Windows regarding Perl56.dll. Other than that, it works beautifully. Thanks a million Brett for your knowledge beyond my own.

     
  • Chalk-X CPG

    Chalk-X CPG - 2014-06-07

    Okay...I've encountered another problem. Parashell worked great on the one particular Dell workstation at my desk. I could read from and write to the data port with no trouble. But when I tried to implement my scripts on other PCs (all running Windows XP Pro) it didn't work. One machine in particular, Dell Precision T5500, would write to the data port, but wouldn't actually read the pins. I tried every option in the bios for the printer port, to no avail. I finally managed to read the status pins, but to do so had to use "-mode c" rather than "-mode s"...goofy. So I'm not able to make Parashell work consistently across the platform...very disappointing. I don't know if the issue is Parashell itself, or the inpout32.dll driver. I hope somebody can enlighten me and give me a way to make this work consistently. I have lots of automation applications for this utility if I can make it work reliably.

     
  • Chalk-X CPG

    Chalk-X CPG - 2014-06-21

    In addition to the issue described in my previous post, I've also not been able to make ParaShell work at all on my Windows 7 machine, Dell Precision T5500. Any thoughts?

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks