Jump to content

Need to save screen capture to specific folder


Recommended Posts

; Parenka Folder

ControlClick ("Save As", "Address: C:\Users\mskel", "[CLASSNN:ToolbarWindow324]", "left", 8, 14)
sleep(500)
Send ("C:\Users\mskel\Desktop\Tiltinimai\")
sleep(300)
ControlSend("", "", "", GUICtrlRead($SEKT))
sleep(300)
Send ("{ENTER}")
sleep(300)

Trying to use this code to select and enter specific folder for my sreen capture. It was working for a while and now it doesnt i dont know maybe i do something wrong...

Code is trying to click on field where you can enter Adress and then put Adress in it but it doesnt work, maybe there is better way to do it?

I add some photos to...

 

Screenshot 2020-10-22 094340.png

2.png

Link to comment
Share on other sites

Checked a lot of examples and found what i need finally... 

#include <GuiToolbar.au3>
#Include <File.au3>

_Change_SaveAs_Diaglog_FolderPath()

Func _Change_SaveAs_Diaglog_FolderPath()

    Run('Notepad.exe')
    Local $aTitle = '[CLASS:Notepad; TITLE:Untitled - Notepad]'
    WinWaitActive($aTitle)
    ControlSetText($aTitle,'','Edit1','new line.')
    WinMenuSelectItem($aTitle,'','&File','&Save')


    Local $AddressPath = 'C:\_DOC\_TEXT'
    Local $aFileName = 'New File.txt'
    ClipPut($AddressPath)                   ;for  Option 1

    Local $SaveAsTitle = '[CLASS:#32770; TITLE:Save As]'


# I.a

    ;get 'Save As' window handle
    Local $hWnd = WinWaitActive($SaveAsTitle, '&Save', 10)

# I.b

    ;get Address Bar handle for $AddressPath
    Local $hTollbars = ControlGetHandle($hWnd, 'Address', '[CLASSNN:ToolbarWindow324]')


# II - IMPORTANT: Address Bar must be infocus in order to activate Edit2 to set $AddressPath in step (IV)
       ;Option 2 or 3 is highly recommended


    # ;Option 1 - Select ToolbarWindow32 - Address Bar (work around -not recomended)
    #------------------------------------------------------------------------------
;~      ControlFocus($hTollbars, 'Address', '')
;~      ControlSend($hTollbars, 'Address', '','{SPACE}')
;~      Send('^v{ENTER}')

    # ;Option 2 - Select ToolbarWindow32 - Address Bar (same as Option 3)
    #-------------------------------------------------------------------
        ControlCommand($hTollbars, "Address", "", "SendCommandID", 1280)

    # ;Option 3 - Select ToolbarWindow32 - Address Bar (same as Option 2)
    #------------------------------------------------------------------------------------------
;~      ControlCommand($hWnd, "Address", "ToolbarWindow324", "SendCommandID", 1280)

    # ;Option 4 - Select ToolbarWindow32 - Address Bar (mouse pointer also relocated)
    #------------------------------------------------------------------------------------------
;~      _GUICtrlToolbar_ClickIndex($hTollbars, -1,'Left',True,1,0)

    # ;Option 5 - Select ToolbarWindow32 - Address Bar (this simulate as Run, NOT RunWait if your project required it - NOT Recommended)
    #------------------------------------------------------------------------------------------
;~      Run(@AutoItExe & ' /AutoIt3ExecuteLine "ControlCommand ( hwnd(' & $hWnd & '),'''', hwnd(' & $hTollbars & '), ''SendCommandID'', 1280 )"')


# III
        ;check if path $AddressPath exists
        If Not FileExists($AddressPath) Then DirCreate($AddressPath)

# IV
        ;set new path
        ControlSetText($hWnd, "Address", 'Edit2', $AddressPath)
;~      ControlFocus($hTollbars,'Address','')


# V
        ;commit new Path
        ControlSend($hWnd, "Address", 'Edit2','{ENTER}')

# VI
        ;set new file name
        ControlSetText($hWnd, "Namespace", "Edit1", $aFileName)
        ControlFocus($hWnd,'Namespace','Edit1')

# VII
        ;allow manual keypress {SPACE} or {ENTER} to save/cancel
;~      ControlFocus($hWnd,'&Save','Button1')
;~      ControlFocus($hWnd,'Cancel','Button2')

# VIII
        ;auto click save/cancel
;~      ControlClick($hWnd,"&Save", 'Button1','Left')
;~      ControlClick($hWnd,"Cancel", 'Button2','Left')


# IX
    #--------------------------------------------------
    # ---OR--- skip all above steps and use this work around
    #--------------------------------------------------
;~  ControlSetText($hWnd, "Namespace", "Edit1", $AddressPath&'\'&$aFileName)

EndFunc

 

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...