Jump to content

Recommended Posts

Posted (edited)

Good day,

First off, I am hoping that I am asking the question correctly?

I have been attempting - rather unsuccessfully I am afraid, to implement form buttons instead of MsgBox buttons.

The OnOK() function reads the data within an .ini - with content being provided along with the sample script.

Within the OnOK() function is a MsgBox. I want to replace this MsgBox with the _Main GUI buttons.

Here is the sample script:

Spoiler
; -----------------------------------------------
#RequireAdmin
; -----------------------------------------------
#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>
; -----------------------------------------------
Opt("GUIOnEventMode", 1)
Opt("MustDeclareVars", 1)
; -----------------------------------------------
Global $idFormLabel1, $idFormLabel2, $ArrayValue
Global $iWidth = 735, $iHeight = 48, $ixpos = -1, $iypos = -1, $iOpt = 1, $sFontName = "Corbel Bold", $iFontSize = 14, $iFontWt = 800
; -----------------------------------------------
_Main()
; -----------------------------------------------
Func _Main()
    GUICreate(" ", 130, 20, 730, 120)
    GUISetFont($iFontSize, $iFontWt, $GUI_FONTNORMAL, $sFontName)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_CloseForm")
    ; ---------------------
    $idFormLabel1 = GUICtrlCreateButton("OK", 0, 0, 60, 20)
    GUICtrlSetOnEvent($idFormLabel1, "_ColRow")
    ; ---------------------
    $idFormLabel2 = GUICtrlCreateButton("Cancel", 70, 0, 60, 20)
    GUICtrlSetOnEvent($idFormLabel2, "_CloseForm")
    ; -----------------------------------------------
    GUISetState()
    ; -----------------------------------------------
    While 1
        Sleep(1000)
    WEnd
EndFunc   ;==>_Main
; -----------------------------------------------
Func _ColRow()
    Switch @GUI_CtrlId
        Case $idFormLabel1
            OnOK()
    EndSwitch
EndFunc   ;==>_ColRow
; -----------------------------------------------
Func OnOK()
    Local $sFilePath = "E:\Desktop\Working\Tests\ReadIni\SceneData.ini"
    Local $aArray = IniReadSection($sFilePath, "Scene Data")
    If Not @error Then
        For $i = 1 To $aArray[0][0]
            ; ⚠ Implement the _Main GUI buttons here - instead of employing MsbBox?!? ⚠ 
            If MsgBox($MB_OKCANCEL, "", $aArray[$i][1] & "...will be copied to the Clipboard....continue...") = $IDCANCEL Then ExitLoop
            $ArrayValue = $aArray[$i][1]
            ClipPut($ArrayValue)
        Next
    EndIf
EndFunc   ;==>OnOK
; -----------------------------------------------
Func _CloseForm()
    If @GUI_CtrlId = $idFormLabel2 Then
    Else
    EndIf
    Exit
EndFunc   ;==>_CloseForm
; -----------------------------------------------

 

Here is the .ini file data:

Spoiler

[Scene Data]
Line1=Start
Line2=Fade-In
Line3=Emcee
Line4=NStrung Guitar
Line5=SStrung Guitar
Line6=Electric Guitar
Line7=Backing Track
Line8=Fade-Out 1000
Line9=Fade-Out 1500
Line10=Fade-Out 3000
Line11=Finish
Line12=====Presets====
Line13=Preset 001
Line14=Preset 002
Line15=Preset 003
Line16=Preset 004
Line17=Preset 005
Line18=Preset 006
Line19=Preset 007
Line20=Preset 008
Line21=Preset 009
Line21=Preset 010

As always...any assistance in this matter would be greatly appreciated!

Thank you all for your time!

Edited by mr-es335
Updates to initial script!
Posted

Okay,

So I do have this:

Func OnOK()
    Local $sFilePath = "E:\Desktop\Working\Tests\ReadIni\SceneData.ini"
    Local $aArray = IniReadSection($sFilePath, "Scene Data")
    If Not @error Then
        For $i = 1 To $aArray[0][0]
;~          If MsgBox($MB_OKCANCEL, "", $aArray[$i][1] & "...will be copied to the Clipboard....continue...") = $IDCANCEL Then ExitLoop
            If $idForm1Label1 = 3 Then
                $ArrayValue = $aArray[$i][1]
                ClipPut($ArrayValue)
            EndIf
        Next
    EndIf
EndFunc   ;==>OnOK

Just not working as of yet?!?

Posted

Is this what you want to have ? 

(p.s. i have removed the OnEventMode functionality as i currently (its almost 3am) do not want to figure out how to assign all these buttons with the on event mode)

#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>
; -----------------------------------------------


; -----------------------------------------------
Global $idFormLabel1, $idFormLabel2, $ArrayValue
Global $iWidth = 735, $iHeight = 48, $ixpos = -1, $iypos = -1, $iOpt = 1, $sFontName = "Corbel Bold", $iFontSize = 14, $iFontWt = 800
Global $btn[100][2]
; -----------------------------------------------
_Main()
; -----------------------------------------------
Func _Main()
    Local $nmsg
    $form1=GUICreate(" ", 640, 420, -1, -1)
    GUISetFont($iFontSize, $iFontWt, $GUI_FONTNORMAL, $sFontName)

    OnOK()
    ; -----------------------------------------------
    GUISetState()
    ; -----------------------------------------------
    While 1
        $nmsg = GUIGetMsg()
        Switch $nmsg
            Case $GUI_EVENT_CLOSE
                GUIDelete($Form1)
                Exit
            Case Else
                If $nmsg > 0 Then
                    For $i = 0 To 99
                        if $nmsg=$btn[$i][0] Then
                            ClipPut($btn[$i][1])
                        EndIf
                    Next
                EndIf
        EndSwitch
    WEnd
EndFunc   ;==>_Main
; -----------------------------------------------

; -----------------------------------------------
Func OnOK()
    local $btnw=140, $btncolumns=4
    Local $x = 0, $y = 0, $z = 0
    Local $sFilePath = "r:\SceneData.ini"
    Local $aArray = IniReadSection($sFilePath, "Scene Data")
    If Not @error Then
        For $i = 1 To $aArray[0][0]
            ; ⚠ Implement the _Main GUI buttons here?!? ⚠
            $ArrayValue = $aArray[$i][1]
            $btn[$z][0] = GUICtrlCreateButton($ArrayValue, 5 + ($x * $btnw), 5 + ($y * 30), $btnw-1, 25)
            $btn[$z][1] = $ArrayValue
            GUICtrlSetTip (-1,$ArrayValue)
            $x = $x + 1
            $z = $z + 1
            If $x = $btncolumns Then
                $x = 0
                $y = $y + 1
            EndIf

            ;ClipPut($ArrayValue)
        Next
    EndIf
EndFunc   ;==>OnOK


 

Some of my script sourcecode

Posted (edited)

Dan_555,

You stated, "Is this what you want to have ?"

...and my neophy-tish response is..."Not sure!" The example provided is sadly, 1) "Way above my pay grade", and 2) appears to be way outside of my current OnEvent scheme.

I do hope that my responses make sense?

 

Edited by mr-es335
Posted

Another attempt:

Spoiler
#include "ExtMsgBox.au3"
#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>

Global $iWidth = 735, $iHeight = 48, $ixpos = -1, $iypos = -1, $iOpt = 1, $sFontName = "Corbel Bold", $iFontSize = 16, $iFontWt = 800
Global $aArray, $i

Gui()

Func Gui()
    Local $iFontSize = 14
    $hTest_GUI = GUICreate("ExitMe", 155, 40, 725, 86)
    GUISetFont($iFontSize, $iFontWt, $GUI_FONTNORMAL, $sFontName)
    $hButton1 = GUICtrlCreateButton("ReadIni", 10, 10, 65, 20)
    $hButton2 = GUICtrlCreateButton("Exit", 85, 10, 65, 20)
    GUISetState(@SW_SHOW, $hTest_GUI)
    While 1
        Switch GUIGetMsg()
            Case $hButton1
                $nTest = _ExtMsgBox(32, "~Continue|Cancel", "ReadIniData", "...will be copied to the Clipboard....continue...", 0, $hTest_GUI, 0, False)
;~              ConsoleWrite("$nTest: " & $nTest & @CRLF)
                If $nTest = 1 Then
                    Local $sFilePath = "E:\Desktop\Working\Tests\ReadIni\SceneData.ini"
                    Local $aArray = IniReadSection($sFilePath, "Scene Data")
;~                  If Not @error Then
                        For $i = 1 To $aArray[0][0]
                            ; This line is to be replaced!!!
;~                          If MsgBox($MB_OKCANCEL, "", $aArray[$i][1] & "...will be copied to the Clipboard....continue...") = $IDCANCEL Then ExitLoop
                            ClipPut($aArray[$i][1])
                        Next
;~                  EndIf
                    If $nTest = 2 Then
                        Gui()
                    EndIf
                EndIf
                Case $GUI_EVENT_CLOSE, $hButton2
                Exit
        EndSwitch
    WEnd
EndFunc   ;==>Gui

 

 

Posted

...and another...

Spoiler
; -----------------------------------------------
#RequireAdmin
; -----------------------------------------------
#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>
; -----------------------------------------------
Opt("GUIOnEventMode", 1)
Opt("MustDeclareVars", 1)
; -----------------------------------------------
Global $idFormLabel1, $idFormLabel2, $ArrayValue, $iReturnValue
Global $iWidth = 735, $iHeight = 48, $ixpos = -1, $iypos = -1, $iOpt = 1, $sFontName = "Corbel Bold", $iFontSize = 14, $iFontWt = 800
; -----------------------------------------------
_Main()
; -----------------------------------------------
Func _Main()
    GUICreate(" ", 130, 20, 730, 120)
    GUISetFont($iFontSize, $iFontWt, $GUI_FONTNORMAL, $sFontName)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_CloseForm")
    ; ---------------------
    $idFormLabel1 = GUICtrlCreateButton("OK", 0, 0, 60, 20)
    GUICtrlSetOnEvent($idFormLabel1, "_ColRow")
    ; ---------------------
    $idFormLabel2 = GUICtrlCreateButton("Cancel", 70, 0, 60, 20)
    GUICtrlSetOnEvent($idFormLabel2, "_ColRow")
    ; -----------------------------------------------
    GUISetState()
    ; -----------------------------------------------
    While 1
        Sleep(1000)
    WEnd
EndFunc   ;==>_Main
; -----------------------------------------------
Func _ColRow()
    Switch @GUI_CtrlId
        Case $idFormLabel1
;~          MsgBox($MB_OK, "", "$idFormLabel1", 1)
            OnOK()
        Case $idFormLabel2
;~          MsgBox($MB_OK, "", "$idFormLabel2", 1)
            Exit
    EndSwitch
EndFunc   ;==>_ColRow
; -----------------------------------------------
Func OnOK()
    Local $sFilePath = "E:\Desktop\Working\Tests\ReadIni\SceneData.ini"
    Local $aArray = IniReadSection($sFilePath, "Scene Data")
    If Not @error Then
        For $i = 1 To $aArray[0][0]
            $iReturnValue = MsgBox($MB_OKCANCEL, "", $aArray[$i][1] & "...will be copied to the Clipboard....continue...")
            If $iReturnValue = $IDOK Then
                $ArrayValue = $aArray[$i][1]
                ClipPut($ArrayValue)
            EndIf
            If $iReturnValue = $IDCANCEL Then
                ExitLoop
            EndIf
        Next
    EndIf
EndFunc   ;==>OnOK
; -----------------------------------------------
Func _CloseForm()
    Switch @GUI_WinHandle
        Case $idFormLabel2
            Exit
    EndSwitch
EndFunc   ;==>_CloseForm
; -----------------------------------------------

 

...trying to understand the MsgBox return values...

Posted (edited)

...and another...implementing _ExtMsgBox...

Spoiler
; -----------------------------------------------
#RequireAdmin
; -----------------------------------------------
#include <Constants.au3>
#include "ExtMsgBox.au3"
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>
; -----------------------------------------------
Opt("GUIOnEventMode", 1)
Opt("MustDeclareVars", 1)
; -----------------------------------------------
Global $idFormLabel1, $idFormLabel2, $ArrayValue, $iReturnValue
Global $iWidth = 735, $iHeight = 48, $ixpos = -1, $iypos = -1, $iOpt = 1, $sFontName = "Corbel Bold", $iFontSize = 14, $iFontWt = 800
; -----------------------------------------------
_Main()
; -----------------------------------------------
Func _Main()
    GUICreate(" ", 130, 20, 730, 120)
    GUISetFont($iFontSize, $iFontWt, $GUI_FONTNORMAL, $sFontName)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_CloseForm")
    ; ---------------------
    $idFormLabel1 = GUICtrlCreateButton("OK", 0, 0, 60, 20)
    GUICtrlSetOnEvent($idFormLabel1, "_ColRow")
    ; ---------------------
    $idFormLabel2 = GUICtrlCreateButton("Cancel", 70, 0, 60, 20)
    GUICtrlSetOnEvent($idFormLabel2, "_ColRow")
    ; -----------------------------------------------
    GUISetState()
    ; -----------------------------------------------
    While 1
        Sleep(1000)
    WEnd
EndFunc   ;==>_Main
; -----------------------------------------------
Func _ColRow()
    Switch @GUI_CtrlId
        Case $idFormLabel1
            OnOK()
        Case $idFormLabel2
            Exit
    EndSwitch
EndFunc   ;==>_ColRow
; -----------------------------------------------
Func OnOK()
    Local $sFilePath = "E:\Desktop\Working\Tests\ReadIni\SceneData.ini"
    Local $aArray = IniReadSection($sFilePath, "Scene Data")
    If Not @error Then
        For $i = 1 To $aArray[0][0]
            $iReturnValue = _ExtMsgBox(32, "~Continue|Cancel", "ReadIniData", "...will be copied to the Clipboard....continue...", 0, 0, False)
;~          $iReturnValue = MsgBox($MB_OKCANCEL, "ReadIniData", $aArray[$i][1] & "...will be copied to the Clipboard....continue...")
            If $iReturnValue = 1 Then
;~          If $iReturnValue = $IDOK Then
                MsgBox($MB_OK, "", "The OK Button was selected...", 1)
                $ArrayValue = $aArray[$i][1]
                ClipPut($ArrayValue)
            EndIf
            If $iReturnValue = 2 Then
;~          If $iReturnValue = $IDCANCEL Then
                MsgBox($MB_OK, "", "The Cancel Button was selected...", 1)
                ExitLoop
            EndIf
        Next
        MsgBox($MB_OK, "", "All Done!", 1)
    EndIf
EndFunc   ;==>OnOK
; -----------------------------------------------
Func _CloseForm()
    Switch @GUI_WinHandle
        Case $idFormLabel2
            Exit
    EndSwitch
EndFunc   ;==>_CloseForm
; -----------------------------------------------

 

...getting closer...

Edited by mr-es335
Posted

How do I get this function to step though the array?

; -----------------------------------------------
Func OnOK()
    Local $sFilePath = "E:\Desktop\Working\Tests\ReadIni\SceneData.ini"
    Local $aArray = IniReadSection($sFilePath, "Scene Data")
    If Not @error Then
        For $i = 1 To $aArray[0][0]
            If $idForm2Label1 = 5 Then
                $ArrayValue = $aArray[$i][1]
                ClipPut($ArrayValue)
            EndIf
        Next
    EndIf
EndFunc   ;==>OnOK
; -----------------------------------------------

 

Posted (edited)

Came across this....[Click_Me]

Local $iMax

Local $data = "E:\Desktop\Working\Tests\ReadIni\SceneData.ini"
Local $arr = IniReadSection($data, "Scene Data")

If IsArray($arr) Then
    $iMax = UBound($arr)

    ConsoleWrite("Items in the array: " & $iMax & @LF)

    For $i = 1 To $arr[0][0]
        $ArrayValue = $arr[$i][1]
        ConsoleWrite($ArrayValue & @LF)
    Next
EndIf

...just need to fig'ur out how to get this working in my script?!?

Edited by mr-es335
Posted (edited)

Maybe you should tell us what you want to achieve with this program ?!

In your example, you are having a lot of message boxes popping up. After each message box, you have 1 item in the clipboard. 

So basically, you start the the message boxes after clicking on "OK". Then you're having a lot of boxes popping up, after each you have to use ctrl v to paste the content into an application (i assume). That is a lot of clicking on the buttons.

That is how your script in the 1st post works.

Now tell me, how should your script work after you have done your changes. describe it.

Edited by Dan_555

Some of my script sourcecode

Posted

Dan_555,

You stated: "Maybe you should tell us what you want to achieve with this program ?!"

1) All "selectable" items are stored within a menu
2) This particular item is called "ReadIni"
3) Upon selection of "ReadIni", the ReadIni script is launched
4a) The script first performs an "IniReadSection" from a pre-exiting data file, of which contains a list of some 22 items. For example:

[Scene Data]
Line1=Start
Line2=Fade-In
Line3=Emcee
Line4=NStrung Guitar
Line5=SStrung Guitar...and so on...

4b) The second, this "data" is stored in an array
4c) Third, the first item is "read" and then copied to the Clipboard [via ClipPut($aArray)]
4d) Fourth, the script is "paused" [via MsgBox($MB_OKCANCEL]
4e) Fifth, the previously copied data is then pasted into a relevant text dialog box
4f) Sixth, 4c-4e is repeated until all 22 items have been summarily entered
4g) Seventh, the script is then exited

I was deploying the above via a "manual" text file, "manually" copying-an-pasting the text as noted in 4e) above.
I thought it would more advantageous to develop a script to "manage" such efforts.
All was working well, however, the implementation of MsgBox did not "fit" with my current scheme.
The implementation _ExtMsgBox was "better", but still NOT what I had in mind.
This led to my current posting which, as stated, "Within the OnOK() function is a MsgBox. I want to replace this MsgBox with the _Main GUI buttons."
• It now appears, that what I was asking for, was a lot more complicated that I had ever imagined!

If Not @error Then
    For $i = 1 To $aArray[0][0]
        ; ? Implement the _Main GUI buttons here - instead of employing MsbBox?!? ? 
        If MsgBox($MB_OKCANCEL, "", $aArray[$i][1] & "...will be copied to the Clipboard....continue...") = $IDCANCEL Then ExitLoop ; <<<< I want to replace this with OnEvent events.
        $ArrayValue = $aArray[$i][1]
        ClipPut($ArrayValue)
    Next
EndIf

This is the GUI that is to be implemented:

; -----------------------------------------------
$Form2 = GUICreate("ReadIniFile", 200, 20, 730, 240)
GUISetFont($iFontSize, $iFontWt, $GUI_FONTNORMAL, $sFontName)
GUISetOnEvent($GUI_EVENT_CLOSE, "_CloseForm")
; ---------------------
$idForm2Label1 = GUICtrlCreateButton("Continue", 10, 0, 85, 20)
GUICtrlSetOnEvent($idForm2Label1, "_ColRow")
; ---------------------
$idForm2Label2 = GUICtrlCreateButton("Cancel", 105, 0, 85, 20)
GUICtrlSetOnEvent($idForm2Label2, "_ColRow")
; -----------------------------------------------

As can be "hopefully" observed, this GUI contains a "Continue" and "Cancel" label.
However, it was getting the script to "pause" whilst I was pasting the previously copied data into the relevant text dialog box.
• This "pause" was implemented" via [MsgBox($MB_OKCANCEL]

With the assistance of ioa747, he has come up with a "workable" script which I am presently "dissecting".

What really-and-truly surprises me, is that a) a GUI-less MsgBox" or b) a completely "event driven" MsgBox, has not been previously developed [...at least from what I been able to ascertain thus far.]

I do hope that what I have provided above is explained in a succinct and yet, understandable manner?

Thank you for your time and attention to the above, Dan_555.

Both are very, very much appreciated!

Posted

If I understand your requirements correctly,
here is my approach.

; -----------------------------------------------
;~ #RequireAdmin
; -----------------------------------------------
#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>
; -----------------------------------------------
Opt("GUIOnEventMode", 1)
Opt("MustDeclareVars", 1)
; -----------------------------------------------
Global $hForm, $idFormLabel1, $idFormLabel2, $ArrayValue, $iReturnValue
Global $iWidth = 735, $iHeight = 48, $ixpos = -1, $iypos = -1, $iOpt = 1, $sFontName = "Corbel Bold", $iFontSize = 14, $iFontWt = 800
; -----------------------------------------------
_Main()
; -----------------------------------------------
Func _Main()
    $hForm = GUICreate(" ", 130, 20, 730, 120)
    GUISetFont($iFontSize, $iFontWt, $GUI_FONTNORMAL, $sFontName)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_CloseForm")
    ; ---------------------
    $idFormLabel1 = GUICtrlCreateButton("OK", 0, 0, 60, 20)
    GUICtrlSetOnEvent($idFormLabel1, "_ColRow")
    ; ---------------------
    $idFormLabel2 = GUICtrlCreateButton("Cancel", 70, 0, 60, 20)
    GUICtrlSetOnEvent($idFormLabel2, "_ColRow")
    ; -----------------------------------------------
    GUISetState()
    ; -----------------------------------------------
    While 1
        Sleep(1000)
    WEnd
EndFunc   ;==>_Main
; -----------------------------------------------
Func _ColRow()
    Switch @GUI_CtrlId
        Case $idFormLabel1
            OnOK()
        Case $idFormLabel2
            Exit
    EndSwitch
EndFunc   ;==>_ColRow
; -----------------------------------------------
Func _CloseForm()
    Switch @GUI_WinHandle
        Case $hForm
            Exit
    EndSwitch
EndFunc   ;==>_CloseForm
; -----------------------------------------------
Func OnOK()
    Local $sFilePath = @ScriptDir & "\SceneData.ini" ; "E:\Desktop\Working\Tests\ReadIni\SceneData.ini"
    Local $aArray = IniReadSection($sFilePath, "Scene Data")

    Run("notepad.exe") ; as Paste example
    Local $hNote = WinWaitActive("[CLASS:Notepad]", "", 3)

    Opt("GUIOnEventMode", 0) ; when in $hMsgForm - disable <<<<<<<<<<<<<<<
    Local $hMsgForm = GUICreate("ReadIniFile", 750, 90, -1, -1,  BitOR($WS_POPUP, $WS_CAPTION, $WS_SYSMENU), BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST))
    GUISetFont($iFontSize, $iFontWt, $GUI_FONTNORMAL, $sFontName)
    Local $idLabel_1 = GUICtrlCreateLabel("", 5, 5, 740, 40)
    Local $idBtnContinue = GUICtrlCreateButton("Continue", 280, 55, 85, 25)
    Local $idBtnCancel = GUICtrlCreateButton("Cancel", 375, 55, 85, 25)
    GUISetState(@SW_SHOW, $hMsgForm)


    Local $nMsg, $idx = 1
    GUICtrlSetData($idLabel_1, $aArray[$idx][1] & @CRLF & "...will be copied to the Clipboard....continue...")
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE, $idBtnCancel
                ExitLoop

            Case $idBtnContinue
                ClipPut($aArray[$idx][1])

                WinActivate($hNote)
                Send("^v")
                Send("{ENTER}")

                $idx += 1
                If $idx > $aArray[0][0] Then ExitLoop ; It means we have reached the end.
                GUICtrlSetData($idLabel_1, $aArray[$idx][1] & @CRLF & "...will be copied to the Clipboard....continue...")
                WinActivate($hMsgForm)
        EndSwitch
    WEnd

    GUIDelete($hMsgForm)
    Opt("GUIOnEventMode", 1) ; when out of $hMsgForm - enable <<<<<<<<<<<<<<<
EndFunc   ;==>OnOK

 

I know that I know nothing

Posted (edited)

iao747 and Dan_555,

Following is proposed end result of all that has transpired thus far...[Click_Me]

As is hopefully obvious, the sole purpose in employing Forms with labels...

Also, as this script is only intended for personal employment, there is not much need for employing "detailed files" - or explanations...

PS: I have updated the image to include the "Menu"....

 

Edited by mr-es335
Add image...
Posted (edited)

When i asked you to explain what you want to do, i have been thinking about something like this:

Quote

"I have several items in the ini file which i want to put in clipboard one after another and i want to paste them one after another into the application."

Which means when one item is pasted, the another item is copied into the clipboard. In this case "CTRL B" would be used to paste and switch.

another possible explanation would be like this:

Quote

"I have several items which i want to put in the clipboard and i want to paste one of them into an application until i decide to switch to the another item"

Which could mean that you are pasting one item several times until you decide to switch to the next item.

All this can be done with a hotkey. Ctrl V pastes the item and "ctrl B" would switch to the next item.

 

Edited by Dan_555

Some of my script sourcecode

Posted

Dan_555,

You stated, "All this can be done with a hotkey. Ctrl V pastes the item and "ctrl B" would switch to the next item."

Yes, I DO understand the implementation of Hotkeys. However, the application that I employ [Software Audio Console] is literally riddled with exiting Hotkeys, and thusly, only one key was available to me - the {NUMPADSUB} key. - - of which, has already been implemented!

P:S Your suggestions are very appropriate - by-the-way...thanks...

Posted (edited)

:think:  I don't know if it's appropriate to copy-paste, one by one, because this process didn't appear anywhere,
but practically speaking, since you don't make any selections during the process, it could be done in one go, e.g.   

; -----------------------------------------------
;~ #RequireAdmin
; -----------------------------------------------
#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>
; -----------------------------------------------
Opt("GUIOnEventMode", 1)
Opt("MustDeclareVars", 1)
; -----------------------------------------------
Global $hForm, $idFormLabel1, $idFormLabel2, $ArrayValue, $iReturnValue
Global $iWidth = 735, $iHeight = 48, $ixpos = -1, $iypos = -1, $iOpt = 1, $sFontName = "Corbel Bold", $iFontSize = 14, $iFontWt = 800
; -----------------------------------------------
_Main()
; -----------------------------------------------
Func _Main()
    $hForm = GUICreate(" ", 130, 20, 730, 120)
    GUISetFont($iFontSize, $iFontWt, $GUI_FONTNORMAL, $sFontName)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_CloseForm")
    ; ---------------------
    $idFormLabel1 = GUICtrlCreateButton("OK", 0, 0, 60, 20)
    GUICtrlSetOnEvent($idFormLabel1, "_ColRow")
    ; ---------------------
    $idFormLabel2 = GUICtrlCreateButton("Cancel", 70, 0, 60, 20)
    GUICtrlSetOnEvent($idFormLabel2, "_ColRow")
    ; -----------------------------------------------
    GUISetState()
    ; -----------------------------------------------
    While 1
        Sleep(1000)
    WEnd
EndFunc   ;==>_Main
; -----------------------------------------------
Func _ColRow()
    Switch @GUI_CtrlId
        Case $idFormLabel1
;~          MsgBox($MB_OK, "", "$idFormLabel1", 1)
            OnOK()
        Case $idFormLabel2
;~          MsgBox($MB_OK, "", "$idFormLabel2", 1)
            Exit
    EndSwitch
EndFunc   ;==>_ColRow
; -----------------------------------------------
Func OnOK()
    Local $sFilePath = @ScriptDir & "\SceneData.ini" ; "E:\Desktop\Working\Tests\ReadIni\SceneData.ini"
    Local $sData = ""

    If MsgBox($MB_OKCANCEL, "Copy SceneData", "SceneData...will be copied to the Clipboard....continue...") = $IDOK  Then
        Local $aArray = IniReadSection($sFilePath, "Scene Data")
        If Not @error Then
            For $i = 1 To $aArray[0][0]
                $sData &= $aArray[$i][1] & @CRLF
            Next
            $sData = StringReplace($sData, @CRLF, "", -1) ; remove last @CRLF
            ClipPut($sData)
        EndIf

        Run("notepad.exe")
        Local $hNote = WinWaitActive("[CLASS:Notepad]", "", 3)
        WinActivate($hNote)
        Send("^v")
    EndIf

EndFunc   ;==>OnOK
; -----------------------------------------------
Func _CloseForm()
    Switch @GUI_WinHandle
        Case $hForm
            Exit
    EndSwitch
EndFunc   ;==>_CloseForm
; -----------------------------------------------

 

Edited by ioa747

I know that I know nothing

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...