Jump to content

windows 10 "windows Fax and Scan" automate scan button


Go to solution Solved by ioa747,

Recommended Posts

Certainly! Automating the "Windows Fax and Scan" application in Windows 10 using AutoIt involves interacting with the GUI elements and performing actions like clicking buttons. Below is an example script to automate the "Scan" button in the "Windows Fax and Scan" application:

Run("C:\Windows\System32\WFS.exe") 
ControlClick("Windows Fax and Scan", "", "[CLASS:Button; TEXT:Scan]")

when i run this code but no activity .... i tried "AutoIt Window Info (x64)" but i unable to catch issue .... i will be very thankfull if somebody give me advice / hint .... 

1.png

2.png

Link to comment
Share on other sites

  • Solution
#AutoIt3Wrapper_UseX64=y
ConsoleWrite(@SystemDir & @CRLF)

Run("C:\Windows\system32\WFS.exe")
$hWnd = WinWait("Windows Fax and Scan", "", 3)
ConsoleWrite("$hWnd=" & $hWnd & @CRLF)

If $hWnd Then
    WinActivate($hWnd)

    ; With ControlCommand
    ControlCommand($hWnd, "", "ToolbarWindow322", "SendCommandID", 177) ;from Au3Info ToolBar tab

;~  ; With send
;~  Send("!fns") ;Alt f n s

;~  ; With Menu
;~  WinMenuSelectItem($hWnd, "", "&File", "&New", "&Scan")
EndIf

 

I know that I know nothing

Link to comment
Share on other sites

I didn't continue because I don't have a scanner, and therefore I don't know the ClassnameNN from the scan button, in the new scan dialog

if I assume that the  ClassnameNN , is Button2  (which you find with Au3Info, in the control tab  Examlpe )

then it would go something like this
 

#AutoIt3Wrapper_UseX64=y
ConsoleWrite(@SystemDir & @CRLF)

Run("C:\Windows\system32\WFS.exe")

; Wait the Fax and Scan win
$hWnd = WinWait("Windows Fax and Scan", "", 3)
ConsoleWrite("$hWnd=" & $hWnd & @CRLF)
If $hWnd Then
    WinActivate($hWnd)

    ; With ControlCommand
    ControlCommand($hWnd, "", "ToolbarWindow322", "SendCommandID", 177) ;from Au3Info ToolBar tab

    ; Wait the New Scan win
    $hScanDlg = WinWait("New Scan", "", 3)
    ConsoleWrite("$hScanDlg=" & $hScanDlg & @CRLF)
    If $hScanDlg Then
        ;WinActivate($hScanDlg)
        ControlClick($hScanDlg, "", "Button2")
    EndIf
EndIf

 

I know that I know nothing

Link to comment
Share on other sites

Complete working code

 

#AutoIt3Wrapper_UseX64=y
ConsoleWrite(@SystemDir & @CRLF)

Run("C:\Windows\system32\WFS.exe")
$hWnd = WinWait("Windows Fax and Scan", "", 3)
ConsoleWrite("$hWnd=" & $hWnd & @CRLF)

If $hWnd Then
    WinActivate($hWnd)

; With ControlCommand
ControlCommand($hWnd, "", "ToolbarWindow322", "SendCommandID", 177) ;from Au3Info ToolBar tab

;~  ; With Menu
WinMenuSelectItem($hWnd, "", "&File", "&New", "&Scan")
 
; Wait the New Scan win
$hScanDlg = WinWait("New Scan", "", 3)
ControlClick($hScanDlg, "", "Button4")

 
EndIf

 

Edited by meethayaam
coding in progress
Link to comment
Share on other sites

both commands do the same thing

here he clicks on the toolbar in the new scan

; With ControlCommand
ControlCommand($hWnd, "", "ToolbarWindow322", "SendCommandID", 177) ;from Au3Info ToolBar tab

and here it calls the menu file>new>scan

;~  ; With Menu
WinMenuSelectItem($hWnd, "", "&File", "&New", "&Scan")

see which one works best for you, and delete the other one

I know that I know nothing

Link to comment
Share on other sites

compile this code and F1 for SCAN 

 

#AutoIt3Wrapper_UseX64=y
HotKeySet("{F1}", "scan")

While 1
    Sleep(100)
WEnd

Func scan()


ConsoleWrite(@SystemDir & @CRLF)

Run("C:\Windows\system32\WFS.exe")
$hWnd = WinWait("Windows Fax and Scan", "", 3)
ConsoleWrite("$hWnd=" & $hWnd & @CRLF)

If $hWnd Then
    WinActivate($hWnd)

;~  ; With Menu
WinMenuSelectItem($hWnd, "", "&File", "&New", "&Scan")
 
; Wait the New Scan win
$hScanDlg = WinWait("New Scan", "", 3)
ControlClick($hScanDlg, "", "Button4")

EndIf


EndFunc

 

Edited by meethayaam
#AutoIt3Wrapper_UseX64=y directives is placed at the top of the script
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...