Jump to content

$t[5] + 1 = x not 0x


blitzkrg
 Share

Recommended Posts

I'm at work so i'm writing this from memory

but i'm wondering if anyone can help me out.

I'm write a small script to rename some pictures for me.

due to various issues, the way i'm doing it is to read the date and time of the picture

for some reason the option of "1" to read it into a string does not work.

so i went with the default "0" and i get it as an array

$t[0] = yyyy

$t[1] = mm

etc etc etc.

so $t[5] = xx seconds

in my script i have

$var1 = $t[5] + 1

If the seconds are say 07 $var1 should = 08

and it does

but it just = 8 not 08

does that make sense?

i've tried $var1=$t[5] + 01

but it still = 8 and not 08 (or whatever the time is)

any way i can make it have that 0 (unless of course it's a 10 - i.e. $t[5] + 1 (where $t[5] is say 10 seconds $t[5] + 1 would = 11 seconds which is fine

it's under 10 seconds that is the problem.

hope that makes sense.

thanks

Link to comment
Share on other sites

  • Developers

This behaviour is correct because the string is converted to a value and 1 is added.

Just use:

$var1 = $t + 1

$var1 = Stringright("0" & $Var1,2)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

This behaviour is correct because the string is converted to a value and 1 is added.

Just use:

$var1 = $t + 1

$var1 = Stringright("0" & $Var1,2)

i figured it'd be something easy..

not much brain power left after my vacation

B)

thanks

p.s. any idea why the filegettime(blah.jpg,1,1) doesnt work

format [optional] to specify type of return

0 = return an array (default)

1 = return a string YYYYMMDDHHMMSS

i tried the "1" but could never get it to return as a string.

always would set @error to 1 and not work

but if use 0, as an array. it works fine.

bug maybe?

Link to comment
Share on other sites

  • Developers

p.s. any idea why the filegettime(blah.jpg,1,1) doesnt work

FileGetTime("Filename",0,1) does return a string as you want....

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...