Sign in to follow this  
Followers 0
maksim

picking up file with a variable date

7 posts in this topic

The current code is below. The SHAW_annual.txt file that it picks up is changing the name of it to shaw_(current date). How do I change the code so that it picks up the file with a different name each day?

CODE
SplashTextOn, 350, 150, Creating text file..., Creating text file, please wait.

sleep,500

Goto,StartFileCreation

StartFileCreation:

WinActivate,Microsoft Excel

WinWaitActive,Microsoft Excel

Sleep,500

Send,^a

Sleep,500

Send,^c

Sleep,2000

Run,C:\\WINNT\\system32\\notepad.exe

Sleep,500

WinActivate,Untitled - Notepad

WinWaitActive,Untitled - Notepad

Send,^v

Sleep,500

Send,^s

Sleep,500

SetKeyDelay,2

Send,J:\\Public\\Eclipse\\SHAW_annual.txt

Sleep,500

Send,{Enter}

Sleep,500

Send,y

Sleep,500

Send,{Alt}{Down},x

SplashTextOff

SplashTextOn, 350, 150, Creating Email - please wait..., Please wait until file(s) are attached, then complete email and send it.

sleep,1500

SetTitleMatchMode, 2

IfWinExist,Lotus Notes,,goto,StartEmail

StartEmail:

sleep,300

WinActivate,Lotus Notes

sleep,100

IfWinExist,Lotus Notes,You have new mail,WinClose,Lotus Notes,You have new mail

sleep,200

IfWinExist,Lotus Notes,You have new mail,WinClose,Lotus Notes,You have new mail

repeat,5

WinActivate,Lotus Notes

IfWinActive,Lotus Notes,,Send,^m

sleep,500

IfWinExist,New Memo,,goto,DoEmail

sleep,400

endrepeat

DoEmail:

IfWinExist,Lotus Notes,You have new mail,WinClose,Lotus Notes,You have new mail

WinWaitActive,New Memo

sleep,500

IfWinExist,Lotus Notes,You have new mail,WinClose,Lotus Notes,You have new mail

WinWaitActive,New Memo

SetKeyDelay,2

Send,data@gpqs.com{TAB}

Send,{TAB}

Send,{TAB}

Send,Eclipse Data Request{TAB}

Send,{Enter}

Send,This is an automated email. Please do not respond.

Send,{Enter}{Enter}

Send,{ALT}FA

Send,J:\\Public\\Eclipse\\SHAW_annual.txt

Send,{Enter}{Enter}

Sleep,250

Send,{Enter}{Enter}

SplashTextOff

WinWaitClose,New Memo

Share this post


Link to post
Share on other sites



Wrong forum, you need autoit v2 Support.

Share this post


Link to post
Share on other sites

Hi,

Thanks. I have reposted it in V2 section

Share this post


Link to post
Share on other sites

Coverted to V3. More chance getting help here. hehe

CODE
; V2.64 to V3.0.100 (Version 1.0.6)

; Converted with AutoItV2toV3 [Version 1.0.6]

; © Copyright 2004 J-Paul Mesnage.

; Prologue ; should be renamed (?) and called somewhere if you are converting an include file

__init()

; End Prologue

SplashTextOn ( 'Creating text file...', 'Creating text file, please wait.', 350, 150 )

Sleep ( 500 )

* Warning MUST BE CHECKED MANUALLY

Gosub, StartFileCreation

Func StartFileCreation ( )

WinActivate ( 'Microsoft Excel' )

WinWaitActive ( 'Microsoft Excel' )

Sleep ( 500 )

Send ( '^a' )

Sleep ( 500 )

Send ( '^c' )

Sleep ( 2000 )

Run ( 'C:\WINNT\system32\notepad.exe' )

Sleep ( 500 )

WinActivate ( 'Untitled - Notepad' )

WinWaitActive ( 'Untitled - Notepad' )

Send ( '^v' )

Sleep ( 500 )

Send ( '^s' )

Sleep ( 500 )

AutoItSetOption ( "SendKeyDelay", 2 )

Send ( 'J:\Public\Eclipse\SHAW_annual.txt' )

Sleep ( 500 )

Send ( '{Enter}' )

Sleep ( 500 )

Send ( 'y' )

Sleep ( 500 )

Send ( '{Alt}{Down},x' )

SplashOff ( )

SplashTextOn ( 'Creating Email - please wait...', 'Please wait until file(s) are attached, then complete email and send it.', 350, 150 )

Sleep ( 1500 )

AutoItSetOption ( "WinTitleMatchMode", 2 )

if NOT WinExists ( 'Lotus Notes', '' ) then

endif ; StartEmail

Sleep ( 300 )

WinActivate ( 'Lotus Notes' )

Sleep ( 100 )

if WinExists ( 'Lotus Notes', 'You have new mail' ) then

WinClose ( 'Lotus Notes', 'You have new mail' )

endif

Sleep ( 200 )

if WinExists ( 'Lotus Notes', 'You have new mail' ) then

WinClose ( 'Lotus Notes', 'You have new mail' )

endif

for $__n1_ = 1 to 5

WinActivate ( 'Lotus Notes' )

if WinActive ( 'Lotus Notes', '' ) then

Send ( '^m' )

endif

Sleep ( 500 )

if NOT WinExists ( 'New Memo', '' ) then

Sleep ( 400 )

next

endif ; DoEmail

if WinExists ( 'Lotus Notes', 'You have new mail' ) then

WinClose ( 'Lotus Notes', 'You have new mail' )

endif

WinWaitActive ( 'New Memo' )

Sleep ( 500 )

if WinExists ( 'Lotus Notes', 'You have new mail' ) then

WinClose ( 'Lotus Notes', 'You have new mail' )

endif

WinWaitActive ( 'New Memo' )

AutoItSetOption ( "SendKeyDelay", 2 )

Send ( 'data@gpqs.com{TAB}' )

Send ( '{TAB}' )

Send ( '{TAB}' )

Send ( 'Eclipse Data Request{TAB}' )

Send ( '{Enter}' )

Send ( 'This is an automated email. Please do not respond.' )

Send ( '{Enter}{Enter}' )

Send ( '{ALT}FA' )

Send ( 'J:\Public\Eclipse\SHAW_annual.txt' )

Send ( '{Enter}{Enter}' )

Sleep ( 250 )

Send ( '{Enter}{Enter}' )

SplashOff ( )

WinWaitClose ( 'New Memo' )

; Epilogue Extra Functions needed for Compatibility execution

; take care of possible redefinition if you are converting an include file

;

func __init () ; to define global variables needed

endfunc

; End Epilogue

Share this post


Link to post
Share on other sites

Is this all you need?

; Send ( 'J:\Public\Eclipse\SHAW_annual.txt' )
$FileName = "J:\\Public\\Eclipse\\SHAW_" & @YEAR & @MON & @MDAY & ".txt"
Send($FileName)

:whistle:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Is this correct now?

PsaltyDS, thanks for your help

CODE
; V2.64 to V3.0.100 (Version 1.0.6)

; Converted with AutoItV2toV3 [Version 1.0.6]

; © Copyright 2004 J-Paul Mesnage.

; Prologue ; should be renamed (?) and called somewhere if you are converting an include file

__init()

; End Prologue

SplashTextOn ( 'Creating text file...', 'Creating text file, please wait.', 350, 150 )

Sleep ( 500 )

* Warning MUST BE CHECKED MANUALLY

Gosub, StartFileCreation

Func StartFileCreation ( )

WinActivate ( 'Microsoft Excel' )

WinWaitActive ( 'Microsoft Excel' )

Sleep ( 500 )

Send ( '^a' )

Sleep ( 500 )

Send ( '^c' )

Sleep ( 2000 )

Run ( 'C:\WINNT\system32\notepad.exe' )

Sleep ( 500 )

WinActivate ( 'Untitled - Notepad' )

WinWaitActive ( 'Untitled - Notepad' )

Send ( '^v' )

Sleep ( 500 )

Send ( '^s' )

Sleep ( 500 )

AutoItSetOption ( "SendKeyDelay", 2 )

c

Sleep ( 500 )

Send ( '{Enter}' )

Sleep ( 500 )

Send ( 'y' )

Sleep ( 500 )

Send ( '{Alt}{Down},x' )

SplashOff ( )

SplashTextOn ( 'Creating Email - please wait...', 'Please wait until file(s) are attached, then complete email and send it.', 350, 150 )

Sleep ( 1500 )

AutoItSetOption ( "WinTitleMatchMode", 2 )

if NOT WinExists ( 'Lotus Notes', '' ) then

endif ; StartEmail

Sleep ( 300 )

WinActivate ( 'Lotus Notes' )

Sleep ( 100 )

if WinExists ( 'Lotus Notes', 'You have new mail' ) then

WinClose ( 'Lotus Notes', 'You have new mail' )

endif

Sleep ( 200 )

if WinExists ( 'Lotus Notes', 'You have new mail' ) then

WinClose ( 'Lotus Notes', 'You have new mail' )

endif

for $__n1_ = 1 to 5

WinActivate ( 'Lotus Notes' )

if WinActive ( 'Lotus Notes', '' ) then

Send ( '^m' )

endif

Sleep ( 500 )

if NOT WinExists ( 'New Memo', '' ) then

Sleep ( 400 )

next

endif ; DoEmail

if WinExists ( 'Lotus Notes', 'You have new mail' ) then

WinClose ( 'Lotus Notes', 'You have new mail' )

endif

WinWaitActive ( 'New Memo' )

Sleep ( 500 )

if WinExists ( 'Lotus Notes', 'You have new mail' ) then

WinClose ( 'Lotus Notes', 'You have new mail' )

endif

WinWaitActive ( 'New Memo' )

AutoItSetOption ( "SendKeyDelay", 2 )

Send ( 'data@gpqs.com{TAB}' )

Send ( '{TAB}' )

Send ( '{TAB}' )

Send ( 'Eclipse Data Request{TAB}' )

Send ( '{Enter}' )

Send ( 'This is an automated email. Please do not respond.' )

Send ( '{Enter}{Enter}' )

Send ( '{ALT}FA' )

$FileName = "J:\\Public\\Eclipse\\SHAW_" & @YEAR & @MON & @MDAY & ".txt"

Send($FileName)

Send ( '{Enter}{Enter}' )

Sleep ( 250 )

Send ( '{Enter}{Enter}' )

SplashOff ( )

WinWaitClose ( 'New Memo' )

; Epilogue Extra Functions needed for Compatibility execution

; take care of possible redefinition if you are converting an include file

;

func __init () ; to define global variables needed

endfunc

; End Epilogue

Is this all you need?

; Send ( 'J:\Public\Eclipse\SHAW_annual.txt' )
$FileName = "J:\\Public\\Eclipse\\SHAW_" & @YEAR & @MON & @MDAY & ".txt"
Send($FileName)

:whistle:

Share this post


Link to post
Share on other sites

Is this correct now?

PsaltyDS, thanks for your help

Well, you're welcome. But that question is for you... does it work?

:whistle:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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
Sign in to follow this  
Followers 0