mr-es335 Posted October 16 Posted October 16 (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 expandcollapse popup; ----------------------------------------------- #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 October 18 by mr-es335 Updates to initial script! mr-es335 Sentinel Music Studios
mr-es335 Posted October 16 Author Posted October 16 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?!? mr-es335 Sentinel Music Studios
Dan_555 Posted October 17 Posted October 17 (edited) Deleted Post Edited 17 hours ago by Dan_555 mr-es335 1 Some of my script sourcecode
mr-es335 Posted October 17 Author Posted October 17 (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 October 17 by mr-es335 mr-es335 Sentinel Music Studios
mr-es335 Posted October 17 Author Posted October 17 Another attempt: Spoiler expandcollapse popup#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 mr-es335 Sentinel Music Studios
mr-es335 Posted October 17 Author Posted October 17 ...and another... Spoiler expandcollapse popup; ----------------------------------------------- #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... mr-es335 Sentinel Music Studios
mr-es335 Posted October 17 Author Posted October 17 (edited) ...and another...implementing _ExtMsgBox... Spoiler expandcollapse popup; ----------------------------------------------- #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 October 17 by mr-es335 mr-es335 Sentinel Music Studios
mr-es335 Posted October 17 Author Posted October 17 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 ; ----------------------------------------------- mr-es335 Sentinel Music Studios
mr-es335 Posted October 17 Author Posted October 17 (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 October 17 by mr-es335 mr-es335 Sentinel Music Studios
Dan_555 Posted October 18 Posted October 18 (edited) This can be deleted as well Edited 17 hours ago by Dan_555 mr-es335 1 Some of my script sourcecode
mr-es335 Posted October 18 Author Posted October 18 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! mr-es335 Sentinel Music Studios
ioa747 Posted October 18 Posted October 18 If I understand your requirements correctly, here is my approach. expandcollapse popup; ----------------------------------------------- ;~ #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 mr-es335 1 I know that I know nothing
mr-es335 Posted October 18 Author Posted October 18 (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 October 18 by mr-es335 Add image... mr-es335 Sentinel Music Studios
Dan_555 Posted October 18 Posted October 18 (edited) This can be deleted as well Edited 17 hours ago by Dan_555 mr-es335 1 Some of my script sourcecode
mr-es335 Posted October 18 Author Posted October 18 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... mr-es335 Sentinel Music Studios
ioa747 Posted October 18 Posted October 18 (edited) 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. expandcollapse popup; ----------------------------------------------- ;~ #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 October 18 by ioa747 I know that I know nothing
mr-es335 Posted October 18 Author Posted October 18 (edited) ioa747, I need to copy-and-paste each individual item... Please peruse the following: [Click_Me] Edited October 18 by mr-es335 ioa747 1 mr-es335 Sentinel Music Studios
ioa747 Posted October 18 Posted October 18 (edited) 2 hours ago, mr-es335 said: I need to copy-and-paste each individual item... thinking... Since you are not selecting the item from SceneData.ini to copy (which would justify the step-by-step sequence with yes, no, cancel) you do not need to proceed step by step, but give the confirmation once and then, you can copy and paste each individual item.. it will not wait for another confirmation from you at each step Continue or Cancel. it will simply inform you at each step the 'Fade-In' SceneData was copied ... and here I wanted to emphasize that with the current process Cancel, does not cancel the registration, it simply interrupts it, i.e. what was passed remains Edited October 18 by ioa747 I know that I know nothing
mr-es335 Posted October 18 Author Posted October 18 (edited) ioa747, Thanks for the "suggestion|tips"...appreciated... Prior to implementing an .ini file, I WAS implementing a text file. I determined that the period of time from copy|paste to insertion varied considerably. Thus, the need for the "pause". The use of MsgBox was alright, but the dialog simply "got in the way" - as I do employ the script in two separate-and-distinct scenarios. Edited October 18 by mr-es335 mr-es335 Sentinel Music Studios
ioa747 Posted October 19 Posted October 19 3 hours ago, mr-es335 said: I determined that the period of time from copy|paste to insertion varied considerably. What role does this play, since with each entry you become independent? Example expandcollapse popup; ----------------------------------------------- ;~ #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 $Form1, $idForm1Label1, $idForm1Label2 Global $ArrayValue, $iReturnValue Global $iWidth = 735, $iHeight = 80, $ixpos = -1, $iypos = 300, $iOpt = 1, $sFontName = "Corbel Bold", $iFontSize = 14, $iFontWt = 800 ; ----------------------------------------------- _Main() ; ----------------------------------------------- Func _Main() $Form1 = GUICreate("LaunchReadIniFunction ", 200, 20, 730, 120) GUISetFont($iFontSize, $iFontWt, $GUI_FONTNORMAL, $sFontName) GUISetOnEvent($GUI_EVENT_CLOSE, "_CloseForm") ; --------------------- $idForm1Label1 = GUICtrlCreateButton("OK", 10, 0, 85, 20) GUICtrlSetOnEvent($idForm1Label1, "_ColRow") ; --------------------- $idForm1Label2 = GUICtrlCreateButton("Exit", 105, 0, 85, 20) GUICtrlSetOnEvent($idForm1Label2, "_ColRow") ; ----------------------------------------------- GUISetState(@SW_SHOW, $Form1) ; ----------------------------------------------- While 1 Sleep(1000) WEnd EndFunc ;==>_Main ; ----------------------------------------------- Func _ColRow() Switch @GUI_CtrlId Case $idForm1Label1 ReadIniFile() Case $idForm1Label2 Exit EndSwitch EndFunc ;==>_ColRow ; ----------------------------------------------- Func ReadIniFile() Local $sFilePath = @ScriptDir & "\SceneData.ini" ; "E:\Desktop\Working\Tests\ReadIni\SceneData.ini" If Not FileExists($sFilePath) Then Return MsgBox(0, "oops", "Where is the SceneData.ini ?") Local $sMessage = "...will be copied to the Clipboard....continue..." 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 ; SplashText initialize Local $hSplash = SplashTextOn("", "", $iWidth, $iHeight, $ixpos, $iypos, $iOpt, $sFontName, $iFontSize, $iFontWt) For $i = 1 To $aArray[0][0] ControlSetText($hSplash, "", "Static1", $aArray[$i][1] & @CRLF & $sMessage) ClipPut($aArray[$i][1]) Sleep(100) ; simulation of the Enter New Scene Run("notepad.exe") Local $hNote = WinWaitActive("[CLASS:Notepad]", "", 3) WinActivate($hNote) Send("^v") ; paste Send("+^s") ; save as WinWaitActive("[TITLE:Save As; CLASS:#32770]", "", 3) Local $sScenePath = @ScriptDir & "\Scene_" & $i & "_" & $aArray[$i][1] & ".txt" Send($sScenePath) ; save as Send("{ENTER}") WinClose($hNote) Next ControlSetText($hSplash, "", "Static1", "Scene data copying completed") Sleep(1000) SplashOff() EndIf EndIf EndFunc ;==>ReadIniFile ; ----------------------------------------------- Func _CloseForm() Switch @GUI_WinHandle Case $Form1 Exit EndSwitch EndFunc ;==>_CloseForm ; ----------------------------------------------- I know that I know nothing
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now