Sign in to follow this  
Followers 0
AutoPepe

Document code : sequential number-year

13 posts in this topic

Document code : number-year

I need an independant script for asigning codes to the document I make.

When I have the cursor over a text field, a word processor like word, notepad, wordpad, field notes on many programs, a database text field, etc , I might be able to invoke the script and write the code in that document. Just where the cursor is.

The code is formed by a sequantial number and the year : 000125-2008

Next time I invoke the script will be 000126-2008

Do you know an autoIt script doing this ?

Thanks

Excuse my language. I'm from Canary Islands


Traducción AutoIt al Español. http://autoitespa.espanaforo.com/forum.htm . Visita el foro de AutoIt en español http://www.emesn.com/autoitforum/. I am a simple user, not a programmer.

Share this post


Link to post
Share on other sites



Document code : number-year

I need an independant script for asigning codes to the document I make.

When I have the cursor over a text field, a word processor like word, notepad, wordpad, field notes on many programs, a database text field, etc , I might be able to invoke the script and write the code in that document. Just where the cursor is.

The code is formed by a sequantial number and the year : 000125-2008

Next time I invoke the script will be 000126-2008

Do you know an autoIt script doing this ?

Thanks

Excuse my language. I'm from Canary Islands

Maybe you could assign a HotKeySet(), and send the code with Send().

Also check the macros page.

Tal vez usted podría asignar un atajo vía HotKeySet(), y enviar el código con Send().

También revise la página de macros.

Share this post


Link to post
Share on other sites

I'm translating the manual.

I would like a similar script

Nobody have the same need in the past ?

Posted Image


Traducción AutoIt al Español. http://autoitespa.espanaforo.com/forum.htm . Visita el foro de AutoIt en español http://www.emesn.com/autoitforum/. I am a simple user, not a programmer.

Share this post


Link to post
Share on other sites

I'm translating the manual.

I would like a similar script

Nobody have the same need in the past ?

Posted Image

Did you tried the suggestion?

Intentó la sugerencia?

Share this post


Link to post
Share on other sites

No. I will not try your suggestion unless my need is an original need, and anyone has made before.

It's simple why. Perhaps exist a similar script.

I repeat my question for reading people.

Do you know an autoIt script doing this ? Do you know a MADE script doing this ?

Thanks

Excuse my language. I'm from Canary Islands

P.D. : A lover of original scripts. A beginner and ignorant.


Traducción AutoIt al Español. http://autoitespa.espanaforo.com/forum.htm . Visita el foro de AutoIt en español http://www.emesn.com/autoitforum/. I am a simple user, not a programmer.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

No. I will not try your suggestion unless my need is an original need, and anyone has made before.

It's simple why. Perhaps exist a similar script.

I repeat my question for reading people.

Do you know an autoIt script doing this ? Do you know a MADE script doing this ?

Thanks

Excuse my language. I'm from Canary Islands

P.D. : A lover of original scripts. A beginner and ignorant.

When you are a beginner than begin at the beginning .... start building it and stop posting about it because else you slowly become irritating.

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

When you are a beginner than begin at the beginning .... start building it and stop posting about it because else you slowly become irritating.

Jos

Perhaps I don't explain in English. I try in spanish :

Cuando uno pregunta por un script ya hecho no parece apropiado responder con un script por hacer.

He solicitado un subforo de peticiones de scripts hechos.

La tolerancia y la no irritación (irritating) es de buenos compañeros.

Así que no te enfades que seguiré con mi pregunta en la forma en que quiera hacerla. Y si te irritas allá tú.

Seguimos que la conseguimos.


Traducción AutoIt al Español. http://autoitespa.espanaforo.com/forum.htm . Visita el foro de AutoIt en español http://www.emesn.com/autoitforum/. I am a simple user, not a programmer.

Share this post


Link to post
Share on other sites

Perhaps I don't explain in English. I try in spanish :

Cuando uno pregunta por un script ya hecho no parece apropiado responder con un script por hacer.

He solicitado un subforo de peticiones de scripts hechos.

La tolerancia y la no irritación (irritating) es de buenos compañeros.

Así que no te enfades que seguiré con mi pregunta en la forma en que quiera hacerla. Y si te irritas allá tú.

Seguimos que la conseguimos.

Well, it's possible that nobody wrote the same script in the past, like you want. But make sure about that, using the SEARCH link.

Bien, es posible que nadie escribió el mismo script en el pasado, como usted desea. Asegúrese de eso, usando el enlace de SEARCH.

Share this post


Link to post
Share on other sites

Well, it's possible that nobody wrote the same script in the past, like you want. But make sure about that, using the SEARCH link.

Bien, es posible que nadie escribió el mismo script en el pasado, como usted desea. Asegúrese de eso, usando el enlace de SEARCH.

I tried.

No result.

While we are discussing I get two answers in other forums.

And two post were closed in this forum for asking for a script request subforum.

I'm not angry. I will continue asking on my way and accepting no answers at all in this forum.

AutoIt is a great language, but depend on the size of the users of the program. It's not the same.

Someday will be the same, I hope.

Thanks

Excuse my language. I'm from Canary Islands


Traducción AutoIt al Español. http://autoitespa.espanaforo.com/forum.htm . Visita el foro de AutoIt en español http://www.emesn.com/autoitforum/. I am a simple user, not a programmer.

Share this post


Link to post
Share on other sites

It's simple why. Perhaps exist a similar script.

...But make sure about that, using the SEARCH link.

I tried.

No result.

:)

I will continue asking on my way and accepting no answers at all in this forum.

Ok, I hope someone gives you a similar script. :)

Share this post


Link to post
Share on other sites

Hey AutoPepe,

I think you will find the people on this forum will be more helpful if you show some effort from your side,

post some code you have for example, just asking for code often won't work, even with a simple script like this.

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Try this example.

Press keys:-

Ctrl + Alt + w to write number and year.

Ctrl + Alt + c to change number .

Esc To exit.

;#NoTrayIcon
HotKeySet("!^w", "_NumberYear") ; Ctrl + Alt + w  to write number and year.
HotKeySet("!^c", "_ModifyNumber"); Ctrl + Alt + c  to change number .
HotKeySet("{ESC}", "Terminate") ; Esc To exit

Global $file, $str, $aMPos, $hWnd, $IDCrtl, $iNum, $aRet, $sClassName, $tStrBuff

If Not FileExists(@ScriptDir & "\NumYear.ini") Then IniWrite(@ScriptDir & "\NumYear.ini", "Number", "num", "1")
$iNum = IniRead(@ScriptDir & "\NumYear.ini", "Number", "num", "NotFound")

While 1
    Sleep(100)
WEnd
#cs
Func _NumberYear()
    Local $nCount = 0
    Local $inst
    $aMPos = MouseGetPos()
    $hWnd = DllCall("user32.dll", "hwnd", "WindowFromPoint", "uint", $aMPos[0], "uint", $aMPos[1])
    $tStrBuff = DllStructCreate("char[100]")
    $aRet = DllCall("user32.dll", "int", "GetClassName", "hwnd", $hWnd[0], "ptr", DllStructGetPtr($tStrBuff), "int", 100)
    $sClassName = DllStructGetData($tStrBuff, 1)
    Local $sClassList = WinGetClassList(WinGetTitle(''))
    Local $aSplitClass = StringSplit(StringTrimRight($sClassList, 1), @LF)
    For $iCount = $aSplitClass[0] To 1 Step -1
        If $aSplitClass[$iCount] = $sClassName Then
            $nCount += 1
            If ControlGetHandle(WinGetTitle(''), '', $aSplitClass[$iCount] & $nCount) = $hWnd[0] Then $inst = $nCount
        EndIf
    Next
    $str = StringFormat(" %06s-%4s ", $iNum, String(@YEAR))
    WinWait(WinGetTitle(''))
    ControlSend(WinGetTitle(''), "", $sClassName & $inst, $str)
    $iNum = String($iNum + 1)
    GUICtrlSetData($file, $iNum)
    $str = ""
    Return
EndFunc   ;==>_NumberYear
#ce

Func _NumberYear()  
    $str = StringFormat(" %06s-%4s ", $iNum, String(@YEAR))
    WinWait(WinGetTitle(''))
    ControlSend(WinGetTitle(''), "", ControlGetFocus (WinGetTitle('')), $str)
    $iNum = String($iNum + 1)
    GUICtrlSetData($file, $iNum)
    $str = ""
    Return
EndFunc   ;==>_NumberYear

Func Terminate()
    IniWrite(@ScriptDir & "\NumYear.ini", "Number", "num", $iNum)
    Exit 0
EndFunc   ;==>Terminate

Func _ModifyNumber()
    Local $file, $btn, $btn2, $msg
    Local $hGUI = GUICreate("Number-Year", 150, 120, -1, -1, -1, 0x00000018)
    GUICtrlCreateLabel("Next Number to Write", 25, 10, 120, 20)
    $file = GUICtrlCreateInput($iNum, 25, 35, 100, 20)
    $btn = GUICtrlCreateButton("Ok", 7, 75, 60, 40, BitOR(0x0300, 0x0C00))
    $btn2 = GUICtrlCreateButton("Cancel ", 82, 75, 60, 40, BitOR(0x0300, 0x0C00, 0x2000))
    GUISetState()

    $msg = 0
    While $msg <> -3
        $msg = GUIGetMsg()
        Select
            Case $msg = -3 Or $msg = $btn2
                GUIDelete($hGUI)
            Case $msg = $btn
                $iNum = GUICtrlRead($file)
                IniWrite(@ScriptDir & "\NumYear.ini", "Number", "num", $iNum)
                GUIDelete($hGUI)
        EndSelect
    WEnd
    Return
EndFunc   ;==>_ModifyNumber

Edit: Just found an easier way to use ControlSend() to the active control window.

Edited by Malkey

Share this post


Link to post
Share on other sites

Thank Malkey.

I'll try and comment

Posted Image

Posted Image

By Esgrimidor


Traducción AutoIt al Español. http://autoitespa.espanaforo.com/forum.htm . Visita el foro de AutoIt en español http://www.emesn.com/autoitforum/. I am a simple user, not a programmer.

Share this post


Link to post
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
Sign in to follow this  
Followers 0