Jump to content
littleboy62

How do pin a shortcut in start menu ? (windows 10)

Recommended Posts

littleboy62

Hello everyone.

First, sorry for mistakes, I'm french. ^^

=====

I've tried (and I try always) to pin a shortcut (lnk) to startmenu (on Windows 10).


Look this subject (in forum FR autoit) : http://www.autoitscript.fr/forum/viewtopic.php?f=21&t=12031

The script I wrote, doesn't work, despithe the display of "Épingler à l'écran de démarrage" by a consolewrite.

This is the script :

#RequireAdmin
$path = @DesktopDir & "\vlc.lnk"
PinToTaskBand($path)


Func PinToTaskBand($path)
    $objShell = ObjCreate("shell.application")
    $objFSO = ObjCreate("Scripting.FileSystemObject")

    $strFolder = $objFSO.GetParentFolderName($path)
    $strFile = $objFSO.GetFileName($path)
    $objFolder = $objShell.Namespace($strFolder)
    $objFolderItem = $objFolder.ParseName($strFile)
    $colVerbs = $objFolderItem.Verbs


    For $itemVerb In $objFolderItem.Verbs
;~         MsgBox(0,"", $itemVerb.name)
        $var = StringReplace($itemVerb.name, "&", "")
        ConsoleWrite($var & " | ")
        If $var =  "Pin to startmenu" Or $var="Épingler à l’écran de démarrage" Then
            MsgBox(0, "", 1)
            $itemVerb.DoIt
        EndIf
    Next
EndFunc   ;==>PinToTaskBand

Func UnpinToTaskBand($path)
    $objShell = ObjCreate("shell.application")
    $objFSO = ObjCreate("Scripting.FileSystemObject")

    $strFolder = $objFSO.GetParentFolderName($path)
    $strFile = $objFSO.GetFileName($path)
    $objFolder = $objShell.Namespace($strFolder)
    $objFolderItem = $objFolder.ParseName($strFile)
    $colVerbs = $objFolderItem.Verbs

    For $itemVerb In $objFolderItem.Verbs
        ConsoleWrite($itemVerb.name & " | ")
        If StringReplace($itemVerb.name, "&", "") == "Unpin from Taskbar" Or StringReplace($itemVerb.name, "&", "") == "Détacher de la barre des tâches" Then $itemVerb.DoIt
    Next
EndFunc   ;==>UnpinToTaskBand
If StringInStr($var, "Pin to startmenu") Or StringInStr($var, "Épingler à l’écran de démarrage") Then
                MsgBox(0, "", 1)
                $itemVerb.DoIt
            EndIf

 

It shows 1 (msgbox) correctly.
But $itemVerb.DoIt doesn't work.


Someone would he know how to do ?
If i do mistakes, where are it ? Please.

Else, is there another way to pin a shortcut to startmenu (on windows 10)?

Thanks by advance.
Cheers.

Good day guys:D

Edited by littleboy62
Correction script

Share this post


Link to post
Share on other sites
BetaLeaf

You can add items to the start menu by creating a shortcut in the following directories:

Current User = %AppData%\Microsoft\Windows\Start Menu\Programs

Local Machine = C:\ProgramData\Microsoft\Windows\Start Menu\Programs 

Once they have been added, right clicking on them should give you an option to pin them to the start menu.

 

 


False Positive Reporter - Mass email all anti virus vendors with an attachment of your program for fast and easy whitelisting.

My GitHub Page: https://github.com/BetaLeaf

Share this post


Link to post
Share on other sites
caramen
On 28/05/2016 at 11:03 PM, BetaLeaf said:

You can add items to the start menu by creating a shortcut in the following directories:

Current User = %AppData%\Microsoft\Windows\Start Menu\Programs

Local Machine = C:\ProgramData\Microsoft\Windows\Start Menu\Programs 

Once they have been added, right clicking on them should give you an option to pin them to the start menu.

 

 

Not the purpose of the request in topic.

Script = automotion

Right click manualy = no automotion

Actualy if i am not whrong:

No one even the best expert can do that, becose microsoft locked that to keep taskbar clean of malware adds

this affirmation is correct only for system architecture after W7

 

Paliative solution :

0-[Blockinput] =1

1-Open an explorer windows in witch one you got the Exe file

2-[Move] the windows to 0,0

3-[Send] the EXE name fast enouth to higthlight it

4-[Send] context menu

5-[send] {down} {down}.....[click] pin to....

6-[blockinput] = 0

 

Yeah very ugly way

Edited by caramen

IUIAutomation From Junkew WebDriver From Danp2  >>HIt The Thanks Button.<<

 

Share this post


Link to post
Share on other sites
Subz

In Windows 10 you need to use PowerShell as the verb method no longer works:
nb1: Shortcuts need to exist of course and should be in %AllUsersProfile% Start Menu
nb2: In Windows 10 1607/2016 you can also add Task Bar menu items (The XML code below is for Windows 10 1607)
nb3: This adds the shorcuts for all "New Users" only.

Start Menu/TaskBar Example File

<?xml version="1.0" encoding="utf-8"?>
<LayoutModificationTemplate
    xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification"
    xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout"
    xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout"
    xmlns:taskbar="http://schemas.microsoft.com/Start/2014/TaskbarLayout"
    Version="1">
<LayoutOptions StartTileGroupsColumnCount="1" />
  <DefaultLayoutOverride>
    <StartLayoutCollection>
      <defaultlayout:StartLayout GroupCellWidth="6" xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout">
        <start:Group Name="Items" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout">
          <start:DesktopApplicationTile Size="2x2" Column="2" Row="0" DesktopApplicationLinkPath="%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Microsoft Office 2013\Outlook 2013.lnk" />
          <start:DesktopApplicationTile Size="2x2" Column="2" Row="2" DesktopApplicationLinkPath="%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Microsoft Office 2013\PowerPoint 2013.lnk" />
          <start:DesktopApplicationTile Size="2x2" Column="0" Row="2" DesktopApplicationLinkPath="%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Microsoft Office 2013\Excel 2013.lnk" />
          <start:DesktopApplicationTile Size="2x2" Column="4" Row="2" DesktopApplicationLinkPath="%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Microsoft Office 2013\Word 2013.lnk" />
          <start:DesktopApplicationTile Size="2x2" Column="4" Row="0" DesktopApplicationLinkPath="%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Microsoft Office 2013\Skype for Business 2015.lnk" />
          <start:DesktopApplicationTile Size="2x2" Column="2" Row="4" DesktopApplicationLinkPath="%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Google Chrome.lnk" />
        </start:Group>
      </defaultlayout:StartLayout>
    </StartLayoutCollection>
  </DefaultLayoutOverride>
  <CustomTaskbarLayoutCollection PinListPlacement="Replace">
    <defaultlayout:TaskbarLayout>
      <taskbar:TaskbarPinList>
        <taskbar:DesktopApp DesktopApplicationLinkPath="%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Microsoft Office 2013\Excel 2013.lnk" />
        <taskbar:DesktopApp DesktopApplicationLinkPath="%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Microsoft Office 2013\Outlook 2013.lnk" />
        <taskbar:DesktopApp DesktopApplicationLinkPath="%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Microsoft Office 2013\PowerPoint 2013.lnk" />
        <taskbar:DesktopApp DesktopApplicationLinkPath="%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Microsoft Office 2013\Word 2013.lnk" />
        <taskbar:DesktopApp DesktopApplicationLinkPath="%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Google Chrome.lnk" />
      </taskbar:TaskbarPinList>
    </defaultlayout:TaskbarLayout>
  </CustomTaskbarLayoutCollection>
</LayoutModificationTemplate>

Power Shell Command in Autoit

$hXML_STARTMENU = @ScriptDir & '\StartMenu.xml'
If @OSArch = 'x64' Then
    DllCall("kernel32.dll", "boolean", "Wow64DisableWow64FsRedirection", "boolean", 1) ;~ Turns On 64 Bit Redirection
        RunWait('@ComSpec@ /c Powershell.exe -command "& {Import-StartLayout –LayoutPath $hXML_STARTMENU$ -MountPath $env:SystemDrive\}"', '@WindowsDir@\System32', @SW_HIDE)
    DllCall("kernel32.dll", "boolean", "Wow64DisableWow64FsRedirection", "boolean", 0) ;~ Turns Off 64 Bit Redirection
Else
    RunWait('@ComSpec@ /c Powershell.exe -command "& {Import-StartLayout –LayoutPath $hXML_STARTMENU$ -MountPath $env:SystemDrive\}"', @SystemDir, @SW_HIDE)
EndIf

 

  • Like 2

Share this post


Link to post
Share on other sites
caramen

Did you tryed on w10 architectur 😳? 

 

Wow big like

Edited by caramen

IUIAutomation From Junkew WebDriver From Danp2  >>HIt The Thanks Button.<<

 

Share this post


Link to post
Share on other sites
Subz

@Caramen - I use this as part of the build for our Windows 10 images, normally apply this after applications have been installed and build the XML file via script as we have different applications for Start Menu/Task Bar shortcuts for different systems for example Kiosk, Desktops and Laptops.  Technically you can also just rename the xml file to "LayoutModification.xml" in "C:\Users\Default\AppData\Local\Microsoft\Windows\Shell" as that's all the PowerShell command does.

Share this post


Link to post
Share on other sites
caramen

WoW man you are the first to show me a solution for that. Guess you are skilled. 

But you need an up to date system is that rigth ?

 

i am gonna test that next week i have No Time atm and feed back ofc

Edited by caramen

IUIAutomation From Junkew WebDriver From Danp2  >>HIt The Thanks Button.<<

 

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
×