Sign in to follow this  
Followers 0
WilliamasKumeliukas

FileGetTime problem

41 posts in this topic

#1 ·  Posted (edited)

*UPDATED*

Hi, I need some help with my script that verify my backup sizes and date.

like my codes show below, I want it to get the subfolders name and return it as Arrays then I use the result of the subfolder as the current full path because everyday the subfolder name is changed.

when i'm trying to retrieve the date and time of the specific file inside this subfolder, it return me that subscript error. 

I don't get what I am doing wrong in those lines...

;##################################

; Variables
;##################################
$amaster = _FileListToArray("E:BKPESX1master.attisee.local","*",2,True)
$ap99 = _FileListToArray("E:BKPESX1P99","*",2,True)
$asrv = _FileListToArray("E:BKPESX1SRV","*",2,True)
$ats = _FileListToArray("E:BKPESX1TS","*",2,True)
$time = "   /     Date du backup: "
$dmaster = FileGetTime($amaster & "master.attisee.local-flat.vmdk",0)
$dp99 = FileGetTime($ap99 & "Comptabilite-flat.vmdk",0)
$dsrv = FileGetTime($asrv & "SRV-flat.vmdk",0)
$dts = FileGetTime($ats & "TS-flat.vmdk",0)
$tmaster = $dmaster[0] & "-" & $dmaster[1] & "-" & $dmaster[2] & "  " & $dmaster[3] & "hour " & $dmaster[4] & "min " & $dmaster[5] & "sec"
==> Subscript used on non-accessible variable. :
$tp99 = $dp99[0] & "-" & $dp99[1] & "-" & $dp99[2] & '-' & $dp99[3] & "h " & $dp99[4] & "min " & $dp99[5] & "sec"
$tsrv = $dsrv[0] & "-" &  $dsrv[1] & "-" & $dsrv[2] & '-' & $dsrv[3] & "h " & $dsrv[4] & "min " & $dsrv[5] & "sec"
$tts = $dts[0]& "-" & $dts[1] & "-" & $dts[2]&'-'&$dts[3]& "h " & $dts[4] & "min " & $dts[5] & "sec"

 

if possible it would be great to explain in simplified way, I'm still new to the language.

Regards

Edited by AutomateLover

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

It would also be great to say what actual problem you're having, so others can help you. At the moment, if the Help file can't help, nobody else can either..

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

sorry somdcomputerguy, you been too quick :P, I was still editing my first post because of a mistake. its updated now

Edited by AutomateLover

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

No problem. I'm never too slow or too fast, I was just kinda half fast there.. B) The first problem I can see is that you are passing a variable to FileGetTime that should be an array, since that variable was gotten from FileListToArray. If "master.attisee.local-flat.vmdk" is actually a number, try a line like this (the same for the other incorrect lines) - $dmaster = FileGetTime($amaster[ & "master.attisee.local-flat.vmdk" & ] ,0). I haveven't tested this is any way myself, so this syntax might not be correct, you might have to juggle it around a bit..

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

Hi there,

You can try do _Arraydisplay all arrays. Probably some array maybe isn´t an array after all.

Once i had some problems getting time of the files.

i hope it helps.


Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Share this post


Link to post
Share on other sites

You can try do _Arraydisplay all arrays.

That's a good idea. I'm not 100% on arrays (a whole lot better than with RegEx though..), and I tend to use that function just to see what I have to work with..


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

No problem. I'm never too slow or too fast, I was just kinda half fast there.. B) The first problem I can see is that you are passing a variable to FileGetTime that should be an array, since that variable was gotten from FileListToArray. If "master.attisee.local-flat.vmdk" is actually a number, try a line like this (the same for the other incorrect lines) - $dmaster = FileGetTime($amaster[ & "master.attisee.local-flat.vmdk" & ] ,0). I haveven't tested this is any way myself, so this syntax might not be correct, you might have to juggle it around a bit..

 actually "master.attisee.local-flat.vmdk" is the filename inside the subfolder that I'm searching with FileListToArray so I want it to return the fullpath with the CURRENT name of the subfolder in "E:BKPESX1master.attisee.local"

Example: if I run the script today, it must get this path ("E:BKPESX1master.attisee.localmaster.attisee.local-2014-07-21_22-00-03") into a variable used in FileGetTime($amaster & "master.attisee.local-flat.vmdk")

Tomorow it will be another folder name like this: (E:BKPESX1master.attisee.localmaster.attisee.local-2014-07-22_*time of the file was created*")

 

I need it to go in the folder no matter what is the name of that folder.

( I'll try right now:  $dmaster = FileGetTime($amaster[ & "master.attisee.local-flat.vmdk" & ] ,0) )

Thanks for replies and help

Share this post


Link to post
Share on other sites

$dmaster = FileGetTime($amaster[ & "master.attisee.local-flat.vmdk" & ] ,0) = Syntax error :(

Share this post


Link to post
Share on other sites

$dmaster = FileGetTime($amaster[ & "master.attisee.local-flat.vmdk" & ] ,0) = Syntax error  :(

Try like this :

$dmaster = FileGetTime($amaster & "\master.attisee.local-flat.vmdk",0)

Cheers


Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Share this post


Link to post
Share on other sites

$tmaster = $dmaster[0] & "-" & $dmaster[1] & "-" & $dmaster[2] & "  " & $dmaster[3] & "hour " & $dmaster[4] & "min " & $dmaster[5] & "sec"

==> Subscript used on non-accessible variable.:

Share this post


Link to post
Share on other sites

I believe that  $dmaster is not an array, better yet, it is a empty array.

Try to use _Arraydisplay ($dmaster, "test") before.

Don't forget to include array.au3 in the beginning of your script.

Cheers


Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Share this post


Link to post
Share on other sites

here is a screenshot of what it looks like in scite...

184651bug.png

Share this post


Link to post
Share on other sites

Use this line before calling $tmaster.

_Arraydisplay ($dmaster, "test")

Cheers


Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

still subscript used on non-accessible variable.. :( I also noticed that it does this error to:

$tmaster

$tp99

$tsrv

$tts

Edited by AutomateLover

Share this post


Link to post
Share on other sites

Ok... but what the _Arraydisplay says?

can you see all the array subscriptions?


Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

no, it popup Autoit Error msgbox with error description as: Subscript used on non-accessible variable.:

866607bug2.png

Edited by AutomateLover

Share this post


Link to post
Share on other sites

Is that file path included as a variable?

Care to share the script?

Cheers


Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Share this post


Link to post
Share on other sites

Is that file path included as a variable?

Care to share the script?

Cheers

 

 actually "master.attisee.local-flat.vmdk" is the filename inside the subfolder that I'm searching with FileListToArray so I want it to return the fullpath with the CURRENT name of the subfolder in "E:BKPESX1master.attisee.local"

Example: if I run the script today, it must get this path ("E:BKPESX1master.attisee.localmaster.attisee.local-2014-07-21_22-00-03") into a variable used in FileGetTime($amaster & "master.attisee.local-flat.vmdk")

Tomorow it will be another folder name like this: (E:BKPESX1master.attisee.localmaster.attisee.local-2014-07-22_*time of the file was created*")

 

Like I said, FileListToArray is suposed to retrieve the subfolder name and return it as a variable thats I'm using into FileGetTime($variable & "FullFileName")

 

Share this post


Link to post
Share on other sites

( I'll try right now:  $dmaster = FileGetTime($amaster[ & "master.attisee.local-flat.vmdk" & ] ,0) )

 

That won't work, and obviously it already hasn't, because $amaster and the other variables you define with the _FileListToArray function are arrays.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

#20 ·  Posted (edited)

That won't work, and obviously it already hasn't, because $amaster and the other variables you define with the _FileListToArray function are arrays.

 

Ok thanks ill suspend this until I can get this FileGetTime working without errors

Here is the script code for test purposes:

test it with your own target file.

#Include <file.au3>
#include <date.au3>
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>


;##################################
; Variables
;##################################
$amaster = "E:\BKP\ESX1\master.attisee.local"
$dmaster = FileGetTime($amaster & "\master.attisee.local-flat.vmdk",0)
$tmaster = $dmaster[0] & "-" & $dmaster[1] & "-" & $dmaster[2] & "  " & $dmaster[3] & "hour " & $dmaster[4] & "min " & $dmaster[5] & "sec"
$master = FileGetSize($amaster & "\master.attisee.local-flat.vmdk")


MsgBox(0,"test",$master & $tmaster)
Edited by AutomateLover

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