[jawsscripts] Re: script to insert next days date

I can't seem to get this to work. I used it today and it only types
"error:invalid parameter"

Any ideas why? I inserted the code into a script instead of a function.
Might that be the issue? If I leave it as a function, how do I call the
results to a script where I can have the results inserted as text into my
application?

-----Original Message-----
From: jawsscripts-bounce@xxxxxxxxxxxxx
[mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of Martin Slack
Sent: Friday, September 17, 2010 2:29 PM
To: JAWSScripts
Subject: [jawsscripts] Re: script to insert next days date

Hi Jason,

  I notice that the function SysGetDate returns a string containing the
magic word "Error" when an incorrect date is entered.  You can therefore use
a function similar to the one below to do what you want.  It handles leap
years.  You may want to include more safety features, and may well have a
different preferred date format, separation character etc, but you can play
with all that.  I see that the first let finalDate line in the code has 
wrapped.

String Function nextDay (string initialDate)
Var
    int dayNumber,
    int monthNumber,
    int yearNumber,
    string finalDate

let dayNumber = StringToInt (StringSegment (initialDate, "/", 2))
let monthNumber = StringToInt (StringSegment (initialDate, "/", 1))
let yearNumber = StringToInt (StringSegment (initialDate, "/", 3))

let finalDate = SysGetDate ("MM/dd/yyy", monthNumber, dayNumber+1,
yearNumber)
if (StringContains (finalDate, "Error")) then
    let finalDate = SysGetDate ("MM/dd/yyy", monthNumber+1, 1, yearNumber)
    if (StringContains (finalDate, "Error")) then
        let finalDate = SysGetDate ("MM/dd/yyy", 1, 1, yearNumber+1)
    endif
endif

return finalDate
EndFunction


Martin


----- Original Message ----- 
From: "Jason Boston" <jwb3301@xxxxxxx>
To: <jawsscripts@xxxxxxxxxxxxx>
Sent: Friday, September 17, 2010 5:11 AM
Subject: [jawsscripts] Re: script to insert next days date


> Nope, or my task would be much simpler. :)
>
> -----Original Message-----
> From: jawsscripts-bounce@xxxxxxxxxxxxx
> [mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of Martin Slack
> Sent: Thursday, September 16, 2010 1:42 AM
> To: jawsscripts@xxxxxxxxxxxxx
> Subject: [jawsscripts] Re: script to insert next days date
>
> Hi Jason,
>
>  Are you allowed to use VBScript at work?
>
>  Martin
>
>
> ----- Original Message ----- 
> From: "Jason Boston" <jwb3301@xxxxxxx>
> To: <jawsscripts@xxxxxxxxxxxxx>
> Sent: Thursday, September 16, 2010 3:12 AM
> Subject: [jawsscripts] script to insert next days date
>
>
>> HI all,
>> I'm trying to figure out how to write a script that will insert
>> tomorrow's
>> date based on the current system date. I then want to expand the script
>> to
>> paste in the next 2, next 3, and next 4 date from the current date. I
>> update
>> many fields in a database at work, and I would like the ability to hit a
>> key
>> combination that will paste in tomorrows date, or the next day, or the
>> next
>> day after that.
>>
>> Thanks,
>> Jason
>>
>>
>> __________�
>>
>> View the list's information and change your settings at
>> http://www.freelists.org/list/jawsscripts
>>
>
> __________�
>
> View the list's information and change your settings at
> http://www.freelists.org/list/jawsscripts
>
> __________�
>
> View the list's information and change your settings at
> http://www.freelists.org/list/jawsscripts
>

__________�

View the list's information and change your settings at 
http://www.freelists.org/list/jawsscripts

__________�

View the list's information and change your settings at 
http://www.freelists.org/list/jawsscripts

Other related posts: