Menu

Changing the hotkey to scan

Help
Savas
2019-02-12
2020-01-11
  • Savas

    Savas - 2019-02-12

    Hello

    I'd like to use the hotkey, but I find the CTRL+S fiddly to press, I wanted to change this to something easier, but it's not in the settings so this would be a great feature to add, in my opinon, but in the mean time I'm trying to figure out how to change the source code myself to at least change the hotkey to something else.

    I'm a complete newb with the code and I can't find it. Can you narrow it down for me please?

    Thanks

    Savas

     
  • Matteo Rossi

    Matteo Rossi - 2019-02-12

    Dear Savas,

    thank you for contacting me. Unfortunately at the moment you have to edit the source code. The function that defines the hotkeys is located here: https://sourceforge.net/p/icopy/git/ci/master/tree/iCopy/Forms/mainfrm.vb#l156

     
  • Savas

    Savas - 2019-02-12

    Dear Matteo

    Thank you

    If I am not wrong, it's line 161:
    Case Keys.S 'Copy
    I changed it to "Volume_Up"
    Case Volume_Up 'Copy
    But it did not work. Am I close?

     
  • Matteo Rossi

    Matteo Rossi - 2019-02-12

    That is the correct line.
    Notice that you stil need to press CTRL + Vol Up.
    It might also be that Vol Up is not accessible to the application due to how Windows handles the special keys. Can you try with another letter key?

     
  • Savas

    Savas - 2019-02-12

    Hi Matteo

    So I think it's "Keys.VolumeUp", as per correction by editor. However when I go to build it gives me build errors.. I thought I'd test a clean version without touching it, but I still get build error, so I'm missing a .dll to compile.

    1>------ Build started: Project: iCopy, Configuration: Debug Any CPU ------
    1>TlbImp : error TI1023: Unable to locate specified reference: 'C:\Users\Savas\Desktop\icopy-git-d9ea575dc08e6fb41181e807a8494d449eeeb669\PDFWriter\bin\Debug\PDFWriter.dll'.
    1>D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2729,5): warning MSB3283: Cannot find wrapper assembly for type library "WIA". Verify that (1) the COM component is registered correctly and (2) your target platform is the same as the bitness of the COM component. For example, if the COM component is 32-bit, your target platform must not be 64-bit.
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    

    Maybe I have downloaded a bad version of the source code? I'm using Windows 10, 64 if that helps.

    I also want to remove the CTRL part, but I'm lost as yet.

    P.S. Thanks you again for helping and also making this great program. I'll try my best supporting you & donating soon.

     
  • Savas

    Savas - 2019-02-12

    I downloaded a snapshot via here - https://sourceforge.net/p/icopy/git/ci/master/tree/

     
  • Matteo Rossi

    Matteo Rossi - 2019-02-12

    You need to open and build the entire solution icopy.sln and not just the icopy project. This way the PDFWriter project gets compiled as well and its dependency is included.

    If you wanted to remove the CTRL, you should change the logic of the function a bit, something like this

    'Shortcuts
    If e.KeyCode = Key.VolumeUp
                    btnCopy_Click(btnCopy, ea)
    End If
    
    If e.Control Then 'If CTRL is pressed
            Dim ea As New EventArgs()
            Select Case e.KeyCode
                Case Keys.M 'Copy Multiple Pages
                    chkMultipage.Checked = Not chkMultipage.Checked
                Case Keys.F 'Scan to File
                    chkSaveToFile.Checked = Not chkSaveToFile.Checked
                Case Keys.I 'Image settings
                    btnImageSettings_Click(btnImageSettings, ea)
                Case Keys.P 'Scan to PDF
                    chkPDF.Checked = Not chkPDF.Checked
            End Select
    End If
    
     
  • Savas

    Savas - 2019-02-12

    Thanks for the start, I tweaked it a little to get it to work.

        Private Sub Hotkeys(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyUp
            'Shortcuts
            If e.KeyCode = Keys.Enter Then
                Dim ea As New EventArgs()
                btnCopy_Click(btnCopy, ea)
            End If
    
            If e.Control Then 'If CTRL is pressed
                Dim ea As New EventArgs()
                Select Case e.KeyCode
                    Case Keys.M 'Copy Multiple Pages
                        chkMultipage.Checked = Not chkMultipage.Checked
                    Case Keys.F 'Scan to File
                        chkSaveToFile.Checked = Not chkSaveToFile.Checked
                    Case Keys.I 'Image settings
                        btnImageSettings_Click(btnImageSettings, ea)
                    Case Keys.P 'Scan to PDF
                        chkPDF.Checked = Not chkPDF.Checked
                End Select
            End If
        End Sub
    

    Unfortunately though I still get build errors.

    1>------ Build started: Project: iCopy, Configuration: Debug Any CPU ------
    1>D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4551,5): error MSB3030: Could not copy the file "C:\Users\Savas\Desktop\icopy\iCopy\README.html" because it was not found.
    ========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
    

    I created a README.html which solved the problem, however I think I need to fix VB as I get:

    Exception Unhandled
    System.TypeInitializationException: 'The type initializer for 'iCopy.appControl' threw an exception.'
    BadImageFormatException: Could not load file or assembly 'Interop.WIA, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

    I think I need to update my runtime? Or do I need to get the exact version as the source?

     
  • Savas

    Savas - 2019-02-12

    So I went to app.config and changed the startup as below:

    <startup>
      <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
    </startup>
    

    That seemed to work, is this OK to do?

     
  • Matteo Rossi

    Matteo Rossi - 2019-02-12

    I suppose it is fine. You are using the latest development version of iCopy so it might be that I was experimenting with newer versions of the .NET Framework. OK for the README.html. The file is created by converting the file README.md with an extension of Visual Studio, but it is irrelevant.

     
  • Savas

    Savas - 2019-11-30

    Hi Matteo, I have been short on funds for a bit, but really wanted to donate for your great program, plus support here. I keep having issues with donating. Is your donation paypal still working?

     
  • Matteo Rossi

    Matteo Rossi - 2019-12-01

    Hi! Thanks a lot for your support! I think the PayPal donation is still working: you can find the link here: https://icopy.sourceforge.io/donate/. Let me know if you have problems!

     
  • Matteo Rossi

    Matteo Rossi - 2019-12-01

    Hi! Thanks a lot for your support! I think the PayPal donation is still working: you can find the link here: https://icopy.sourceforge.io/donate/. Let me know if you have problems!

     
  • raybright

    raybright - 2020-01-11

    Feature Request - Currently using version 1.7.0.3 Would like option to provide a password to open generated pdf files

     

Log in to post a comment.