Jump to content
dreivilo47

[SOLVED] How to solve this problem?

Recommended Posts

dreivilo47

When I use the following code I receive an UAC message:
 

#RequireAdmin
RunWait("msiexec /i winzip205-64.msi /quiet")
Exit

How can I hide (bypass) the UAC message?

Edited by dreivilo47

Share this post


Link to post
Share on other sites
AutoBert

Turn UAC off in registry. A system with enabled UAC allway show a UAC message.

Share this post


Link to post
Share on other sites
dreivilo47
6 minutes ago, AutoBert said:

Turn UAC off in registry. A system with enabled UAC allway show a UAC message.

Thanks for the suggestion AutoBert.
How can I turn off UAC in registry before RunWait and turn it on again after RunWait?

 

Share this post


Link to post
Share on other sites
AutoBert

RegRead and RegWrite are needed. But therefor you need also #RequireAdmin which shows a UAC Message.

Share this post


Link to post
Share on other sites
orbs

@dreivilo47,

this i not a "problem", and you do not "solve" it.

if you hate UAC on your own machine, then by all means suppress it as suggested (although that may cause other issues). but that is not the case, is it?

to perform an administrative task by a script, then before you begin, make sure your script runs with administrative rights in effect. how you do that depends on your system/network configuration. for examples, you can remotely create a scheduled task to run with the target local SYSTEM account; you can do it with PsExec; you can make use of a deployment tool installed in your network; you can write a background agent to do that; etc.

if you describe your environment, we can suggest the preferred method.

Share this post


Link to post
Share on other sites
dreivilo47
On 27-8-2016 at 11:28 AM, AutoBert said:

Turn UAC off in registry. A system with enabled UAC allway show a UAC message.

@AutoBert, turning off UAC in registry (change value EnableLUA to 0) needs a reboot before it works.  I want to avoid that.

Share this post


Link to post
Share on other sites
dreivilo47
On 27-8-2016 at 0:18 PM, orbs said:

@dreivilo47,

this i not a "problem", and you do not "solve" it.

if you hate UAC on your own machine, then by all means suppress it as suggested (although that may cause other issues). but that is not the case, is it?

to perform an administrative task by a script, then before you begin, make sure your script runs with administrative rights in effect. how you do that depends on your system/network configuration. for examples, you can remotely create a scheduled task to run with the target local SYSTEM account; you can do it with PsExec; you can make use of a deployment tool installed in your network; you can write a background agent to do that; etc.

if you describe your environment, we can suggest the preferred method.

@orbs, in a couple of weeks I need to install software on more than 100 new laptops.  And I want to automate that so it can be done faster.
These laptops are not connected to a network, so I want to use an USB flash drive with the software on it.
I don't hate UAC, but I want to suppress the uac prompt because it becomes irritant after doing a lot of computers.  It slows down.

Share this post


Link to post
Share on other sites
dreivilo47

@orbs, how you do that (in a post) the username beginning with an @ is highlighted?  :)

Share this post


Link to post
Share on other sites
orbs
2 hours ago, dreivilo47 said:

@orbs, how you do that (in a post) the username beginning with an @ is highlighted?  :)

sometimes it works, sometimes it doesn't. this version of the forum software is somewhat crappy.

2 hours ago, dreivilo47 said:

in a couple of weeks I need to install software on more than 100 new laptops.  And I want to automate that so it can be done faster.
These laptops are not connected to a network, so I want to use an USB flash drive with the software on it.

since anyway you are going to plug it in, open the folder, double-click the setup file, and press a few [Next] buttons... i see no reason that one more click should discourage you. especially if working around that single click is probably the most troublesome piece of action to automate, in your case. if this is a one-off operation, and these laptops are fire-and-forget (i.e. you do not keep maintaining them centrally), then i advise you just accept the UAC as it is.

but, you can also get adventurous. you have a couple of weeks to prepare. answer this: are all of those laptops configured with an enabled, password-protected administrative account?

if so, here's what you can consider:

prepare a small network: 8-port switch, one Windows machine, a DHCP service, and an empty desk fitting for 7 laptops.

configure said Windows machine as follows: it constantly monitoring the LAN, whenever a new IP is discovered, it connects to it over PsExec with said admin account to perform the installation. when installation done, it checks if it was successful. if so, it sends a power-off command to the target.

what you do is this: unpack a laptop, connect it to the network, power it on. visit the laptop after few minutes. if it is shut down, repack it and ship to end user (or, randomly picking, disconnect from network, power on and validate the installation yourself). if it is not shut down, then something went wrong with the installation, check the cause or just install manually. you can do several laptops simultaneously like that.

good luck!

 

 

 

 

 

Share this post


Link to post
Share on other sites
dreivilo47

@orbs,
- Good to know about the username beginning with an "@".
- You're right, I am going to accept the UAC as it is.
- I don't know of all of them are configured with an enabled, password-protected administrative account.
- Thank you very much for the information about the small network!

Edited by dreivilo47

Share this post


Link to post
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

  • Similar Content

    • somebadhat
      By somebadhat
      THANKS TO RASIM, MARTIN, AND BOOMINGRANNY FOR TEACHING ME HOW TO DO THIS. 
      SCRIPT ONE WORKS ON MY PLATFORM.  IT CREATED THE ATTACHMENTS.
      IMPROVEMENTS ARE WELCOMED. 
      SEE BOLD TEXT BELOW.
      PURPOSE:
      WRITE AN AUTOIT3 SCRIPT THAT WHEN RUN IN A WINDOWS SCHEDULED TASK WILL PRODUCE SCREENSHOTS OF THE DESKTOP, START MENU, QUICK ACCESS MENU, AND DEVICE MANAGER WITHOUT INTERACTION.  IF MULTIPLE SHOTS ARE REQUIRED THE SHOTS CAN BE COMBINED STACKED OR SIDE-BY-SIDE.  SCRIPTS ARE WRITTEN TO RUN ON WINDOWS 10.0.17134.286 PRO 64-BIT IN AN ACCOUNT WITH ADMIN PRIVILEGES IN A WINDOW WITH ADMIN PRIVILEGES AND AUTOIT3 v3.3.14.5
      PROCEDURE:
      WHAT ARE THE COORDINATES OF THE SCREENSHOTS?
      WHERE DO YOU WANT TO CREATE THE SHOTS?
      WHAT DO YOU WANT TO CALL THE SHOTS?
      TAKE THE SHOTS.
      PROCESS THE SHOTS:
      WHERE ARE THEY? WHAT ARE THEY CALLED? WHERE DO YOU WANT THEM TO GO? WHAT DO YOU WANT TO CALL THEM? DO YOU WANT THEM STACKED, SIDE-BY-SIDE, OR NEITHER? TWEAK TO ELIMINATE ERRORS.
      RESULTS: SCRIPT TWO I'VE INCORPORATED THE SUGGESTION OF @BOOMINGRANNY AND MADE A SECOND SCRIPT.  MY WAY OF FINDING THE SHOT COORDINATES OF THE DEVICE MANAGER DID NOT WORK WHEN STARTING THE DEVICE MANAGER THIS WAY . #include <Coordinates.au3> finds incorrect coordinates.  They are shifted down ~50px.  Does not work on menus exposed by right clicking or the start menu. WORK NEEDS TO BE DONE TO ELIMINATE THE BLACK BAR WHEN THE SHOTS ARE NOT THE SAME HEIGHT and ARE BEING DISPLAYED SIDE-BY-SIDE. 
      SEE    If $Position = "right"
      CONCLUSION:
      UNFINISHED AS OF THIS TIME.
      MAKE ROBUST.  A ROBUST SCRIPT FAILS LESS THAN 1% OF THE TIME AND RUNS ON WINDOWS 10 64-BIT THROUGH WINDOWS XP 32-BIT SP0 IN AN ACCOUNT WITH STANDARD/USER/LIMITED PRIVILEGES IN A WINDOW WITH STANDARD/USER/LIMITED PRIVILEGES.   IT WOULD BE NICE TO MAKE THE SCRIPT FASTER AND LIGHTER.

      RESULTS ATTACHED. SCRIPT ONE:
      ;; AUTOIT3 v3.3.14.5 SCRIPT ;; PURPOSE: ; WRITE AN AUTOIT3 SCRIPT THAT WHEN RUN IN A WINDOWS SCHEDULED TASK WILL PRODUCE SCREENSHOTS OF THE WINDOWS 10 DESKTOP, START MENU, QUICK ACCESS MENU, AND DEVICE MANAGER WITHOUT INTERACTION. ;; SEE https://www.autoitscript.com/forum/topic/196256-screenshot-win10-desktop-quick-access-device-manager-start-menu-automated-shots-stacked-or-side-by-side-requires-admin/ ;; MUST BE RUN WITH ADMIN PRIVILEDGES. NOT ROBUST YET. ;; SCREENSHOT WIN10 DESKTOP, QUICK ACCESS, DEVICE MANAGER AND START MENU. ;; MULTIPLE SHOTS JOINED STACKED, SIDE-BY-SIDE, OR NEITHER. SEE SIDE-BY-SIDE ;; WORK NEEDS TO BE DONE TO ELIMINATE THE BLACK BAR WHEN THE SHOTS ARE NOT THE SAME HEIGHT AND ARE BEING DISPLAYED SIDE-BY-SIDE. ;; MY GUESS THE EASIEST THING TO DO WOULD BE TO TURN IT WHITE. ;; YOU WILL HAVE TO TELL IT WHERE YOUR TASKBAR EXPLORER SHORTCUT IS. SEE MouseClick ( "right", 74, 748, 1, 0) ;; YOU WILL HAVE TO TELL IT WHERE TO PROCESS AND MOVE THE SHOTS. SEE MULTIPLE OF $ZDIR, $ZNAME, FQPN SEE $outputFile ;; ;; IMPROVEMENTS ARE WELCOMED ;; FIND LIST OF ENVIRONMENT VARIABLES NAMES ;; AUTOIT3 HELP File ;; "C:\Program Files (x86)\AutoIt3\AutoIt.chm" ;; SEARCH FOR MACRO REFERENCE AND MACRO REFERENCE - DIRECTORY ;; THANKS TO RASIM, MARTIN, AND BOOMINGRANNY AT AUTOITSCRIPT.COM ; https://www.autoitscript.com/forum/topic/80896-join-two-bitmap-images/ ; https://www.autoitscript.com/forum/topic/80896-join-two-bitmap-images/?do=findComment&comment=581214 ; https://www.autoitscript.com/forum/topic/80896-join-two-bitmap-images/?do=findComment&comment=581372 ; https://www.autoitscript.com/forum/topic/196256-screenshot-win10-desktop-quick-access-device-manager-start-menu-automated-shots-stacked-or-side-by-side-requires-admin/ ; https://www.autoitscript.com/forum/topic/196256-screenshot-win10-desktop-quick-access-device-manager-start-menu-automated-shots-stacked-or-side-by-side-requires-admin//?do=findComment&comment=1407181 ;; "C:\Program Files (x86)\AutoIt3\AutoIt3_x64.exe" "F:\MYAPPS\WINDOWS\screenshots1.au3" ;; Screenshot Win10 desktop, quick access, device manager, start menu. Automated. Shots stacked or side-by-side. Requires admin. ; BEGIN How to get 4 Screen Coordinates just by dragging a Rectangle ; download Coordinates.au3 https://www.autoitscript.com/forum/applications/core/interface/file/attachment.php?id=59228 ; END How to get 4 Screen Coordinates just by dragging a Rectangle ; BEGIN CAPTURE ; https://www.autoitscript.com/forum/topic/8377-capture-screen-dll/ ; Capture full screen ; Fist parameter - filename, last - jpeg quality. #include <ScreenCapture.au3> ; BEGIN THE FOLLOWING REQUIRED TO SHOOT THE ENTIRE DEVICE MANAGER IN ONE SHOT ; https://www.autoitscript.com/forum/topic/196256-screenshot-win10-desktop-quick-access-device-manager-start-menu-automated-shots-stacked-or-side-by-side-requires-admin//?do=findComment&comment=1407181 ; credit for the screenshot scrolling code goes to monoscout999 #include <ScrollBarsConstants.au3> #include <WindowsConstants.au3> #include <process.au3> #include <GuiTreeView.au3> #include <GuiScrollBars.au3> #include <WinAPISysWin.au3> ; END THE FOLLOWING REQUIRED TO SHOOT THE ENTIRE DEVICE MANAGER IN ONE SHOT ; BETTER RESULTS IF AT LEASE ONE EXPLORER WINDOW IS OPEN Run("explorer.exe", "", @SW_SHOWMINIMIZED) ; Run( @comspec & " /c start explorer.exe","", @SW_SHOWMINIMIZED) ; Run( @comspec & " /c start explorer.exe","", @SW_HIDE) WinWait("My Computer") ; WinActivate("My Computer") ; WinSetState("My Computer", "", @SW_MAXIMIZE) ; wake the monitor, show the desktop, wait X milliseconds ; Send(" ") send( "#d" ) Sleep( 500 ) ; QUICK ACCESS ; https://www.autoitscript.com/autoit3/docs/functions/MouseClick.htm MouseClick ( "right", 74, 748, 1, 0 ) ; right click windows explorer shortcut on taskbar to open context menu Sleep( 250 ) send("{PGDN}") ; expose the most pinned items Sleep( 250 ) send("{down}") ; expose the most pinned items $ZDIR=@homeDrive & "\Users\Default\Desktop\UPDATE" ;where does the screenshot go $ZNAME="\quick-access.jpg" ;what will its name be $ZTOPX=0 $ZTOPY=0 $ZBOTTOMX=250 $ZBOTTOMY=615 Sleep( 500 ) ScreenShot() ; Sleep( 2000 ) MouseClick ( "left", 74, 748, 1, 0 ) ; left click windows explorer shortcut on taskbar to close context menu send( "#d" ) ; show desktop ; exit ; START MENU Sleep( 500 ) send("{LWIN}") ;OPEN START MENU $ZDIR=@tempDir ;where does the screenshot go $ZNAME="\start-menu1.jpg" ;what will its name be $ZTOPX=315 $ZTOPY=139 $ZBOTTOMX=1285 $ZBOTTOMY=660 Sleep( 1250 ) ScreenShot() ; BEGIN WEAK POINT send("{tab}"); COMBINING TABS BREAKS SCRIPT Sleep( 120 ) send("{tab}") Sleep( 120 ) send("{tab}") Sleep( 500 ) send("{down 8}"); move to the bottom of the start menu to take the next screenshot. operates on the first column of shortcuts. will only go to the bottom of it. add send("{right}") after the last tab to operate on another column. ; END WEAK POINT ; $ZDIR=@tempDir ;where does the screenshot go $ZNAME="\start-menu2.jpg" ;what will its name be $ZTOPX=315 $ZTOPY=409 $ZBOTTOMX=1285 $ZBOTTOMY=730 Sleep( 125 ) ScreenShot() send("{LWIN}") ; CLOSE THE START MENU ; DESKTOP $ZDIR=@homeDrive & "\Users\Default\Desktop\UPDATE" ;where does the screenshot go $ZNAME="\desktop.jpg" ;what will its name be $ZTOPX=0 $ZTOPY=0 $ZBOTTOMX=-1 $ZBOTTOMY=-1 Sleep( 125 ) ScreenShot() ; BEGIN OPEN DEVICE MANAGER MAXIMIZED ; CHOOSE YOUR POISON Run( @comspec & " /c start devmgmt.msc","", @SW_HIDE) WinWait("Device Manager") WinActivate("Device Manager") WinSetState("Device Manager", "", @SW_MAXIMIZE) ; ; BEGIN SHOOTING THE DEVICE MANAGER THE FOLLOWING WAY REQUIRED: ; 1. IT BE DONE AT THE BEGINNING OF THE SCRIPT. ; 2. MORE WORK TO FIND THE COORDINATES: ; https://www.autoitscript.com/forum/topic/165325-how-to-get-4-screen-coordinates-just-by-dragging-a-rectangle/?do=findComment&comment=1206830 ; modified and saved as "C:\Program Files (x86)\AutoIt3\Include\Coordinates.au3" ; download Coordinates.au3 https://www.autoitscript.com/forum/topic/196256-screenshot-win10-desktop-quick-access-device-manager-start-menu-automated-shots-stacked-or-side-by-side-requires-admin/ ; Run("control /name Microsoft.DeviceManager") ; script must be run with admin privileges ; WinWaitActive("Device Manager") ; $WinHndl = WinGetHandle("Device Manager") ; WinMove($WinHndl,"",-4,0,@DesktopWidth+10,@DesktopHeight) ; MAKE ADJUSTMENTS HERE ; #include <Coordinates.au3> ; END SHOOTING THE DEVICE MANAGER THE FOLLOWING WAY REQUIRED: ; ; Run("mmc devmgmt.msc") ; WinActivate ( "Device Manager", "" ) ; Sleep( 125 ) ; WinSetState("[ACTIVE]", "", @SW_MAXIMIZE) ; Sleep( 125 ) ; WinSetState("Device Manager", "", @SW_MAXIMIZE) ; END OPEN DEVICE MANAGER MAXIMIZED Sleep( 1000 ) Send("{TAB}") Sleep( 250 ) send("{down 4}") Sleep( 250 ) send("{right}") ;DISK DRIVES Sleep( 250 ) send("{down2}") Sleep( 250 ) send("{right}") ;DISPLAY ADAPTERS Sleep( 250 ) send("{down 5}") Sleep( 250 ) send("{right}") ;IDE ATA/ATAPI CONTROLLERS Sleep( 250 ) send("{down 6}") Sleep( 250 ) send("{right}") ;NETWORK ADAPTERS $ZDIR=@tempDir ;where does the screenshot go $ZNAME="\device-manager1.jpg" ;what will its name be $ZTOPX=2 $ZTOPY=77 $ZBOTTOMX=272 $ZBOTTOMY=382 Sleep( 250 ) ScreenShot() send("{down 15}") Sleep( 250 ) send("{right}") ;SOUND, VIDEO, AND GAME CONTROLLERS Sleep( 250 ) send("{down 7}") ;MOVES NETWORK ADAPTERS TO THE $ZTOPY=273 POSITION $ZDIR=@tempDir ;where does the screenshot go $ZNAME="\device-manager2.jpg" ;what will its name be $ZTOPX=2 $ZTOPY=273 $ZBOTTOMX=272 $ZBOTTOMY=638 Sleep( 250 ) ScreenShot() Sleep( 1000 ) ; https://www.autoitscript.com/forum/topic/196256-screenshot-win10-desktop-quick-access-device-manager-start-menu-automated-shots-stacked-or-side-by-side-requires-admin//?do=findComment&comment=1407181 ; credit for the screenshot scrolling code goes to monoscout999 ; screenshot of everything in the device manager $outputFile = @HomeDrive&"\Users\Default\Desktop\UPDATE\device-manager2.jpg" ;get a handle of things $WinHndl = WinGetHandle("Device Manager") $Treeview = ControlGetHandle("Device Manager","","[Class:SysTreeView32]") ;expand the treeview control _GUICtrlTreeView_Expand($Treeview) MouseMove(300,200) MouseWheel("up",100) Sleep(250) ;Get Edit1 Vertical Scroll Min/Max range and page size. $aScrollRange = _GUIScrollBars_GetScrollRange($Treeview, $SB_VERT) $iPageSize = _GUIScrollBars_GetScrollInfoPage($Treeview, $SB_VERT) $iPages = Round($aScrollRange[1] / $iPageSize) ;get treeview control size $aTreeviewPos = ControlGetPos($WinHndl,"",$Treeview) ;Capture $scrollBarSize = 20 $hDC = _winapi_GetDC($Treeview) $hCDC = _WinAPI_CreateCompatibleDC($hDC) $hBMP = _WinAPI_CreateCompatibleBitmap($hDC, $aTreeviewPos[2] - $scrollBarSize , ($aTreeviewPos[3] * ($iPages +1 ))) _WinAPI_SelectObject($hCDC, $hBMP) For $i = 0 to $iPages+1 _WinAPI_BitBlt($hCDC, 0, $aTreeviewPos[3] * $i, $aTreeviewPos[2] - $scrollBarSize , ($aTreeviewPos[3] ), $hDC,0, 0, $SRCCOPY) _WinAPI_PostMessage($Treeview,$WM_VSCROLL,$SB_PAGEDOWN,0) Sleep(250) Next _WinAPI_ReleaseDC($Treeview, $hDC) _WinAPI_DeleteDC($hCDC) _GDIPlus_Startup() $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBMP) _GDIPlus_ImageSaveToFile($hImage, $outputFile) _GDIPlus_Shutdown() _WinAPI_DeleteObject($hBMP) ; If FileExists($outputFile) Then ShellExecute($outputFile) Sleep( 1000 ) ProcessClose ( "mmc.exe" ) ; close the device manager. THIS MIGHT BE WEAK. ; MouseMove ( 1150, 650) ; TO START, SECURE, SHUTDOWN SHORTCUT Sleep( 1000 ) ;; END CAPTURE ;; BEGIN JOIN IMAGES #include <GDIPlus.au3> #include <WinAPISysWin.au3> ; FULLY QUALIFIED PATH NAME (FQPN) TO FIRST IMAGE, FQPN TO SECOND IMAGE, FQPN TO COMBINED IMAGE ; _BMPJoin(@tempDir & "\start-menu1.jpg", @tempDir & "\start-menu2.jpg", @homeDrive & "\Users\Default\Desktop\UPDATE\start-menu.jpg", "right") ; SIDE-BY-SIDE ; _BMPJoin(@tempDir & "\device-manager1.jpg", @tempDir & "\device-manager2.jpg", @homeDrive & "\Users\Default\Desktop\UPDATE\device-manager.jpg", "") ; STACKED _BMPJoin(@tempDir & "\start-menu1.jpg", @tempDir & "\start-menu2.jpg", @homeDrive & "\Users\Default\Desktop\UPDATE\start-menu.jpg", "") _BMPJoin(@tempDir & "\device-manager1.jpg", @tempDir & "\device-manager2.jpg", @homeDrive & "\Users\Default\Desktop\UPDATE\device-manager.jpg", "") ;; END JOIN IMAGES Exit ; END OF SCRIPT ;; BEGIN SCREENSHOT FUNCTION Func ScreenShot() ; Capture full screen _ScreenCapture_Capture($ZDIR & $ZNAME, $ZTOPX, $ZTOPY, $ZBOTTOMX, $ZBOTTOMY) EndFunc ;==>ScreenShot ; https://www.autoitscript.com/autoit3/docs/libfunctions/_ScreenCapture_Capture.htm ; $iLeft [optional] X coordinate of the upper left corner of the rectangle ; $iTop [optional] Y coordinate of the upper left corner of the rectangle ; $iRight [optional] X coordinate of the lower right corner of the rectangle. If this is -1, the current screen width will be used. ; $iBottom [optional] Y coordinate of the lower right corner of the rectangle. If this is -1, the current screen height will be used. ;; END SCREENSHOT FUNCTION ;; BEGIN JOIN IMAGES FUNCTION ; https://www.autoitscript.com/forum/topic/80896-join-two-bitmap-images/ Func _BMPJoin($sFile1, $sFile2, $sResult, $Position) Local $hSourceIMG1, $hSourceIMG2, $iWidth1, $width2, $iHeight1, $iHeight2, $hBitmap, $hImage, $hGraphics Local $iBwidth, $iBheight If Not FileExists(StringRegExpReplace($sResult, "(^.*)\\.*", "\1")) Then $sResult = @ScriptDir & "\result.bmp" _GDIPlus_Startup() $hSourceIMG1 = _GDIPlus_ImageLoadFromFile($sFile1) $hSourceIMG2 = _GDIPlus_ImageLoadFromFile($sFile2) $iWidth1 = _GDIPlus_ImageGetWidth($hSourceIMG1) $iHeight1 = _GDIPlus_ImageGetHeight($hSourceIMG1) $iWidth2 = _GDIPlus_ImageGetWidth($hSourceIMG2) $iHeight2 = _GDIPlus_ImageGetHeight($hSourceIMG2) If $Position = "right" Then $iBwidth = $iWidth1 + $iWidth2 $iBheight = $iHeight1 if $iHeight2 > $iHeight1 then $iBheight = $iHeight2 ; WORK NEEDS TO BE DONE TO ELIMINATE THE BLACK BAR WHEN THE SHOTS ARE NOT THE SIZE HEIGHT AND ARE BEING DISPLAYED SIDE-BY-SIDE. Else;position = "below" $iBwidth = $iWidth1 if $iWidth2 > $iWidth1 then $iBwidth = $iWidth2 $iBheight = $iHeight1 + $iHeight2 EndIf $hBitmap = _CreateBMP($iBwidth, $iBheight) $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap) $hGraphics = _GDIPlus_ImageGetGraphicsContext($hImage) ; https://www.autoitscript.com/autoit3/docs/libfunctions/_GDIPlus_GraphicsDrawImageRectRect.htm _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hSourceIMG1, 0, 0, $iWidth1, $iHeight1, 0, 0, $iWidth1, $iHeight1) If $Position = "right" Then _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hSourceIMG2, 0, 0, $iWidth2, $iHeight2, $iWidth1, 0, $iWidth2, $iHeight2) Else _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hSourceIMG2, 0, 0, $iWidth2, $iHeight2, 0, $iHeight1, $iWidth2, $iHeight2) EndIf _GDIPlus_ImageSaveToFile($hImage, $sResult) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteObject($hImage) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_ImageDispose($hSourceIMG1) _GDIPlus_ImageDispose($hSourceIMG2) _GDIPlus_Shutdown() EndFunc ;==>_BMPJoin Func _CreateBMP($sWidth, $sHeight) Local $hWnd, $hDC, $hBMP $hWnd = _WinAPI_GetDesktopWindow() $hDC = _WinAPI_GetDC($hWnd) $hBMP = _WinAPI_CreateCompatibleBitmap($hDC, $sWidth, $sHeight) _WinAPI_ReleaseDC($hWnd, $hDC) Return $hBMP EndFunc ;==>_CreateBMP ;; END JOIN IMAGES FUNCTION SCRIPT TWO:
      ;; AUTOIT3 v3.3.14.5 SCRIPT ;; PURPOSE: ; WRITE AN AUTOIT3 SCRIPT THAT WHEN RUN IN A WINDOWS SCHEDULED TASK WILL PRODUCE A SCREENSHOT OF THE WINDOWS 10 DESKTOP, START MENU, QUICK ACCESS MENU, AND DEVICE MANAGER WITHOUT INTERACTION. ;; SEE https://www.autoitscript.com/forum/topic/196256-screenshot-win10-desktop-quick-access-device-manager-start-menu-automated-shots-stacked-or-side-by-side-requires-admin/ ;; MUST BE RUN WITH ADMIN PRIVILEDGES. NOT ROBUST YET. ;; DOWNLOAD COORDINATES.AU3 https://www.autoitscript.com/forum/topic/196256-screenshot-win10-desktop-quick-access-device-manager-start-menu-automated-shots-stacked-or-side-by-side-requires-admin/ ;; SCREENSHOT WIN10 DESKTOP, QUICK ACCESS, DEVICE MANAGER AND START MENU. ;; MULTIPLE SHOTS JOINED STACKED, SIDE-BY-SIDE, OR NEITHER. SEE SIDE-BY-SIDE ;; WORK NEEDS TO BE DONE TO ELIMINATE THE BLACK BAR WHEN THE SHOTS ARE NOT THE SAME HEIGHT AND ARE BEING DISPLAYED SIDE-BY-SIDE. ;; MY GUESS THE EASIEST THING TO DO WOULD BE TO TURN IT WHITE. ;; YOU WILL HAVE TO TELL IT WHERE YOUR TASKBAR EXPLORER SHORTCUT IS. SEE MouseClick ( "right", 74, 748, 1, 0) ;; YOU WILL HAVE TO TELL IT WHERE TO PROCESS AND MOVE THE SHOTS. SEE MULTIPLE OF $ZDIR, $ZNAME, FQPN SEE $outputFile ;; IMPROVEMENTS ARE WELCOMED ;; FIND LIST OF ENVIRONMENT VARIABLES NAMES ;; AUTOIT3 HELP File ;; "C:\Program Files (x86)\AutoIt3\AutoIt.chm" ;; SEARCH FOR MACRO REFERENCE AND MACRO REFERENCE - DIRECTORY ;; THANKS TO RASIM, MARTIN, AND BOOMINGRANNY AT AUTOITSCRIPT.COM ; https://www.autoitscript.com/forum/topic/80896-join-two-bitmap-images/ ; https://www.autoitscript.com/forum/topic/80896-join-two-bitmap-images/?do=findComment&comment=581214 ; https://www.autoitscript.com/forum/topic/80896-join-two-bitmap-images/?do=findComment&comment=581372 ; https://www.autoitscript.com/forum/topic/196256-screenshot-win10-desktop-quick-access-device-manager-start-menu-automated-shots-stacked-or-side-by-side-requires-admin/ ; https://www.autoitscript.com/forum/topic/196256-screenshot-win10-desktop-quick-access-device-manager-start-menu-automated-shots-stacked-or-side-by-side-requires-admin//?do=findComment&comment=1407181 ;; "C:\Program Files (x86)\AutoIt3\AutoIt3_x64.exe" "F:\MYAPPS\WINDOWS\screenshots9.au3" ;; Screenshot Win10 desktop, quick access, device manager, start menu. Shots stacked or side-by-side. Admin privileges. Not robust. ; BEGIN CAPTURE ; https://www.autoitscript.com/forum/topic/8377-capture-screen-dll/ ; Capture full screen ; Fist parameter - filename, last - jpeg quality. #include <ScreenCapture.au3> send("#d") ; show desktop ;DEVICE MANAGER ;STARTING THE DEVICE MANAGER THIS WAY REQUIRED: ; 1. IT BE DONE AT THE BEGINNING OF THE SCRIPT. ; 2. MORE WORK TO FIND THE COORDINATES: ; https://www.autoitscript.com/forum/topic/165325-how-to-get-4-screen-coordinates-just-by-dragging-a-rectangle/?do=findComment&comment=1206830 ; modified and saved as "C:\Program Files (x86)\AutoIt3\Include\Coordinates.au3" ; download Coordinates.au3 https://www.autoitscript.com/forum/topic/196256-screenshot-win10-desktop-quick-access-device-manager-start-menu-automated-shots-stacked-or-side-by-side-requires-admin/ Run("control /name Microsoft.DeviceManager") WinWaitActive("Device Manager") $WinHndl = WinGetHandle("Device Manager") WinMove($WinHndl,"",-4,0,@DesktopWidth+10,@DesktopHeight) ; MAKE ADJUSTMENTS HERE IF NECESSARY Sleep( 1000 ) Send("{TAB}") Sleep( 125 ) send("{down 4}") Sleep( 125 ) send("{right}") Sleep( 125 ) send("{down2}") Sleep( 125 ) send("{right}") Sleep( 125 ) send("{down 5}") Sleep( 125 ) send("{right}") Sleep( 500 ) send("{down 5}") Sleep( 500 ) send("{right}") Sleep( 125 ) send("{down 14}") Sleep( 125 ) send("{right}") Sleep( 125 ) send("{down 7}") Sleep ( 120 ) $ZDIR=@tempDir ;where does the screenshot go $ZNAME="\device-manager1.jpg" ;what will its name be $ZTOPX=24 $ZTOPY=84 $ZBOTTOMX=277 $ZBOTTOMY=374 #include <Coordinates.au3>; finds incorrect coordinates. They are shifted down ~50px. Does not work on menus exposed by right clicking or the start menu ScreenShot () ; exit $ZDIR=@tempDir ;where does the screenshot go $ZNAME="\device-manager2.jpg" ;what will its name be $ZTOPX=24 $ZTOPY=374 $ZBOTTOMX=277 $ZBOTTOMY=716 #include <Coordinates.au3>; finds incorrect coordinates. They are shifted down ~50px. Does not work on menus exposed by right clicking or the start menu ScreenShot() Sleep( 500 ) ProcessClose ( "mmc.exe" ) ; close the device manager ; QUICK ACCESS ; https://www.autoitscript.com/autoit3/docs/functions/MouseClick.htm MouseClick ( "right", 74, 748, 1, 0) ; right click windows explorer shortcut on taskbar. Sleep( 1200 ) send("{up}") ; SCRIPT MORE RELIABLE IF UPs ARE NOT COMBINED Sleep( 120 ) send("{up}") Sleep( 120 ) send("{up}") Sleep( 120 ) send("{up}") Sleep( 120 ) send("{down}") Sleep (1200) $ZDIR=@homeDrive & "\Users\Default\Desktop\UPDATE" ;where does the screenshot go $ZNAME="\quick-access.jpg" ;what will its name be $ZTOPX=0 $ZTOPY=0 $ZBOTTOMX=251 $ZBOTTOMY=615 #include <Coordinates.au3>; finds incorrect coordinates. They are shifted down ~50px. Does not work on menus exposed by right clicking or the start menu ScreenShot() Sleep ( 250 ) ; START MENU send("{LWIN}") ;OPEN START MENU Sleep ( 250 ) $ZDIR=@tempDir ;where does the screenshot go $ZNAME="\start-menu1.jpg" ;what will its name be $ZTOPX=315 $ZTOPY=139 $ZBOTTOMX=1285 $ZBOTTOMY=660 #include <Coordinates.au3>; finds incorrect coordinates. They are shifted down ~50px. Does not work on menus exposed by right clicking or the start menu ScreenShot() ; BEGIN WEAK POINT send("{tab}"); COMBINING TABS BREAKS SCRIPT Sleep ( 240 ) send("{tab}") Sleep ( 240 ) send("{tab}") Sleep ( 500 ) send("{down 8}"); move to the bottom of the start menu to take the next screenshot. operates on the first column of shortcuts. will only go to the bottom of it. add send("{right}") after the last tab to operate on another column. Sleep ( 1000 ) ; END WEAK POINT ; $ZDIR=@tempDir ;where does the screenshot go $ZNAME="\start-menu2.jpg" ;what will its name be $ZTOPX=315 $ZTOPY=409 $ZBOTTOMX=1285 $ZBOTTOMY=730 #include <Coordinates.au3>; finds incorrect coordinates. They are shifted down ~50px. Does not work on menus exposed by right clicking or the start menu ScreenShot() Sleep ( 120 ) send("{LWIN}") ; CLOSE THE START MENU Sleep ( 120 ) ; DESKTOP $ZDIR=@homeDrive & "\Users\Default\Desktop\UPDATE" ;where does the screenshot go $ZNAME="\desktop.jpg" ;what will its name be $ZTOPX=0 $ZTOPY=0 $ZBOTTOMX=-1 $ZBOTTOMY=-1 ScreenShot() sleep (500) ;; END CAPTURE ;; BEGIN JOIN IMAGES #include <GDIPlus.au3> #include <WinAPISysWin.au3> ; FULLY QUALIFIED PATH NAME (FQPN) TO FIRST IMAGE, FQPN TO SECOND IMAGE, FQPN TO COMBINED IMAGE ; _BMPJoin(@tempDir & "\start-menu1.jpg", @tempDir & "\start-menu2.jpg", @homeDrive & "\Users\Default\Desktop\UPDATE\start-menu.jpg", "right") ; SIDE-BY-SIDE ; _BMPJoin(@tempDir & "\device-manager1.jpg", @tempDir & "\device-manager2.jpg", @homeDrive & "\Users\Default\Desktop\UPDATE\device-manager.jpg", "") ; STACKED _BMPJoin(@tempDir & "\start-menu1.jpg", @tempDir & "\start-menu2.jpg", @homeDrive & "\Users\Default\Desktop\UPDATE\start-menu.jpg", "") _BMPJoin(@tempDir & "\device-manager1.jpg", @tempDir & "\device-manager2.jpg", @homeDrive & "\Users\Default\Desktop\UPDATE\device-manager.jpg", "") ;; END JOIN IMAGES Exit ; END OF SCRIPT ;; BEGIN SCREENSHOT FUNCTION Func ScreenShot() ; Capture full screen _ScreenCapture_Capture($ZDIR & $ZNAME, $ZTOPX, $ZTOPY, $ZBOTTOMX, $ZBOTTOMY) EndFunc ;==>ScreenShot ; https://www.autoitscript.com/autoit3/docs/libfunctions/_ScreenCapture_Capture.htm ; $iLeft [optional] X coordinate of the upper left corner of the rectangle ; $iTop [optional] Y coordinate of the upper left corner of the rectangle ; $iRight [optional] X coordinate of the lower right corner of the rectangle. If this is -1, the current screen width will be used. ; $iBottom [optional] Y coordinate of the lower right corner of the rectangle. If this is -1, the current screen height will be used. ;; END SCREENSHOT FUNCTION ;; BEGIN JOIN IMAGES FUNCTION ; https://www.autoitscript.com/forum/topic/80896-join-two-bitmap-images/ Func _BMPJoin($sFile1, $sFile2, $sResult, $Position) Local $hSourceIMG1, $hSourceIMG2, $iWidth1, $width2, $iHeight1, $iHeight2, $hBitmap, $hImage, $hGraphics Local $iBwidth, $iBheight If Not FileExists(StringRegExpReplace($sResult, "(^.*)\\.*", "\1")) Then $sResult = @ScriptDir & "\result.bmp" _GDIPlus_Startup() $hSourceIMG1 = _GDIPlus_ImageLoadFromFile($sFile1) $hSourceIMG2 = _GDIPlus_ImageLoadFromFile($sFile2) $iWidth1 = _GDIPlus_ImageGetWidth($hSourceIMG1) $iHeight1 = _GDIPlus_ImageGetHeight($hSourceIMG1) $iWidth2 = _GDIPlus_ImageGetWidth($hSourceIMG2) $iHeight2 = _GDIPlus_ImageGetHeight($hSourceIMG2) If $Position = "right" Then $iBwidth = $iWidth1 + $iWidth2 $iBheight = $iHeight1 if $iHeight2 > $iHeight1 then $iBheight = $iHeight2 ; WORK NEEDS TO BE DONE TO ELIMINATE THE BLACK BAR WHEN THE SHOTS ARE NOT THE SIZE HEIGHT AND ARE BEING DISPLAYED SIDE-BY-SIDE. Else;position = "below" $iBwidth = $iWidth1 if $iWidth2 > $iWidth1 then $iBwidth = $iWidth2 $iBheight = $iHeight1 + $iHeight2 EndIf $hBitmap = _CreateBMP($iBwidth, $iBheight) $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap) $hGraphics = _GDIPlus_ImageGetGraphicsContext($hImage) ; https://www.autoitscript.com/autoit3/docs/libfunctions/_GDIPlus_GraphicsDrawImageRectRect.htm _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hSourceIMG1, 0, 0, $iWidth1, $iHeight1, 0, 0, $iWidth1, $iHeight1) If $Position = "right" Then _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hSourceIMG2, 0, 0, $iWidth2, $iHeight2, $iWidth1, 0, $iWidth2, $iHeight2) Else _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hSourceIMG2, 0, 0, $iWidth2, $iHeight2, 0, $iHeight1, $iWidth2, $iHeight2) EndIf _GDIPlus_ImageSaveToFile($hImage, $sResult) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteObject($hImage) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_ImageDispose($hSourceIMG1) _GDIPlus_ImageDispose($hSourceIMG2) _GDIPlus_Shutdown() EndFunc ;==>_BMPJoin Func _CreateBMP($sWidth, $sHeight) Local $hWnd, $hDC, $hBMP $hWnd = _WinAPI_GetDesktopWindow() $hDC = _WinAPI_GetDC($hWnd) $hBMP = _WinAPI_CreateCompatibleBitmap($hDC, $sWidth, $sHeight) _WinAPI_ReleaseDC($hWnd, $hDC) Return $hBMP EndFunc ;==>_CreateBMP ;; END JOIN IMAGES FUNCTION ;; BEGIN COORDINATES FUNCTION ;; END COORDINATES FUNCTION
      KEYWORDS: RIGHT CLICK EXPLORER SHORTCUT PINNED TO TASKBAR PINNED TO QUICK ACCESS PIN TO QUICK ACCESS PIN TO EXPLORER PINNED TO EXPLORER
       
       
    • stayready40
      By stayready40
      Hello all. I created a script to uninstall Symantec from our environment and I placed the "BlockInput(1)" command in the beginning of the script so that end users would not be able to move the mouse or keyboard to disrupt the mouse clicks.
      During testing we found that this worked for our Windows 7 machines, but for our windows 10 machines the mouse disable did not work can anyone shed some light on why this is? 
      Here is my code:

       
    • faustf
      By faustf
      hi guys
      i have a script  like this,  in windows 7 work perfect , in windows 10 not  work  , some one can explain me  why ??'
      #include <Array.au3> #include <MsgBoxConstants.au3> Global $aGPathFoto= FileReadToArray (@ScriptDir & "\TEMP\PathFoto.txt") Local $ctrl = 0 While 1 Local $hWnd = WinWait("[CLASS:#32770]", "", 10) If WinExists("[CLASS:#32770]") Then If $ctrl < 2 Then ControlSend($hWnd, "Choose File to Upload", "[CLASS:Edit; INSTANCE:1]", $aGPathFoto[0]&"{Enter}") Exit $ctrl += 1 Else ExitLoop EndIf EndIf WEnd $aGpathfoto = C:\Users\Public\Pictures\Sample Pictures\Chrysanthemum.jpg
    • Skeletor
      By Skeletor
      Hi Virtual People, 
      I'm trying to lock my screen in Windows 10 but to no avail. 
      Has Windows 10 forbidden this feature? 
      Send("#l") Above code does not work. Even sending Ctrl Alt Del does not work nor as an Admin. 
      Note: I want to lock my screen, not log off. Thanks for been kind.
       
    • astrionn
      By astrionn
      Hi Guys,
       
      I`m trying to record with my webcam in 5s intervalls and do some stuff between starting to record and stoping.
      I took code from here: https://www.autoitscript.com/forum/topic/27925-webcam-example/
      and took what looked relevant to me.
      I use 3 different files:
       Is called WMS.au3 and contains all the constants for the dll calls is called rec.au3 and does all necessary dll calls to start a webcam recording to a file Is called stopcam.exe and does the dll calls to stop recording into a file WMS.au3  :
      $WM_CAP_START = 0x400 $WM_CAP_UNICODE_START = $WM_CAP_START +100 $WM_CAP_PAL_SAVEA = $WM_CAP_START + 81 $WM_CAP_PAL_SAVEW = $WM_CAP_UNICODE_START + 81 $WM_CAP_UNICODE_END = $WM_CAP_PAL_SAVEW $WM_CAP_ABORT = $WM_CAP_START + 69 $WM_CAP_DLG_VIDEOCOMPRESSION = $WM_CAP_START + 46 $WM_CAP_DLG_VIDEODISPLAY = $WM_CAP_START + 43 $WM_CAP_DLG_VIDEOFORMAT = $WM_CAP_START + 41 $WM_CAP_DLG_VIDEOSOURCE = $WM_CAP_START + 42 $WM_CAP_DRIVER_CONNECT = $WM_CAP_START + 10 $WM_CAP_DRIVER_DISCONNECT = $WM_CAP_START + 11 $WM_CAP_DRIVER_GET_CAPS = $WM_CAP_START + 14 $WM_CAP_DRIVER_GET_NAMEA = $WM_CAP_START + 12 $WM_CAP_DRIVER_GET_NAMEW = $WM_CAP_UNICODE_START + 12 $WM_CAP_DRIVER_GET_VERSIONA = $WM_CAP_START + 13 $WM_CAP_DRIVER_GET_VERSIONW = $WM_CAP_UNICODE_START + 13 $WM_CAP_EDIT_COPY = $WM_CAP_START + 30 $WM_CAP_END = $WM_CAP_UNICODE_END $WM_CAP_FILE_ALLOCATE = $WM_CAP_START + 22 $WM_CAP_FILE_GET_CAPTURE_FILEA = $WM_CAP_START + 21 $WM_CAP_FILE_GET_CAPTURE_FILEW = $WM_CAP_UNICODE_START + 21 $WM_CAP_FILE_SAVEASA = $WM_CAP_START + 23 $WM_CAP_FILE_SAVEASW = $WM_CAP_UNICODE_START + 23 $WM_CAP_FILE_SAVEDIBA = $WM_CAP_START + 25 $WM_CAP_FILE_SAVEDIBW = $WM_CAP_UNICODE_START + 25 $WM_CAP_FILE_SET_CAPTURE_FILEA = $WM_CAP_START + 20 $WM_CAP_FILE_SET_CAPTURE_FILEW = $WM_CAP_UNICODE_START + 20 $WM_CAP_FILE_SET_INFOCHUNK = $WM_CAP_START + 24 $WM_CAP_GET_AUDIOFORMAT = $WM_CAP_START + 36 $WM_CAP_GET_CAPSTREAMPTR = $WM_CAP_START + 1 $WM_CAP_GET_MCI_DEVICEA = $WM_CAP_START + 67 $WM_CAP_GET_MCI_DEVICEW = $WM_CAP_UNICODE_START + 67 $WM_CAP_GET_SEQUENCE_SETUP = $WM_CAP_START + 65 $WM_CAP_GET_STATUS = $WM_CAP_START + 54 $WM_CAP_GET_USER_DATA = $WM_CAP_START + 8 $WM_CAP_GET_VIDEOFORMAT = $WM_CAP_START + 44 $WM_CAP_GRAB_FRAME = $WM_CAP_START + 60 $WM_CAP_GRAB_FRAME_NOSTOP = $WM_CAP_START + 61 $WM_CAP_PAL_AUTOCREATE = $WM_CAP_START + 83 $WM_CAP_PAL_MANUALCREATE = $WM_CAP_START + 84 $WM_CAP_PAL_OPENA = $WM_CAP_START + 80 $WM_CAP_PAL_OPENW = $WM_CAP_UNICODE_START + 80 $WM_CAP_PAL_PASTE = $WM_CAP_START + 82 $WM_CAP_SEQUENCE = $WM_CAP_START + 62 $WM_CAP_SEQUENCE_NOFILE = $WM_CAP_START + 63 $WM_CAP_SET_AUDIOFORMAT = $WM_CAP_START + 35 $WM_CAP_SET_CALLBACK_CAPCONTROL = $WM_CAP_START + 85 $WM_CAP_SET_CALLBACK_ERRORA = $WM_CAP_START + 2 $WM_CAP_SET_CALLBACK_ERRORW = $WM_CAP_UNICODE_START + 2 $WM_CAP_SET_CALLBACK_FRAME = $WM_CAP_START + 5 $WM_CAP_SET_CALLBACK_STATUSA = $WM_CAP_START + 3 $WM_CAP_SET_CALLBACK_STATUSW = $WM_CAP_UNICODE_START + 3 $WM_CAP_SET_CALLBACK_VIDEOSTREAM = $WM_CAP_START + 6 $WM_CAP_SET_CALLBACK_WAVESTREAM = $WM_CAP_START + 7 $WM_CAP_SET_CALLBACK_YIELD = $WM_CAP_START + 4 $WM_CAP_SET_MCI_DEVICEA = $WM_CAP_START + 66 $WM_CAP_SET_MCI_DEVICEW = $WM_CAP_UNICODE_START + 66 $WM_CAP_SET_OVERLAY = $WM_CAP_START + 51 $WM_CAP_SET_PREVIEW = $WM_CAP_START + 50 $WM_CAP_SET_PREVIEWRATE = $WM_CAP_START + 52 $WM_CAP_SET_SCALE = $WM_CAP_START + 53 $WM_CAP_SET_SCROLL = $WM_CAP_START + 55 $WM_CAP_SET_SEQUENCE_SETUP = $WM_CAP_START + 64 $WM_CAP_SET_USER_DATA = $WM_CAP_START + 9 $WM_CAP_SET_VIDEOFORMAT = $WM_CAP_START + 45 $WM_CAP_SINGLE_FRAME = $WM_CAP_START + 72 $WM_CAP_SINGLE_FRAME_CLOSE = $WM_CAP_START + 71 $WM_CAP_SINGLE_FRAME_OPEN = $WM_CAP_START + 70 $WM_CAP_STOP = $WM_CAP_START + 68 rec.au3  :
       
      #include <WMS.au3> #include <GUIConstants.au3> if not FileExists(@ScriptDir&"\vid\"&string(@MON)&"\"&string(@mday)) Then DirCreate(@ScriptDir&"\vid\"&"\"&string(@MON)&"\"&string(@mday)) EndIf $moviefile = @ScriptDir&"\vid"&"\"&string(@MON)&"\"&string(@mday)&"\test.avi" $avi = DllOpen("avicap32.dll") $user = DllOpen("user32.dll") FileWrite(@scriptdir&"\clop.clop",$user) $Main = GUICreate("Camera",350,270) $moviefile=@ScriptDir&"\test.avi" $cap = DllCall($avi, "int", "capCreateCaptureWindow", "str", "cap", "int", BitOR($WS_CHILD,$WS_VISIBLE), "int", 15, "int", 15, "int", 320, "int", 240, "hwnd", $Main, "int", 1) FileWrite(@scriptdir&"\clip.clip",$cap[0]) run(@scriptdir&"\stopcam.exe") DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_DRIVER_CONNECT, "int", 0, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_SCALE, "int", 1, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_OVERLAY, "int", 1, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_PREVIEW, "int", 1, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_PREVIEWRATE, "int", 1, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_FILE_SET_CAPTURE_FILEA, "int", 0, "str", $moviefile) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SEQUENCE, "int", 0, "int", 0) Stopcam.exe is the compiled version of this:
      #include "WMS.au3" #include <GUIConstants.au3> $cap = Int(FileRead(@scriptdir&"\clip.clip")) $user = int(fileread(@scriptdir&"\clop.clop")) Sleep(10000) DllCall($user, "int", "SendMessage", "hWnd", $cap, "int", $WM_CAP_STOP, "int", 0, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap, "int", $WM_CAP_END, "int", 0, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap, "int", $WM_CAP_DRIVER_DISCONNECT, "int", 0, "int", 0) DllClose($user) FileDelete(@scriptdir&"\clip.clip") FileDelete(@scriptdir&"\clop.clop")  
      Unfortunately this is not working as I thought it would be working.
      Does someone see what I´m doing wrong?
      It should record the webcam for about 10 seconds ( a little less) and save that to an .avi file.
      It does not stop the recording , I have to stop the process manually...
      Secondly, which confuses me more is that it creates the test.avi not in the location is specified in the script... its stored in the ScriptDir for whatever reason haha
      I hope you can help me
       
      ~HappyCoding
×