Jump to content

Convert Highlighted Text To Upper Case


 Share

Recommended Posts

Filling in forms can be a pain - we have some that need to be all uppercase. I was looking to try and write a script that would help.

I would highlight a line of text (This could be in a form or in a text document)

I then want to hit a Hotkey (F?)

The script would then look at the charactors highlighted and change any lowercase charactors to uppercase.

I could do this several times on a form then save.

Any ideas.

Does AutoIt3 have a function that would read highlighted text ?

Is there a workaround ?

Thanks again for any help.

Link to comment
Share on other sites

ok, here is some things that may help. lets say here in this posting that you could highligh and replace something ok. well to high light it you have to drag your cursor across the words. then if you used either of the following key combinations listing in no order.

Select all = Ctrl + a

Cut Highlighted = Ctrl + x

Copy Highlighted = Ctrl + c

Paste From clipboard = Ctrl + v

now after knowing the above you can do basicly what you are talking about.

once, copied or cut it is on the clipboard. which you can take into a script as a varible or string. have the script captiolize the letters then send it back to when you had either cut or copied it from. good luck.

Link to comment
Share on other sites

If you're working with MS Word you could use SHIFT+F3 to change a (marked), mixed upper/lower case string to plain upper/lower case.

If the Windows Scripting Host (WHS) is installed with your OS, you could use Visual Basic Script as well. There's a function which provides what you've requested (start the vbs file via A3's Run command)

Link to comment
Share on other sites

I just sent {CTRLDOWN}c{CTRLUP} to copy into clipboard and made changes to the text there and then pasted it back on itself. It works really well - I have been able to standardise databse entries and excel spreadsheet entries just by selecting the text and hitting F2. I can't believe how quick this Aut3 language is. I have highlighted large areas of excel spreadsheets - hit my F2 button and instantaneously all the changes have been made.

What a great thing this Aut3 thing is....

Link to comment
Share on other sites

Yea, they are quite simple to do. It is fun to make your own macro time savers.

Quick hotkey example.

HotKeySet("^!c", "Uppercase");Press ctrl+alt+c to change case.
WinWaitActive("Random Name is","Never going to happen")
Func Uppercase()
send("^c")
clipput(StringUpper (clipget()))
send("^v")  
EndFunc

AutoIt3, the MACGYVER Pocket Knife for computers.

Link to comment
Share on other sites

Yea, they are quite simple to do. It is fun to make your own macro time savers.

Quick hotkey example.

HotKeySet("^!c", "Uppercase");Press ctrl+alt+c to change case.
WinWaitActive("Random Name is","Never going to happen")
Func Uppercase()
send("^c")
clipput(StringUpper (clipget()))
send("^v")  
EndFunc
I prefer the Sleep(0) instead of WinWaitActive

:whistle:

Link to comment
Share on other sites

sleep(0) just doesn't make much sence to me, it works, but always sounded like a bug.

Sleep for zero miliseconds. hmm

I like sleep(-1)

Maximum sleep time is 2147483647 milliseconds (24 days).

If you use a value less than 1, the script will pause indefinitely (useful with HotKeySet).

AutoIt3, the MACGYVER Pocket Knife for computers.

Link to comment
Share on other sites

  • Developers

sleep(0) just doesn't make much sence to me, it works, but always sounded like a bug.

Sleep for zero miliseconds. hmm

I like sleep(-1)

Sleep(0) sounds to me like "don't really STOP"

Sleep(-1) sounds like traveling back in time.... ( that would be neat :whistle: )

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...