Sign in to follow this  
Followers 0
Tigerweld

MsgBox

7 posts in this topic

Why is this not working?

$t = FileGetTime("c:\report\30 Days Past Due-Bank.pdf", 1, 0)
    MsgBox(4096, "Date", "Date created is " & $t)

Share this post


Link to post
Share on other sites



What does this do?

$file = "c:\report\30 Days Past Due-Bank.pdf"
If FileExists($file) then 
    $t = FileGetTime("c:\report\30 Days Past Due-Bank.pdf", 1, 0)
    MsgBox(4096, "Date", "Date created is " & $t)
Else 
    Msgbox(4096, "Error", "File was not found.")
EndIf

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

returns as array they way you formated it

This should work:

$t = FileGetTime("c:\report\30 Days Past Due-Bank.pdf", 1, 1)
   MsgBox(4096, "Date", "Date created is " & $t)

UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt.

Share this post


Link to post
Share on other sites

Reason is, I cannot get this to work.

$t = FileGetTime("c:\report\30 Days Past Due-Bank.pdf", 1, 0)
    MsgBox(4096, "Date", $t)
    
    $mdyyyy = $t[1] & "-" & $t[2] & "-" & $t[0]
    
    $NewDate = _DateAdd('D', -1, $mdyyyy)
 FileMove("c:\report\30 Days Past Due-Bank.pdf", "c:\report\30 Days Past Due-Bank " & $NewDate & ".pdf")

The file should be renamed 30 Days Past Due-Bank 03-10-2008.pdf

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

You know if you arkive your document's like that, they will end upp inn a big mess where its basicly impossible to find the right file without searching for it.

If you use year,mon,day then files will allways lay inn order. I know its not the "american" standard but its alot more simple to browse through.

Edited by jokke

UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt.

Share this post


Link to post
Share on other sites

thanks Jokke. I hear what your saying about the order, but this is for a dept here at work and they have their reasons why they do it this way. :) I believe once they get a few reports ran (runs everyday) they move them to a month folder. I'm just trying to cut some time for them since they tend to have so many reports. I think I'm close to what I want, just cannot figure out why it's not working!

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

@Tigerweld

There are probably better ways of doing this, (on the forum) but here's a workaround

for your required date format.

If you are not using v3.2.10.0

take a look at the new Date and Time

functions added to the Date Management UDF section of the helpfile

#include<Date.au3>
#include <File.au3>
Opt("MustDeclareVars", 1)

Global $szDrive, $szDir, $szFName, $szExt
Local $t, $yyyymd, $mdyyyy, $DateSub, $NewDate, $aDate

Local $file = "c:\report\30 Days Past Due-Bank.pdf"

$t = FileGetTime($file, 1, 0)
If Not IsArray($t) Then
    MsgBox(4096, "FileDateStamp", "Error getting filedate")
    Exit
EndIf

; get new date using standard date method
$yyyymd = $t[0] & "/" & $t[1] & "/" & $t[2]
$DateSub = _DateAdd('D', -1, $yyyymd) ; only works with standard format

; start converting to your format
$aDate = StringSplit($DateSub,"/")
If Not IsArray($aDate) Then
    MsgBox(4096, "FileDateStamp", "Error getting filedate")
    Exit
EndIf

$mdyyyy = " " & $aDate[2] & "-" & $aDate[3] & "-" & $aDate[1]
_PathSplit($file, $szDrive, $szDir, $szFName, $szExt)
$NewDate  = $szDrive & $szDir & $szFName & $mdyyyy & $szExt
FileMove($File, $NewDate)

MsgBox(4096,'FileDateStamp', 'FileDate: ' & @TAB & @TAB & $yyyymd & _
@lf & 'NewDate: ' & @TAB & $DateSub & @lf & 'DateFormat: ' & @TAB & _
$mdyyyy & @LF & "Filename: " & @TAB & $NewDate)
Edited by rover

I see fascists...

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