Jump to content
prasad123

help with accessing folder and path

Recommended Posts

prasad123

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

Share this post


Link to post
Share on other sites
JLogan3o13

@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")

 

  • Like 1

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
prasad123
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

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

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.