Hi, I'm new here and evaluating the VB.NET Twain SDK for Kodak i5850.
we would like to scan jobwise an load twain settings from file. To adjust the scanjobs, we want to use the GUI of the twain driver in that way:
1. device.LoadSettings(fs) 'loading the scanner settings from file
2. <adjust by GUI>
3. device.SaveSettings(fs) 'save the new scanner setting to file
Actually I cannot find a method to call the Twain UI without scanning (only to adjust). I know from another scan software the this is possible for this scanner and twain driver.
Thank you very much.
Sincerely, Hans
Do scanner setting by Twain GUI (CustomDsData)
Moderator: Alex
-
- Posts: 5
- Joined: Wed Jan 04, 2023 4:57 pm
-
- Site Admin
- Posts: 2397
- Joined: Thu Jul 10, 2008 2:21 pm
Re: Do scanner setting by Twain GUI (CustomDsData)
Hi Hans,
If you want to change the device settings only, you need to use the Device.ShowSetupDialog method.
Best regards, Alexander
If you want to change the device settings only, you need to use the Device.ShowSetupDialog method.
Best regards, Alexander
-
- Posts: 5
- Joined: Wed Jan 04, 2023 4:57 pm
Re: Do scanner setting by Twain GUI (CustomDsData)
Hi Alex,
thank you very much for your information. Loading the settings works fine:
device.Open()
LoadSettings("C:\_Share\Source\_NET\VintaSoft\Patch2_i5850.twn", device)
device.ShowSetupDialog() 'to adjust some new settings
but saving the new settings does not work, obiously because the device is closed by ShowSetupDialog(),
SaveSettings(device, "C:\_Share\Source\_NET\VintaSoft\Patch2_i5850_out.twn")
device.Close()
When reopening the device an saving then, the adjstments made in ShowSetupDialog() are not present in the new file "Patch2_i5850_out.twn", There seems to be default settings. What can I do do preserve / save the Settings?
Sincerely, Hans
Public Sub LoadSettings(ByVal sFile As String, ByVal device As Vintasoft.Twain.Device)
Using fs As New IO.FileStream(sFile, IO.FileMode.Open, IO.FileAccess.Read)
device.LoadSettings(fs)
End Using
End Sub
Public Sub SaveSettings(ByVal device As Vintasoft.Twain.Device, ByVal sFile As String)
Using fs As New System.IO.FileStream(sFile, System.IO.FileMode.Append, System.IO.FileAccess.Write)
device.SaveSettings(fs)
End Using
End Sub
thank you very much for your information. Loading the settings works fine:
device.Open()
LoadSettings("C:\_Share\Source\_NET\VintaSoft\Patch2_i5850.twn", device)
device.ShowSetupDialog() 'to adjust some new settings
but saving the new settings does not work, obiously because the device is closed by ShowSetupDialog(),
SaveSettings(device, "C:\_Share\Source\_NET\VintaSoft\Patch2_i5850_out.twn")
device.Close()
When reopening the device an saving then, the adjstments made in ShowSetupDialog() are not present in the new file "Patch2_i5850_out.twn", There seems to be default settings. What can I do do preserve / save the Settings?
Sincerely, Hans
Public Sub LoadSettings(ByVal sFile As String, ByVal device As Vintasoft.Twain.Device)
Using fs As New IO.FileStream(sFile, IO.FileMode.Open, IO.FileAccess.Read)
device.LoadSettings(fs)
End Using
End Sub
Public Sub SaveSettings(ByVal device As Vintasoft.Twain.Device, ByVal sFile As String)
Using fs As New System.IO.FileStream(sFile, System.IO.FileMode.Append, System.IO.FileAccess.Write)
device.SaveSettings(fs)
End Using
End Sub
-
- Site Admin
- Posts: 2397
- Joined: Thu Jul 10, 2008 2:21 pm
Re: Do scanner setting by Twain GUI (CustomDsData)
Hi Hans,
After calling the Device.ShowSetupDialog method you need wait for Device.UserInterfaceClosed event and close/disable the device in the event handler if this necessary. Please save settings and close the device in handler of Device.UserInterfaceClosed event.
Best regards, Alexander
After calling the Device.ShowSetupDialog method you need wait for Device.UserInterfaceClosed event and close/disable the device in the event handler if this necessary. Please save settings and close the device in handler of Device.UserInterfaceClosed event.
Best regards, Alexander
-
- Posts: 5
- Joined: Wed Jan 04, 2023 4:57 pm
Re: Do scanner setting by Twain GUI (CustomDsData)
Hi Alex,
thank you again, I forgot to disable the device. How can I see if ShowSetupDialog was cancelled?
Kind regards, Hans
thank you again, I forgot to disable the device. How can I see if ShowSetupDialog was cancelled?
Kind regards, Hans
-
- Site Admin
- Posts: 2397
- Joined: Thu Jul 10, 2008 2:21 pm
Re: Do scanner setting by Twain GUI (CustomDsData)
Hi Hans,
TWAIN specification does not allow to determine if "OK" or "Cancel" button is clicked in TWAIN GUI.
Best regards, Alexander
TWAIN specification does not allow to determine if "OK" or "Cancel" button is clicked in TWAIN GUI.
Best regards, Alexander
-
- Posts: 5
- Joined: Wed Jan 04, 2023 4:57 pm
Re: Do scanner setting by Twain GUI (CustomDsData)
Thanks, Alex!