Sign in to follow this  
Followers 0
kaotkbliss

folder name to variable with random folder name

17 posts in this topic

I'm usually not one to ask for help but I am stumped.

Whenever a folder is created for this job it is named with the current date (YYYYMMDD) but then there is a random 4 numbers following (20090828_1234)

I need to be able to find that folder and put the complete folder name to a variable to be used later in the script.

I have tried variations of filefindfirst and such and altering comparison scripts to compair current date with folder names but I can't seem to get it to work.

here is a snipit of the code

$0 = @YEAR ;set $0 to year

$1 = @MON ;set $1 to month

$2 = @MDAY ;set $2 to day of month

$folder=FileFindFirstFile("H:\Client\EBER\DAILY\PRINT\"&$0&$1&$2&"*")

;$sFile=FileFindNextFile($folder)

If FileExists($folder) Then Run("Y:\Apps\PrintNet_5.3\PNetT.exe")

If Not FileExists($folder) Then END()

WinWait("PrintNet T Designer")

$point1=PixelGetColor(519,255)

While $point1=0xF7B324 ;waits until orange in splash screen is gone

$point1=PixelGetColor(519,255)

If $point1=0xF7B324 Then Sleep(50)

WEnd

Sleep(2000)

MouseClick("LEFT",1011,98,1,50)

Sleep(1000)

$point2=PixelSearch(431,173,540,227,0x0055EA)

While @error=1

$point2=PixelSearch(431,173,540,227,0x0055EA)

If @error=1 Then Sleep(50)

WEnd

If FileExists("H:\Client\EBER\DAILY\PRINT\"&$folder&"\KWNM.DBF") Then MouseClickDrag("LEFT",612,493,310,493,50)

If Not FileExists("H:\Client\EBER\DAILY\PRINT\"&$folder&"\KWNM.DBF") Then END()

Send("H:\Client\EBER\DAILY\PRINT\"&$folder&"\KWNM.DBF")

Sleep(100)


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites



the folder is created by an automation software (I think it uses the time it created the folder for the last 4 numbers) I need AutoIt to get that complete folder name and store it to send a complete file path to a different piece of software :D


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

doesn't seem to be working. I edited it like so

$0 = @YEAR ;set $0 to year

$1 = @MON ;set $1 to month

$2 = @MDAY ;set $2 to day of month

#Include <File.au3>

#Include <Array.au3>

$FileList=_FileListToArray("H:\Client\EBER\DAILY\PRINT\"&$0&$1&$2&"_*",2)

If @Error=1 Then

END()

Exit

EndIf

_ArrayDisplay($FileList,"$FileList")

If FileExists($FileList) Then Run("Y:\Apps\PrintNet_5.3\PNetT.exe")

If Not FileExists($FileList) Then END()

WinWait("PrintNet T Designer")

$point1=PixelGetColor(519,255)

While $point1=0xF7B324 ;waits until orange in splash screen is covered or gone

$point1=PixelGetColor(519,255)

If $point1=0xF7B324 Then Sleep(50)

WEnd

Sleep(2000)

MouseClick("LEFT",1011,98,1,50)

Sleep(1000)

$point2=PixelSearch(431,173,540,227,0x0055EA)

While @error=1

$point2=PixelSearch(431,173,540,227,0x0055EA)

If @error=1 Then Sleep(50)

WEnd

If FileExists("H:\Client\EBER\DAILY\PRINT\"&$folder&"\KWNM.DBF") Then MouseClickDrag("LEFT",612,493,310,493,50)

If Not FileExists("H:\Client\EBER\DAILY\PRINT\"&$folder&"\KWNM.DBF") Then PAM()

Send("H:\Client\EBER\DAILY\PRINT\"&$folder&"\KWNM.DBF")

Sleep(100)

But it's simply exiting the script.


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

@athiwatc..

I tried out your suggestion. It doesn't work, as _filelisttoarray() doesn't support wildcards like *.

@kaotbliss..

Are all these files stored in the same folder.. If yes, just give the path to that folder in file list to array and later do a stringinstr of the generated array elements, to check for those starting with yyyymmdd


[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites

[quote

@kaotbliss..

Are all these files stored in the same folder.. If yes, just give the path to that folder in file list to array and later do a stringinstr of the generated array elements, to check for those starting with yyyymmdd


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

Something Like this:

#include<file.au3>
#include<array.au3>
$j=1
$folders=_FileListToArray("e:\script"); put ur path here
local $result[1000]
For $i=1 to $folders[0]
    
    If StringLeft($folders[$i],9)="28082009_" then ;put ur yyyymmdd here
        
        $result[$j]=$folders[$i]
        $j=$j+1
    EndIf
Next

_ArrayDisplay($result,"")

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites

got it to work, thank you :D

$0 = @YEAR ;set $0 to year

$1 = @MON ;set $1 to month

$2 = @MDAY ;set $2 to day of month

#include<file.au3>

#include<array.au3>

$j=1

$folders=_FileListToArray("H:\Client\EBER\DAILY\PRINT\"); put ur path here

local $result[1000]

For $i=1 to $folders[0]

If StringLeft($folders[$i],9)=""&$0&$1&$2&"_" then ;put ur yyyymmdd here

$result[$j]=$folders[$i]

$j=$j+1

EndIf

Next

If FileExists("H:\Client\EBER\DAILY\PRINT\"&$result) Then Run("Y:\Apps\PrintNet_5.3\PNetT.exe")

If Not FileExists("H:\Client\EBER\DAILY\PRINT\"&$result) Then END()

WinWait("PrintNet T Designer")

$point1=PixelGetColor(519,255)

While $point1=0xF7B324 ;waits until orange in splash screen is covered or gone

$point1=PixelGetColor(519,255)

If $point1=0xF7B324 Then Sleep(50)

WEnd

Sleep(2000)


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

Great!!

Cheers,

M


[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

@athiwatc..

I tried out your suggestion. It doesn't work, as _filelisttoarray() doesn't support wildcards like *.

@kaotbliss..

Are all these files stored in the same folder.. If yes, just give the path to that folder in file list to array and later do a stringinstr of the generated array elements, to check for those starting with yyyymmdd

It does I just putted it in the wrong section

_FileListToArray($sPath[, $sFilter = "*"[, $iFlag = 0]])

The code should be

#Include <File.au3>
#Include <Array.au3>
$FileList=_FileListToArray("FilePath", "YYYYMMDD_*", 2)
If @Error=1 Then
    MsgBox (0,"","No Files\Folders Found.")
    Exit
EndIf
_ArrayDisplay($FileList,"$FileList")
Edited by athiwatc

Share this post


Link to post
Share on other sites

Using both WolfWorld's code and Manjish's code does the same thing for this script. It gets through the first file check just fine and does what it is supposed to do. However when it gets to the next file check, it acts as if the file doesn't exist (as well as for each subsequent filecheck) until the script exits.

AutoItSetOption("WinDetectHiddenText", 1)
$email=ControlGetText("[CLASS:SUPERGRID]","EBER Print Notification","4704")
While @error=1
    $email=ControlGetText("[CLASS:SUPERGRID]","EBER Print Notification","4704")
    If @error=1 Then Sleep(1000)
WEnd
$printnet=WinActive("PrintNet T Designer")
While $printnet=1
    $printnet=WinActive("PrintNet T Designer")
    If $printnet=1 Then Sleep(10000)
    WEnd
;------------------------------------
$0 = @YEAR ;set $0 to year
$1 = @MON  ;set $1 to month
$2 = @MDAY ;set $2 to day of month
#Include <File.au3>
#Include <Array.au3>
$FileList=_FileListToArray("H:\Client\EBER\DAILY\PRINT\", "YYYYMMDD_*", 2)
If @Error=1 Then
    End()
EndIf
If FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList) Then Run("Y:\Apps\PrintNet_5.3\PNetT.exe")
If Not FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList) Then END()
    WinWait("PrintNet T Designer")
$point1=PixelGetColor(519,255)
While $point1=0xF7B324 ;waits until orange in splash screen is covered or gone
     $point1=PixelGetColor(519,255)
     If $point1=0xF7B324 Then Sleep(50)
    WEnd
Sleep(2000)
;-----------------------------------------------------------------------------------
$point1=PixelGetColor(519,255) ;checks to see if the license exceeded error exists
If $point1=0x0054E3 Then Send("{TAB}{ENTER}") ;closes error if exists
If $point1=0x0054E3 Then End() ;exits script if error
;-----------------------------------------------------------------------------------
Sleep(1000)
;-------------------------------
Send("{ALT}")                 ;|
Sleep(2000)                   ;|
Send("f")                     ;|
Sleep(2000)                   ;|
Send("o")                     ;| opens workflow
Sleep(2000)                   ;|
Send("V:\EBER\eber7.wfd")     ;| sends workflow location
Sleep(2000)                   ;|
MouseClick("Left",768,473,50) ;| clicks the ok button
;-------------------------------
Sleep(1000)
$point=PixelGetColor(639,261)
While $point<>0xB07C8F
    $point=PixelGetColor(639,261)
    If $point<>0xB07C8F Then Sleep(50)
    WEnd
    Sleep(1000)
    Send("{F5}")
    $point1=PixelGetColor(255,163)
    While $point1<>0x73C172
        $point1=PixelGetColor(255,163)
        If $point1<>0x73C172 Then Sleep(50)
        WEnd
    ;--------------------------
    Sleep(1000)              ;|
    Send("{ALT}")            ;|
    Sleep(1000)              ;|
    Send("w")                ;| show workflow perameters
    Sleep(1000)              ;|
    Send("{DOWN 4}")         ;|
    Sleep(1000)              ;|
    Send("{ENTER}")          ;|
    Sleep(1000)              ;|
    ;--------------------------
AAP()
Func AAP()
    MouseClick("LEFT",1011,98,1,50)
    Sleep(1000)
    $point2=PixelGetColor(501,206)
    While $point2<>0x0058EE
            $point2=PixelGetColor(501,206)
            If $point2<>0x0058EE Then Sleep(50)
            WEnd
    If FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\AAP.DBF") Then MouseClickDrag("LEFT",612,493,310,493,50) ; Problem starts here!!!!!!!
    If Not FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\AAP.DBF") Then KWNM()
    Send("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\AAP.DBF")
    Sleep(100)
    Send("{ENTER}")
    MouseClickDrag("LEFT",882,363,134,363,50)
    Send("{BS}")
    Sleep(50)
    Send("H:\Client\EBER\DAILY\PRINT\PDF_Copies\Postscript Files\EBER_%ts(MMdd)_%h[2].%e")
    Sleep(100)
MouseClick("LEFT",509,430,50)
Sleep(1000)
$point3=PixelGetColor(303,302)
While $point3=0xF6F6F4 ;waiting until processess is complete
     $point3=PixelGetColor(303,302)
     If $point3=0xF6F6F4 Then Sleep(50)
     WEnd
     MouseClick("LEFT",174,668,1,50)
     KWNM()
 EndFunc
Func KWNM()
    MouseClick("LEFT",1011,98,1,50)
    Sleep(1000)
    $point2=PixelGetColor(501,206)
    While $point2<>0x0058EE
            $point2=PixelGetColor(501,206)
            If $point2<>0x0058EE Then Sleep(50)
        WEnd
    If FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\KWNM.DBF") Then MouseClickDrag("LEFT",612,493,310,493,50)
    If Not FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\KWNM.DBF") Then PAM()
    Send("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\KWNM.DBF")
    Sleep(100)
    Send("{ENTER}")
    MouseClickDrag("LEFT",882,363,134,363,50)
    Send("{BS}")
    Sleep(50)
    Send("H:\Client\EBER\DAILY\PRINT\PDF_Copies\Postscript Files\EBER_%ts(MMdd)_%h[2].%e")
    Sleep(100)
MouseClick("LEFT",509,430,50)
Sleep(1000)
$point3=PixelGetColor(303,302)
While $point3=0xF6F6F4 ;waiting until processess is complete
     $point3=PixelGetColor(303,302)
     If $point3=0xF6F6F4 Then Sleep(50)
     WEnd
     MouseClick("LEFT",174,668,1,50)
     PAM()
 EndFunc
Func PAM()
        MouseClick("LEFT",1011,98,1,50)
    Sleep(1000)
    $point2=PixelGetColor(501,206)
    While $point2<>0x0058EE
            $point2=PixelGetColor(501,206)
            If $point2<>0x0058EE Then Sleep(50)
        WEnd
    If FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\PAM.DBF") Then MouseClickDrag("LEFT",612,493,310,493,50)
    If Not FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\PAM.DBF") Then RTP()
    Send("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\PAM.DBF")
    Sleep(100)
    Send("{ENTER}")
    MouseClickDrag("LEFT",882,363,134,363,50)
    Send("{BS}")
    Sleep(50)
    Send("H:\Client\EBER\DAILY\PRINT\PDF_Copies\Postscript Files\EBER_%ts(MMdd)_%h[2].%e")
    Sleep(100)
MouseClick("LEFT",509,430,50)
Sleep(1000)
$point3=PixelGetColor(303,302)
While $point3=0xF6F6F4 ;waiting until processess is complete
     $point3=PixelGetColor(303,302)
     If $point3=0xF6F6F4 Then Sleep(50)
     WEnd
     MouseClick("LEFT",174,668,1,50)
     RTP()
 EndFunc
Func RTP()
            MouseClick("LEFT",1011,98,1,50)
    Sleep(1000)
    $point2=PixelGetColor(501,206)
    While $point2<>0x0058EE
            $point2=PixelGetColor(501,206)
            If $point2<>0x0058EE Then Sleep(50)
        WEnd
    If FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\RTP.DBF") Then MouseClickDrag("LEFT",612,493,310,493,50)
    If Not FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\RTP.DBF") Then END()
    Send("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\RTP.DBF")
    Sleep(100)
    Send("{ENTER}")
    MouseClickDrag("LEFT",882,363,134,363,50)
    Send("{BS}")
    Sleep(50)
    Send("H:\Client\EBER\DAILY\PRINT\PDF_Copies\Postscript Files\EBER_%ts(MMdd)_%h[2].%e")
    Sleep(100)
MouseClick("LEFT",509,430,50)
Sleep(1000)
$point3=PixelGetColor(303,302)
While $point3=0xF6F6F4 ;waiting until processess is complete
     $point3=PixelGetColor(303,302)
     If $point3=0xF6F6F4 Then Sleep(50)
     WEnd
     MouseClick("LEFT",174,668,1,50)
     END()
 EndFunc
 Func END()
WinKill("PrintNet T Designer")
Sleep(1000)
PixelSearch(349,333,385,368,0xFFFF00)
If Not @error=1 Then Send("{TAB}{ENTER}")
    Exit
EndFunc

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

Using both WolfWorld's code and Manjish's code does the same thing for this script. It gets through the first file check just fine and does what it is supposed to do. However when it gets to the next file check, it acts as if the file doesn't exist (as well as for each subsequent filecheck) until the script exits.

AutoItSetOption("WinDetectHiddenText", 1)
$email=ControlGetText("[CLASS:SUPERGRID]","EBER Print Notification","4704")
While @error=1
    $email=ControlGetText("[CLASS:SUPERGRID]","EBER Print Notification","4704")
    If @error=1 Then Sleep(1000)
WEnd
$printnet=WinActive("PrintNet T Designer")
While $printnet=1
    $printnet=WinActive("PrintNet T Designer")
    If $printnet=1 Then Sleep(10000)
    WEnd
;------------------------------------
$0 = @YEAR ;set $0 to year
$1 = @MON  ;set $1 to month
$2 = @MDAY ;set $2 to day of month
#Include <File.au3>
#Include <Array.au3>
$FileList=_FileListToArray("H:\Client\EBER\DAILY\PRINT\", "YYYYMMDD_*", 2)
If @Error=1 Then
    End()
EndIf
If FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList) Then Run("Y:\Apps\PrintNet_5.3\PNetT.exe")
If Not FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList) Then END()
    WinWait("PrintNet T Designer")
$point1=PixelGetColor(519,255)
While $point1=0xF7B324 ;waits until orange in splash screen is covered or gone
     $point1=PixelGetColor(519,255)
     If $point1=0xF7B324 Then Sleep(50)
    WEnd
Sleep(2000)
;-----------------------------------------------------------------------------------
$point1=PixelGetColor(519,255) ;checks to see if the license exceeded error exists
If $point1=0x0054E3 Then Send("{TAB}{ENTER}") ;closes error if exists
If $point1=0x0054E3 Then End() ;exits script if error
;-----------------------------------------------------------------------------------
Sleep(1000)
;-------------------------------
Send("{ALT}")                 ;|
Sleep(2000)                   ;|
Send("f")                     ;|
Sleep(2000)                   ;|
Send("o")                     ;| opens workflow
Sleep(2000)                   ;|
Send("V:\EBER\eber7.wfd")     ;| sends workflow location
Sleep(2000)                   ;|
MouseClick("Left",768,473,50) ;| clicks the ok button
;-------------------------------
Sleep(1000)
$point=PixelGetColor(639,261)
While $point<>0xB07C8F
    $point=PixelGetColor(639,261)
    If $point<>0xB07C8F Then Sleep(50)
    WEnd
    Sleep(1000)
    Send("{F5}")
    $point1=PixelGetColor(255,163)
    While $point1<>0x73C172
        $point1=PixelGetColor(255,163)
        If $point1<>0x73C172 Then Sleep(50)
        WEnd
    ;--------------------------
    Sleep(1000)              ;|
    Send("{ALT}")            ;|
    Sleep(1000)              ;|
    Send("w")                ;| show workflow perameters
    Sleep(1000)              ;|
    Send("{DOWN 4}")         ;|
    Sleep(1000)              ;|
    Send("{ENTER}")          ;|
    Sleep(1000)              ;|
    ;--------------------------
AAP()
Func AAP()
    MouseClick("LEFT",1011,98,1,50)
    Sleep(1000)
    $point2=PixelGetColor(501,206)
    While $point2<>0x0058EE
            $point2=PixelGetColor(501,206)
            If $point2<>0x0058EE Then Sleep(50)
            WEnd
    If FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\AAP.DBF") Then MouseClickDrag("LEFT",612,493,310,493,50) ; Problem starts here!!!!!!!
    If Not FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\AAP.DBF") Then KWNM()
    Send("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\AAP.DBF")
    Sleep(100)
    Send("{ENTER}")
    MouseClickDrag("LEFT",882,363,134,363,50)
    Send("{BS}")
    Sleep(50)
    Send("H:\Client\EBER\DAILY\PRINT\PDF_Copies\Postscript Files\EBER_%ts(MMdd)_%h[2].%e")
    Sleep(100)
MouseClick("LEFT",509,430,50)
Sleep(1000)
$point3=PixelGetColor(303,302)
While $point3=0xF6F6F4 ;waiting until processess is complete
     $point3=PixelGetColor(303,302)
     If $point3=0xF6F6F4 Then Sleep(50)
     WEnd
     MouseClick("LEFT",174,668,1,50)
     KWNM()
 EndFunc
Func KWNM()
    MouseClick("LEFT",1011,98,1,50)
    Sleep(1000)
    $point2=PixelGetColor(501,206)
    While $point2<>0x0058EE
            $point2=PixelGetColor(501,206)
            If $point2<>0x0058EE Then Sleep(50)
        WEnd
    If FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\KWNM.DBF") Then MouseClickDrag("LEFT",612,493,310,493,50)
    If Not FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\KWNM.DBF") Then PAM()
    Send("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\KWNM.DBF")
    Sleep(100)
    Send("{ENTER}")
    MouseClickDrag("LEFT",882,363,134,363,50)
    Send("{BS}")
    Sleep(50)
    Send("H:\Client\EBER\DAILY\PRINT\PDF_Copies\Postscript Files\EBER_%ts(MMdd)_%h[2].%e")
    Sleep(100)
MouseClick("LEFT",509,430,50)
Sleep(1000)
$point3=PixelGetColor(303,302)
While $point3=0xF6F6F4 ;waiting until processess is complete
     $point3=PixelGetColor(303,302)
     If $point3=0xF6F6F4 Then Sleep(50)
     WEnd
     MouseClick("LEFT",174,668,1,50)
     PAM()
 EndFunc
Func PAM()
        MouseClick("LEFT",1011,98,1,50)
    Sleep(1000)
    $point2=PixelGetColor(501,206)
    While $point2<>0x0058EE
            $point2=PixelGetColor(501,206)
            If $point2<>0x0058EE Then Sleep(50)
        WEnd
    If FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\PAM.DBF") Then MouseClickDrag("LEFT",612,493,310,493,50)
    If Not FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\PAM.DBF") Then RTP()
    Send("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\PAM.DBF")
    Sleep(100)
    Send("{ENTER}")
    MouseClickDrag("LEFT",882,363,134,363,50)
    Send("{BS}")
    Sleep(50)
    Send("H:\Client\EBER\DAILY\PRINT\PDF_Copies\Postscript Files\EBER_%ts(MMdd)_%h[2].%e")
    Sleep(100)
MouseClick("LEFT",509,430,50)
Sleep(1000)
$point3=PixelGetColor(303,302)
While $point3=0xF6F6F4 ;waiting until processess is complete
     $point3=PixelGetColor(303,302)
     If $point3=0xF6F6F4 Then Sleep(50)
     WEnd
     MouseClick("LEFT",174,668,1,50)
     RTP()
 EndFunc
Func RTP()
            MouseClick("LEFT",1011,98,1,50)
    Sleep(1000)
    $point2=PixelGetColor(501,206)
    While $point2<>0x0058EE
            $point2=PixelGetColor(501,206)
            If $point2<>0x0058EE Then Sleep(50)
        WEnd
    If FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\RTP.DBF") Then MouseClickDrag("LEFT",612,493,310,493,50)
    If Not FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\RTP.DBF") Then END()
    Send("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\RTP.DBF")
    Sleep(100)
    Send("{ENTER}")
    MouseClickDrag("LEFT",882,363,134,363,50)
    Send("{BS}")
    Sleep(50)
    Send("H:\Client\EBER\DAILY\PRINT\PDF_Copies\Postscript Files\EBER_%ts(MMdd)_%h[2].%e")
    Sleep(100)
MouseClick("LEFT",509,430,50)
Sleep(1000)
$point3=PixelGetColor(303,302)
While $point3=0xF6F6F4 ;waiting until processess is complete
     $point3=PixelGetColor(303,302)
     If $point3=0xF6F6F4 Then Sleep(50)
     WEnd
     MouseClick("LEFT",174,668,1,50)
     END()
 EndFunc
 Func END()
WinKill("PrintNet T Designer")
Sleep(1000)
PixelSearch(349,333,385,368,0xFFFF00)
If Not @error=1 Then Send("{TAB}{ENTER}")
    Exit
EndFunc

Can no one help with this? It almost seems as though the folder name is erased from the variable after it's first use, but even when I attempt to reset the variable throughout the script, it still doesn't work after the initial $FileList=_FileListToArray("H:\Client\EBER\DAILY\PRINT\", "YYYYMMDD_*", 2)


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

AutoItSetOption("WinDetectHiddenText", 1)
$email=ControlGetText("[CLASS:SUPERGRID]","EBER Print Notification","4704")
While @error=1
    $email=ControlGetText("[CLASS:SUPERGRID]","EBER Print Notification","4704")
    If @error=1 Then Sleep(1000)
WEnd
$printnet=WinActive("PrintNet T Designer")
While $printnet=1
    $printnet=WinActive("PrintNet T Designer")
    If $printnet=1 Then Sleep(10000)
    WEnd
;------------------------------------
$0 = @YEAR ;set $0 to year
$1 = @MON  ;set $1 to month
$2 = @MDAY ;set $2 to day of month
#Include <File.au3>
#Include <Array.au3>
$FileList=_FileListToArray("H:\Client\EBER\DAILY\PRINT\", "YYYYMMDD_*", 2)
If @Error=1 Then
    End()
EndIf
If FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList) Then Run("Y:\Apps\PrintNet_5.3\PNetT.exe")
If Not FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList) Then END()
    WinWait("PrintNet T Designer")
$point1=PixelGetColor(519,255)
While $point1=0xF7B324 ;waits until orange in splash screen is covered or gone
     $point1=PixelGetColor(519,255)
     If $point1=0xF7B324 Then Sleep(50)
    WEnd
Sleep(2000)
;-----------------------------------------------------------------------------------
$point1=PixelGetColor(519,255) ;checks to see if the license exceeded error exists
If $point1=0x0054E3 Then Send("{TAB}{ENTER}") ;closes error if exists
If $point1=0x0054E3 Then End() ;exits script if error
;-----------------------------------------------------------------------------------
Sleep(1000)
;-------------------------------
Send("{ALT}")                 ;|
Sleep(2000)                   ;|
Send("f")                     ;|
Sleep(2000)                   ;|
Send("o")                     ;| opens workflow
Sleep(2000)                   ;|
Send("V:\EBER\eber7.wfd")     ;| sends workflow location
Sleep(2000)                   ;|
MouseClick("Left",768,473,50) ;| clicks the ok button
;-------------------------------
Sleep(1000)
$point=PixelGetColor(639,261)
While $point<>0xB07C8F
    $point=PixelGetColor(639,261)
    If $point<>0xB07C8F Then Sleep(50)
    WEnd
    Sleep(1000)
    Send("{F5}")
    $point1=PixelGetColor(255,163)
    While $point1<>0x73C172
        $point1=PixelGetColor(255,163)
        If $point1<>0x73C172 Then Sleep(50)
        WEnd
    ;--------------------------
    Sleep(1000)              ;|
    Send("{ALT}")            ;|
    Sleep(1000)              ;|
    Send("w")                ;| show workflow perameters
    Sleep(1000)              ;|
    Send("{DOWN 4}")         ;|
    Sleep(1000)              ;|
    Send("{ENTER}")          ;|
    Sleep(1000)              ;|
    ;--------------------------
AAP()
Func AAP()
    MouseClick("LEFT",1011,98,1,50)
    Sleep(1000)
    $point2=PixelGetColor(501,206)
    While $point2<>0x0058EE
            $point2=PixelGetColor(501,206)
            If $point2<>0x0058EE Then Sleep(50)
        WEnd
        $FileList=_FileListToArray("H:\Client\EBER\DAILY\PRINT\", "YYYYMMDD_*", 2)
    If FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\AAP.DBF") Then MouseClickDrag("LEFT",612,493,310,493,50) ; Problem starts here!!!!!!!
    If Not FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\AAP.DBF") Then KWNM()
    Send("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\AAP.DBF")
    Sleep(100)
    Send("{ENTER}")
    MouseClickDrag("LEFT",882,363,134,363,50)
    Send("{BS}")
    Sleep(50)
    Send("H:\Client\EBER\DAILY\PRINT\PDF_Copies\Postscript Files\EBER_%ts(MMdd)_%h[2].%e")
    Sleep(100)
MouseClick("LEFT",509,430,50)
Sleep(1000)
$point3=PixelGetColor(303,302)
While $point3=0xF6F6F4 ;waiting until processess is complete
     $point3=PixelGetColor(303,302)
     If $point3=0xF6F6F4 Then Sleep(50)
     WEnd
     MouseClick("LEFT",174,668,1,50)
     KWNM()
 EndFunc
Func KWNM()
    MouseClick("LEFT",1011,98,1,50)
    Sleep(1000)
    $point2=PixelGetColor(501,206)
    While $point2<>0x0058EE
            $point2=PixelGetColor(501,206)
            If $point2<>0x0058EE Then Sleep(50)
        WEnd
    If FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\KWNM.DBF") Then MouseClickDrag("LEFT",612,493,310,493,50)
    If Not FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\KWNM.DBF") Then PAM()
    Send("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\KWNM.DBF")
    Sleep(100)
    Send("{ENTER}")
    MouseClickDrag("LEFT",882,363,134,363,50)
    Send("{BS}")
    Sleep(50)
    Send("H:\Client\EBER\DAILY\PRINT\PDF_Copies\Postscript Files\EBER_%ts(MMdd)_%h[2].%e")
    Sleep(100)
MouseClick("LEFT",509,430,50)
Sleep(1000)
$point3=PixelGetColor(303,302)
While $point3=0xF6F6F4 ;waiting until processess is complete
     $point3=PixelGetColor(303,302)
     If $point3=0xF6F6F4 Then Sleep(50)
     WEnd
     MouseClick("LEFT",174,668,1,50)
     PAM()
 EndFunc
Func PAM()
        MouseClick("LEFT",1011,98,1,50)
    Sleep(1000)
    $point2=PixelGetColor(501,206)
    While $point2<>0x0058EE
            $point2=PixelGetColor(501,206)
            If $point2<>0x0058EE Then Sleep(50)
        WEnd
    If FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\PAM.DBF") Then MouseClickDrag("LEFT",612,493,310,493,50)
    If Not FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\PAM.DBF") Then RTP()
    Send("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\PAM.DBF")
    Sleep(100)
    Send("{ENTER}")
    MouseClickDrag("LEFT",882,363,134,363,50)
    Send("{BS}")
    Sleep(50)
    Send("H:\Client\EBER\DAILY\PRINT\PDF_Copies\Postscript Files\EBER_%ts(MMdd)_%h[2].%e")
    Sleep(100)
MouseClick("LEFT",509,430,50)
Sleep(1000)
$point3=PixelGetColor(303,302)
While $point3=0xF6F6F4 ;waiting until processess is complete
     $point3=PixelGetColor(303,302)
     If $point3=0xF6F6F4 Then Sleep(50)
     WEnd
     MouseClick("LEFT",174,668,1,50)
     RTP()
 EndFunc
Func RTP()
            MouseClick("LEFT",1011,98,1,50)
    Sleep(1000)
    $point2=PixelGetColor(501,206)
    While $point2<>0x0058EE
            $point2=PixelGetColor(501,206)
            If $point2<>0x0058EE Then Sleep(50)
        WEnd
    If FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\RTP.DBF") Then MouseClickDrag("LEFT",612,493,310,493,50)
    If Not FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\RTP.DBF") Then END()
    Send("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\RTP.DBF")
    Sleep(100)
    Send("{ENTER}")
    MouseClickDrag("LEFT",882,363,134,363,50)
    Send("{BS}")
    Sleep(50)
    Send("H:\Client\EBER\DAILY\PRINT\PDF_Copies\Postscript Files\EBER_%ts(MMdd)_%h[2].%e")
    Sleep(100)
MouseClick("LEFT",509,430,50)
Sleep(1000)
$point3=PixelGetColor(303,302)
While $point3=0xF6F6F4 ;waiting until processess is complete
     $point3=PixelGetColor(303,302)
     If $point3=0xF6F6F4 Then Sleep(50)
     WEnd
     MouseClick("LEFT",174,668,1,50)
     END()
 EndFunc
 Func END()
WinKill("PrintNet T Designer")
Sleep(1000)
PixelSearch(349,333,385,368,0xFFFF00)
If Not @error=1 Then Send("{TAB}{ENTER}")
    Exit
EndFunc

Share this post


Link to post
Share on other sites

AutoItSetOption("WinDetectHiddenText", 1)
$email=ControlGetText("[CLASS:SUPERGRID]","EBER Print Notification","4704")
While @error=1
    $email=ControlGetText("[CLASS:SUPERGRID]","EBER Print Notification","4704")
    If @error=1 Then Sleep(1000)
WEnd
$printnet=WinActive("PrintNet T Designer")
While $printnet=1
    $printnet=WinActive("PrintNet T Designer")
    If $printnet=1 Then Sleep(10000)
    WEnd
;------------------------------------
$0 = @YEAR ;set $0 to year
$1 = @MON  ;set $1 to month
$2 = @MDAY ;set $2 to day of month
#Include <File.au3>
#Include <Array.au3>
$FileList=_FileListToArray("H:\Client\EBER\DAILY\PRINT\", "YYYYMMDD_*", 2)
If @Error=1 Then
    End()
EndIf
If FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList) Then Run("Y:\Apps\PrintNet_5.3\PNetT.exe")
If Not FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList) Then END()
    WinWait("PrintNet T Designer")
$point1=PixelGetColor(519,255)
While $point1=0xF7B324 ;waits until orange in splash screen is covered or gone
     $point1=PixelGetColor(519,255)
     If $point1=0xF7B324 Then Sleep(50)
    WEnd
Sleep(2000)
;-----------------------------------------------------------------------------------
$point1=PixelGetColor(519,255) ;checks to see if the license exceeded error exists
If $point1=0x0054E3 Then Send("{TAB}{ENTER}") ;closes error if exists
If $point1=0x0054E3 Then End() ;exits script if error
;-----------------------------------------------------------------------------------
Sleep(1000)
;-------------------------------
Send("{ALT}")                 ;|
Sleep(2000)                   ;|
Send("f")                     ;|
Sleep(2000)                   ;|
Send("o")                     ;| opens workflow
Sleep(2000)                   ;|
Send("V:\EBER\eber7.wfd")     ;| sends workflow location
Sleep(2000)                   ;|
MouseClick("Left",768,473,50) ;| clicks the ok button
;-------------------------------
Sleep(1000)
$point=PixelGetColor(639,261)
While $point<>0xB07C8F
    $point=PixelGetColor(639,261)
    If $point<>0xB07C8F Then Sleep(50)
    WEnd
    Sleep(1000)
    Send("{F5}")
    $point1=PixelGetColor(255,163)
    While $point1<>0x73C172
        $point1=PixelGetColor(255,163)
        If $point1<>0x73C172 Then Sleep(50)
        WEnd
    ;--------------------------
    Sleep(1000)              ;|
    Send("{ALT}")            ;|
    Sleep(1000)              ;|
    Send("w")                ;| show workflow perameters
    Sleep(1000)              ;|
    Send("{DOWN 4}")         ;|
    Sleep(1000)              ;|
    Send("{ENTER}")          ;|
    Sleep(1000)              ;|
    ;--------------------------
AAP()
Func AAP()
    MouseClick("LEFT",1011,98,1,50)
    Sleep(1000)
    $point2=PixelGetColor(501,206)
    While $point2<>0x0058EE
            $point2=PixelGetColor(501,206)
            If $point2<>0x0058EE Then Sleep(50)
        WEnd
        $FileList=_FileListToArray("H:\Client\EBER\DAILY\PRINT\", "YYYYMMDD_*", 2)
    If FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\AAP.DBF") Then MouseClickDrag("LEFT",612,493,310,493,50) ; Problem starts here!!!!!!!
    If Not FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\AAP.DBF") Then KWNM()
    Send("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\AAP.DBF")
    Sleep(100)
    Send("{ENTER}")
    MouseClickDrag("LEFT",882,363,134,363,50)
    Send("{BS}")
    Sleep(50)
    Send("H:\Client\EBER\DAILY\PRINT\PDF_Copies\Postscript Files\EBER_%ts(MMdd)_%h[2].%e")
    Sleep(100)
MouseClick("LEFT",509,430,50)
Sleep(1000)
$point3=PixelGetColor(303,302)
While $point3=0xF6F6F4 ;waiting until processess is complete
     $point3=PixelGetColor(303,302)
     If $point3=0xF6F6F4 Then Sleep(50)
     WEnd
     MouseClick("LEFT",174,668,1,50)
     KWNM()
 EndFunc
Func KWNM()
    MouseClick("LEFT",1011,98,1,50)
    Sleep(1000)
    $point2=PixelGetColor(501,206)
    While $point2<>0x0058EE
            $point2=PixelGetColor(501,206)
            If $point2<>0x0058EE Then Sleep(50)
        WEnd
    If FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\KWNM.DBF") Then MouseClickDrag("LEFT",612,493,310,493,50)
    If Not FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\KWNM.DBF") Then PAM()
    Send("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\KWNM.DBF")
    Sleep(100)
    Send("{ENTER}")
    MouseClickDrag("LEFT",882,363,134,363,50)
    Send("{BS}")
    Sleep(50)
    Send("H:\Client\EBER\DAILY\PRINT\PDF_Copies\Postscript Files\EBER_%ts(MMdd)_%h[2].%e")
    Sleep(100)
MouseClick("LEFT",509,430,50)
Sleep(1000)
$point3=PixelGetColor(303,302)
While $point3=0xF6F6F4 ;waiting until processess is complete
     $point3=PixelGetColor(303,302)
     If $point3=0xF6F6F4 Then Sleep(50)
     WEnd
     MouseClick("LEFT",174,668,1,50)
     PAM()
 EndFunc
Func PAM()
        MouseClick("LEFT",1011,98,1,50)
    Sleep(1000)
    $point2=PixelGetColor(501,206)
    While $point2<>0x0058EE
            $point2=PixelGetColor(501,206)
            If $point2<>0x0058EE Then Sleep(50)
        WEnd
    If FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\PAM.DBF") Then MouseClickDrag("LEFT",612,493,310,493,50)
    If Not FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\PAM.DBF") Then RTP()
    Send("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\PAM.DBF")
    Sleep(100)
    Send("{ENTER}")
    MouseClickDrag("LEFT",882,363,134,363,50)
    Send("{BS}")
    Sleep(50)
    Send("H:\Client\EBER\DAILY\PRINT\PDF_Copies\Postscript Files\EBER_%ts(MMdd)_%h[2].%e")
    Sleep(100)
MouseClick("LEFT",509,430,50)
Sleep(1000)
$point3=PixelGetColor(303,302)
While $point3=0xF6F6F4 ;waiting until processess is complete
     $point3=PixelGetColor(303,302)
     If $point3=0xF6F6F4 Then Sleep(50)
     WEnd
     MouseClick("LEFT",174,668,1,50)
     RTP()
 EndFunc
Func RTP()
            MouseClick("LEFT",1011,98,1,50)
    Sleep(1000)
    $point2=PixelGetColor(501,206)
    While $point2<>0x0058EE
            $point2=PixelGetColor(501,206)
            If $point2<>0x0058EE Then Sleep(50)
        WEnd
    If FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\RTP.DBF") Then MouseClickDrag("LEFT",612,493,310,493,50)
    If Not FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\RTP.DBF") Then END()
    Send("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\RTP.DBF")
    Sleep(100)
    Send("{ENTER}")
    MouseClickDrag("LEFT",882,363,134,363,50)
    Send("{BS}")
    Sleep(50)
    Send("H:\Client\EBER\DAILY\PRINT\PDF_Copies\Postscript Files\EBER_%ts(MMdd)_%h[2].%e")
    Sleep(100)
MouseClick("LEFT",509,430,50)
Sleep(1000)
$point3=PixelGetColor(303,302)
While $point3=0xF6F6F4 ;waiting until processess is complete
     $point3=PixelGetColor(303,302)
     If $point3=0xF6F6F4 Then Sleep(50)
     WEnd
     MouseClick("LEFT",174,668,1,50)
     END()
 EndFunc
 Func END()
WinKill("PrintNet T Designer")
Sleep(1000)
PixelSearch(349,333,385,368,0xFFFF00)
If Not @error=1 Then Send("{TAB}{ENTER}")
    Exit
EndFunc

I'm getting the same thing still :D

When it gets to

("H:\Client\EBER\DAILY\PRINT\", "YYYYMMDD_*", 2)

If FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\AAP.DBF") Then MouseClickDrag("LEFT",612,493,310,493,50) ; Problem starts here!!!!!!!

If Not FileExists("H:\Client\EBER\DAILY\PRINT\"&$FileList&"\AAP.DBF") Then KWNM()

A dialog box opens up to enter a file path and this is where it's checking to see if that file is there, then it is supposed to enter the path:

Send("H:\Client\EBER\DAILY\PRINT\"&$FileList&"AAP.DBF")

but what it seems to be doing is skipping to the next function (as if the file doesn't exist) and keeps doing that until it reaches the end and exits the script.


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

Because it's not active, try and have a look at ControlSend.

What's not active, the $FileList=_FileListToArray variable?

If you mean the window it's supposed to send the file path to, yes it is active and there is a mouseclickdrag command between the fileexists and the send that it's not performing.


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

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