[jawsscripts] Re: script that adds numbers each time it is executed

  • From: Hamid <aitouznaghamid@xxxxxxxxx>
  • To: jawsscripts@xxxxxxxxxxxxx
  • Date: Wed, 16 Nov 2016 20:53:45 +0000

BOB, I AM SORRY FOR THE DELAYED REPLY;I HAVE BEEN AWAY AT WORK THE WHOLE 
DAY.
I WILL TRY TO FIND A WAY TO DO IT AND WILL COME BACK TO YOU WITH A 
FEEDBACK OR ANY QUESTIONS i MIGHT HAVE.
THANKS VERY MUCH

On 16/11/2016 12:40, Bob wrote:

Hamid

You could store the current year and file number in an ini file.

Your script would load the two values from the file.

Increment the file number.

Combine with the year into a string.

Output the string to your app.

Write the current file number back to the file.

You could add a second script to increment the year number or just edit this 
manually in January.

Bob

On 16 Nov 2016, at 09:52, Hamid <aitouznaghamid@xxxxxxxxx> wrote:

Hello bob,


Thank you very much for your prompt response!

Sorry to cause that confusion for both of you, English is not my first
nor second language...

I will check those functions later but please explain more how to use
them inside of a script. I am not that advanced.

Best regards!


On 16/11/2016 09:43, Bob wrote:
Hamid

Brian read your mail in the same way as I did and thought you were
trying to rename existing files.

If you want to store values long term then have a look at the following
functions:

IniWriteString

IniWriteInteger

IniReadString

IniReadInteger

You can use these to read and write values to a file for accessing later.


Hope this helps


Bob


On 16/11/2016 09:30, Hamid wrote:
Hello Brian,

I am sorry to disappoint you, but no I am not familiar with the windows
power shell at all. I am a bitfamiliar with the jaws scripting  though!
What I understood from this file you sent me is that it presumes having
a bunche of scanned files already in the folder but that is not the case
actually. What I want is something easy that inserts the files name each
time I scan it in the name's edit field with a quick keyb*oard shortcut
instead of manually typing the name in letter by letter. I want it also
that to save me the pain of trying to remember what was the last number
i typed in.*

*Again sorry to disappoint you but I don't even know how to start with
that template you sent me.*

*Thanks so much and hopefully you can provide more clarifications.*


On 16/11/2016 02:38, Brian Vogel wrote:
Hamid,
              Is there anyone (yourself included) who's familiar with 
Windows
Power Shell scripting?  The script that appears below gives the outline of
precisely what you want to do, and I've run it in a test folder on my
machine, but it is very "quick and dirty."  It does no parameter checking
and has no safety elements built in so if you're not careful about being 
in
the folder you want to run it in it has the potential to wreak havoc.  So
much for the disclaimer.

              I would create a file somewhere that contains this script 
text
and name it something like Rename_for_Year.ps1.  You would then copy it to
the folder where the files need to be renamed, use the context menu to 
open
it with notepad to tweak the year in question, save the file, then bring 
up
the context menu with it selected and choose "Run with PowerShell."

---------------------------------------------------------------------------------------
# Use a foreach to loop through all the files in the current directory
# This method allows us to easily track the file name so we can report
# our findings by file if you wish to echo information about what's
happening

#Set the variable for the year you wish to use in the rename
$ryear=2015

#Set first number for renaming file to 1
$i=1

#For each file found in the current directory  (and that will include this
copy of the power shell script)
foreach($curfile in Get-ChildItem ".")
{
       #Rename the current file with a number prefix ($i), followed by the
rename year ($ryear),
       #followed by its original name ($curfile) with hyphens separating 
each
element
       #If you wish to just have file names like 1-2015, 2-2015, etc., 
then
strip the final hyphen and $curfile
       # variable in the rename line below
       Rename-Item $curfile $i-$ryear-$curfile
       $i++
}
----------------------------------------------------------------------------------------

This should give you something to start with.  This can also be
accomplished via a .bat file that would run under Command Prompt rather
than Power Shell, but the syntax is a bit messier (believe it or not)

Brian
__________�

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

__________�

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

__________�

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

__________�

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


__________�

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

Other related posts: