AutoHotkey Community

It is currently May 25th, 2012, 10:45 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 31 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Saving userinput
PostPosted: July 8th, 2007, 4:19 pm 
Offline

Joined: May 31st, 2007, 4:57 am
Posts: 44
Hello everyone,
Im currently working on a program, AcroLiminator, one of the requests, is an ability to add your own acronyms. I was wondering how this would be done, and also how I could add the option to delete the default acroynms? Thank you for any help you may provide.
Walt

P.S : If you want it I will post my code, but it is over 1000 lines long, so I figured I would wait til' someone requested it. Thanks again.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 8th, 2007, 6:12 pm 
Offline

Joined: January 27th, 2007, 8:24 pm
Posts: 30
Location: Canada
How are the existing acronyms stored ?

Id guess a good way is in an outboard file, like a .csv or otherwise delimited file. Perhaps line by line..
ACRONYM,meaning.
ACRONYM2, meaning2.
etc

That way you could easily retrieve the matching set, edit either value, sort etc etc. (in this ex the comma seperates the AC from the meaning, and the period seperates the sets)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 9th, 2007, 12:08 am 
Offline

Joined: May 31st, 2007, 4:57 am
Posts: 44
Thank you for the response :) The currently acronyms are encoded in the program, heres an example of my code.

::btw::
expanded = by the way
MsgBox 4, AcroLiminator 0.1 Beta, Convert btw to %expanded% ?
ifMsgBox, yes
Send, %expanded%
else
Send, btw
return

I was thinking bout the possiblity of storing the acronyms in an .ini file or something along those lines, but I wouldn't know how to go about that. Thanks again for the response. :)


Last edited by Waltman15 on July 9th, 2007, 2:07 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 9th, 2007, 1:22 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7501
Location: Australia
Waltman15 wrote:
I was thinking bout the possiblity of storing the acronyms in an .ini file or something along those lines, but I would know how to go about that.
Take a look at these two scripts:
Advanced variables / hostrings loaded from an .ini file (the more up-to-date version is further down the page.)
RegEx Powered Dynamic Hotstrings


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 9th, 2007, 2:10 am 
Offline

Joined: May 31st, 2007, 4:57 am
Posts: 44
Thank you :) Im not sure how to go about getting this to do what I want, so Im gonna read it and see how to do what I want. Thanks. :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 9th, 2007, 6:16 am 
Here is a simple solution, using an ini-file

Code:
loop
{
   Input, UserInput, V, {enter}.{tab}{Space}
   IfInString, ErrorLevel, EndKey:
   {
         IniRead, OutputVar, abrev.ini, abreviation, %UserInput%
      if OutputVar != ERROR
      {
         StringSplit, EL_array, ErrorLevel, :
         loopcount := StrLen(UserInput)
         loop, %loopcount%
         {
            Send {BS}
         }
         Send {BS}%OutputVar%{%EL_array2%}        
      }
   }
}


The corresponding ini-File should be named "abrev.ini" and look like this
Code:
[abreviation]
abc=alpha beta gamma
rtfm=read the **** manual
[quote][/quote]


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 9th, 2007, 6:27 am 
Offline

Joined: May 31st, 2007, 4:57 am
Posts: 44
Heres my code..
Code:
::btw::
expanded = by the way
MsgBox 4, AcroLiminator 0.1 Beta, Convert btw to %expanded% ?
ifMsgBox, yes
  Send, %expanded%
else
  Send, btw
return 


How would I go about having the message show verifying the user wants to convert the acronym to the word? At this time, the words inside the .ini that do not exist in the code, simply change without the verifcation. While as, my words existing in the code and the list, ask the message. Sorry for all the trouble.
Walt


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 9th, 2007, 2:15 pm 
Offline

Joined: May 31st, 2007, 4:57 am
Posts: 44
any help?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 9th, 2007, 6:35 pm 
I don´t really understand, what you you mean,
do you want this?

Code:
loop
{
   Input, UserInput, V, {enter}.{tab}{Space}
   IfInString, ErrorLevel, EndKey:
   {
      IniRead, OutputVar, abrev.ini, abreviation, %UserInput%
      if OutputVar != ERROR
      {
         MsgBox 4, AcroLiminator 0.1 Beta, Convert %Userinput% to %OutputVar% ?
         fMsgBox, yes
         {
            StringSplit, EL_array, ErrorLevel, :
            loopcount := StrLen(UserInput)
            loop, %loopcount%
            {
               Send {BS}
            }
            Send {BS}%OutputVar%{%EL_array2%}   
         }   
      }
   }
}


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 9th, 2007, 7:25 pm 
Offline

Joined: May 31st, 2007, 4:57 am
Posts: 44
Thank you Z Gecko, I think that is what I want, but the following line of code brings upon an error.

Code:
Input, UserInput, V, {enter}.{tab}{Space}


Once again, sorry for all the trouble.
Walt :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 10th, 2007, 4:56 am 
Offline

Joined: May 31st, 2007, 4:57 am
Posts: 44
Please? Help anyone?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 10th, 2007, 5:42 am 
Offline

Joined: May 24th, 2007, 3:45 am
Posts: 1121
What error?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 10th, 2007, 6:33 am 
Offline

Joined: May 31st, 2007, 4:57 am
Posts: 44
Im sorry, I forgot to post that, I get the error "This line does not contain a recognized action"


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 10th, 2007, 6:41 am 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8647
Location: Salem, MA
you have to post the whole error message. hit Ctrl C in the window with the error message, and you can paste it here in the forum. put it inside quote tags:

[quote]
;paste here
[/quote]

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 10th, 2007, 6:43 am 
Offline

Joined: May 31st, 2007, 4:57 am
Posts: 44
Sorry Engunneer, new to all of this, thanks for the help.

So its,
Quote:
---------------------------
AcroLiminator.ahk
---------------------------
Error at line 20.

Line Text:   Input, UserInput, V, {enter}.{tab}{Space}
Error: This line does not contain a recognized action.

The program will exit.
---------------------------
OK
---------------------------


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 31 posts ]  Go to page 1, 2, 3  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: [VxE], just me, Wicked, Yahoo [Bot] and 70 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group