Jump to content

help with accessing folder and path


Recommended Posts

Hi All

This is a small excerpt from my code.

Basically I am creating a folder in My Documents. I am naming the folder using the current date and time.

Then I have to save some screenshots in that folder.

 

First I go to My Documents window.

Then I do following

    Send("^+{n}")                            ;Create New Folder in My Documents using ctrl+shift+n
    Sleep (1000)

    Local $pathname = "Automation Test" & "     " & " " & @MDAY & "." & @MON & "." & @YEAR & "     " & " " & @HOUR & "." & @MIN & "." & @SEC           ;create a string with current date and time

    Send ($pathname)        ;name the folder with this string
    Sleep(1000)
    Send("{ENTER}")            ; Folder gets successfully created and renamed.

 

Now I have to save some screenshots. Here I am facing problem.

I tried following ways but nothing is happening:

        _ScreenCapture_Capture(@MyDocumentsDir  &  $pathname  &  "\myscreen.jpg")

        _ScreenCapture_Capture(@MyDocumentsDir  &  $pathname  "\myscreen.jpg")

        _ScreenCapture_Capture(@MyDocumentsDir  \  $pathname  "\GDI-lus_Image1.jpg")
    

 

Please guide me regarding the correct way of accessing that folder.

 

Thanking in advance

Link to comment
Share on other sites

  • Moderators

@prasad123 This works for me, and uses a whole lot let quotes:

#include <ScreenCapture.au3>

$sPath = @MyDocumentsDir & "\Automation Test " & @MDAY & "." & @MON & "." & @YEAR & " " & @HOUR & "." & @MIN & "." & @SEC
    If Not(FileExists($sPath)) Then
        DirCreate($sPath)
    EndIf

_ScreenCapture_Capture($sPath & "\myscreen.jpg")

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • 2 weeks later...
On 3/29/2018 at 6:39 PM, JLogan3o13 said:

@prasad123 This works for me, and uses a whole lot let quotes:

#include <ScreenCapture.au3>

$sPath = @MyDocumentsDir & "\Automation Test " & @MDAY & "." & @MON & "." & @YEAR & " " & @HOUR & "." & @MIN & "." & @SEC
    If Not(FileExists($sPath)) Then
        DirCreate($sPath)
    EndIf

_ScreenCapture_Capture($sPath & "\myscreen.jpg")

 

thank you so much

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...