July 20, 2007 at 5:59 pm #22179
I’m searching for a simple command line app console, isn’t this avaiable?
twainscan.exe -s scanner1 -d c:dest.jpg -dpi 200 -type bw
It’s a simple example, where the -s -d -dpi -type are the switches.
That app console will simple a lot things.
ThanksJuly 20, 2007 at 8:19 pm #23967
opentwain has a commandline sample. If you get more specific with what you want to be available for options|switches and output I’ll think them over – the current build is profile driven with a setup setup that involves configuration of the drivers with thier gui, but when you’re taking images off the device in production it is all cmd line.
In general you don’t see alot of command line twain apps because the twain specification calls for a handle that the cmdline doesn’t typically have. There is also a commercial product that already does a whole bunch of stuff – I’ll look for the link – it might have been called commander twain… I’ll look it up. No idea what the price tag is.
Are you looking for a ready to go product or are you a programmer looking for a sample?
.July 21, 2007 at 1:33 pm #23968
I’m a programmer looking for a sample.
I haven’t found the command line instructions on opentwain, lots of examples but mixed and confused with the source code.
The command line app don’t have to have all the power of the twain, but I think a simple with the essencial will be useful for many people. Simple like what the custom interface wiaacmgr.exe or twain gui default can do.
Maybe the switches of brigthness/contrast too, as I don’t mention it before.
ThanksJuly 21, 2007 at 1:46 pm #23969
…havent found the instructions…
no, they don’t really exist. The commandline sample is a proof of concept and no it doesn’t explore the twain spec quite the way that the winforms sample does, but it uses the same core twain library as the windforms sample – anything the gui can do the cmdline can as well.
brigthness/contrast/dpi/etc – those would be more appropriate for a library that ws built to manipulate the device capabilities one-by-one. The profile driven approach I took has you use the regualar device gui for the setup phase and then the settings that you configured from the gui are run later. I’ve added some of the individual capabilites to the library and will eventually add the whole set (well… maybe not the audio ones..) becasue people keep asking for the ability to configure devices that way but I don’t believe that it is a succuessful model so… I’m doing it but my heart isn’t in it the same way so it’s going real slow. If you want to talk about extending the commandline interface to opentwain send me an email or IM.
.July 21, 2007 at 1:55 pm #23970
Where can I see a command line sample of the opentwain?
I’m new to twain, so I really don’t understand why it doesn’t auto-configure for the detected scanners like wiaacmgr.exe does.
Don’t know why is too difficult to create a command line console that simple calls the specific entry points of the twain.dll, giving it the instrunctions, I have tried but no success yet, as I’m not familiar with the twain, but I’m trying.July 21, 2007 at 2:26 pm #23971
the main trick to getting twain to work with the commandline is the messagepump and handle that twain requires. console apps don’t pump messages the way that traditional gui apps do. The main workaround (that I’ve found) is the same one you would use if you wanted to work with twain from a service, as services lack a lot of the same things as console apps when it comes to working with twain. you create a class that inherits from nativeWindow to talk to twain for you.
from there, why is a simple app difficult… difficult isn’t quite the work I would use., maybe monotonous. With the 270ish seperate capabilities defines in the twain (without considering the custom capabilites that will end up being a whole seperate kind of pain later) and the conbination of dependancies for those caps you end up with miles of code. Or, you skip the idea of altering/setting caps one-by-one and instead you use the Ui that comes with the device for setup related stuff and then save the setup as a profile and later run all of the setting together. It’s a cleaner method, plus you no longer worry (as much) about dealing with devices that don’t quite follow the protocol. Instead you take the device’s Ui as thier contract (and don’t try to hold the vendors to a protocol that they more often than not don’t follow in the first place).
I hope that helps somewhat, but again if you want to see opentwain offer more from the console sample shoot me an IM or email.
.July 30, 2007 at 2:07 am #23972AnonymousParticipant
- Topics - 60
- Replies - 107
- Total Posts - 167
I too am interested in a simple command line app to capture a frame from my webcam.
If there are lots of configuration options that make this difficult, might there be a gui to setup the options, and then a command line program to trigger the capture, as the OP has suggested?
I would also settle for a “default” settings simple grab a picture. Then I can write a script (driven from a .cgi server side script) to copy the file into a directory accessable from my web server. Then I could monitor my house when on travel.July 30, 2007 at 1:17 pm #23973
Help me on this, I don’t know how to write a batch scan. 🙁
Dim b As New TwainLib.Twain
b.Acquire(TwainLib.TwSS.TwSS_A4, , , TwainLib.TwColourType.twBW)
What is missing..? 🙄July 30, 2007 at 3:20 pm #23974
When you define the library define it ‘withevents’ and then add handlers for the events.
The commnd line sample in openTwain is an interactive prompt (if I remember correctly) but if you look thru Module1 you’ll only see 7 or 8 functions (depending if you count the one that writes out the help).
None of the samples take capability parameters, you’ll use the device’s Ui to configure a device and when you have a configuration you’ll just call the profile by name.July 30, 2007 at 3:31 pm #23975
It gives me this error:
EventType : clr20r3 P1 : cmdharness.exe P2 : 220.127.116.11 P3 : 46aded44
P4 : mscorlib P5 : 18.104.22.168 P6 : 461eee3d P7 : e0 P8 : 16
P9 : system.argumentoutofrangeJuly 30, 2007 at 3:42 pm #23976
what does? are ou using the 2.0 framework?July 30, 2007 at 3:52 pm #23977
When I select ” 2- setup” gives “failure event”, when I select 3 it shows the gui. Isn’t possible to scan without always show the gui?
I’m using framework 2.0July 30, 2007 at 3:59 pm #23978
I think profiles should be an array, and who controls that shouldn’t be mixed, should be the host.
Sorry for the bad englishJuly 30, 2007 at 4:11 pm #23979
2, failure event. If you’re looking at the Setup method from the sample there should be two exception handlers, If you step thru uld bethe code you should be able to see what exception is being thrown.
>Isn’t possible to scan without always show the gui?
With the cmdHarness as I have it on the site today? No. With the opentwain library? Yes. . Run the guiharness, look thru the profileEditor. You should be able to see how I build a profile, save the profile, and then execute it later. On the profile editor you should see two checkboxs – one says ‘show Ui’ the other says ‘Show indicators’. Uncheck them. If you want to add the code from the guiharness to the cmdharness you are more than welcome to. The guiHarness is a more complete sample of the library, the cmdHarness is just a demo that the library can acquire from the cmdline – no frills. Everything the guiHarness can do the cndHarness *can* also do as they both use the sample library, but it doesn’t handle all of the options.July 30, 2007 at 4:37 pm #23980
But when I try to add a profile, it gives me “This device doesn’t seem to support a required capability: EnableDsUiOnly”
This is why I think the profiles should be managed by host.
If only I can put this working..
Can you help me complete this?
Dim a As openTwain.Twain
- This topic has 22 replies, 5 voices, and was last updated 8 years, 5 months ago by .
Viewing 15 posts - 1 through 15 (of 23 total)
Viewing 15 posts - 1 through 15 (of 23 total)