Guidance
指路人
g.yi.org
Guidance Forums / Reginald Rexx / Script to "push" a button

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Script to "push" a button
#12895
Posted by: Doug Arndt 2009-05-13 03:12:50
I have a script to automate a series of external processes.
Each initiated with a separate push button.
ie...Rip Cd, Audio Edit, convert MP3, upload to web, update html.
The last 3 steps normally can run back to back.
So, I'd like to test a check box and then "initiate" the next button.
I've read some about the guisendmsg with "POST", but can't find enough documentation to get it to work.
Doug
Message2. Push a button
#12897
Posted by: Michael S 2009-05-13 22:55:27 Last edited by: Jeff Glatt 2009-05-22 13:37:57 (Total edited 1 time)
Since the push buttons are "tied" to procedure names, couldn't you simply call them, as in:
wm_click_convert_mp3()
wm_click_upload_to_web()
wm_click_update_html()
(obviously with error handling thrown in between the calls).
Message3.
#12898
Posted by: PeterJ 2009-05-14 00:28:02
I guess Doug want's to control normal applications - remote control of applications. Very interesting, if you have some examples, I am interested!
Message4.
#12900
Posted by: Jeff Glatt 2009-05-14 03:08:40
Your explanation of what you're trying to do sounds very vague to me. I have no idea why you have 3 separate buttons to control the 3 processes of "convert MP3", "upload to web", and "update html". And yet, you've tied all 3 operations to yet another button. That would confuse the hell out of me as an enduser.

But if that's really what you're trying to do, then Mike's suggestion is the correct way. Have the push handler for the third button perform all 3 operations by calling 3 subroutines. If need be, separate out the code from the other buttons' PUSH handlers so that the operations can be their own subroutines.
Message5.
#12906
Posted by: Doug Arndt 2009-05-15 01:13:46
Once a week I receive a CD from my church,  I rip it (Exact Audio Copy), then edit the tracks to clean up anything unnecessary (Goldwave), convert each track to MP3 (Goldwave), upload each track to internet site (Rexx iNet), then update the associated HTML (Rexx code & iNet).   After running all the steps a few times, it becomes a pain.  So to automate, I made a simple screen to enter all the variable parameters (related to filename, web directory, etc) and a series of push buttons to run each step.
Being of the lazy sort, pushing 5 buttons became a pain  :-)  plus, i keep forgetting where I left off as the rip/convert/upload can take 15-20 min for each track. (more than one I've updated the html, before the files were uploaded)
So, being that I do like to code Rexx, I added 3 check boxes next to the last 3 steps, so when I want it to just run, I check the box, the code should then initiate the next step.  But the "purest" in me didn't like one button handler calling the next button, which would then call the next one.  Yes, it would work, just grates on me.   So, good time to learn something new, hence the question.   
However, I think your last line Jeff is the answer, make stand alone routines that the button handlers can call.  Ok, that doesn't "grate" on me :-)
Didn't learn anything new however, another time I guess.

Oh ... since I am the end user, I'm allowed to confuse myself  :-)
Doug
Message6.
#12907
Posted by: PeterJ 2009-05-15 02:06:29
There is a nice sample in the Reginald Help:
Sound - CD Audio which extracts an entire cd into Wave Files.

It might not as perfect in Audio corrections as EAC, but I didn't really find any problems (jittering).
For MP3 encoding I use Reginald calling the Lame Encoder for an entire directory (could be the extracted Wave Files).
Combining both methods you have a relatively automatic process.

Peter
Message7.
#12908
Posted by: Jeff Glatt 2009-05-15 02:28:49
Data on audio CDs is already in "wave" file format. The Reginald CD audio add-on DLL essentially does what Goldwave's "Exact Audio Copy" does. So, like Peter suggests, if you use some add-on DLL that can convert wave to mp3, then you can skip invoking Goldwave entirely, and completely automate the process to one "step".
Message8.
#12909
Posted by: PeterJ 2009-05-15 02:52:25 Last edited by: PeterJ 2009-05-15 02:55:57 (Total edited 1 time)
The following 2 rexx will do the encoding. You need to download the LAME encoder from somewhere (google), and adjust the directories to your needs

Procedure 1  

outdir="c:\.......\"   /* Insert the directory to convert */
DO FOREVER
   result = MATCHNAME(1010, 'member', outdir||'*.WAV', 'SNHCRAT')
   IF result \= "" THEN LEAVE
   CALL lame(outdir||member,1)
END
EXIT
Procedure Lame.rex

/* Fixed bit rate jstereo 128kbps encoding, high quality (recommended): */
lame:
title=ARG(1)
IF ARG(2,'E')=1 THEN details=ARG(2)
   ELSE details=0
LIBRARY rxcmd
lamedir='C:\Programme\Lame3.98.2\'   /* Insert your Lame 3.98 Directory */
wavedir = SUBSTR(title,1,1)':'FILESPEC('P',title)
wave = FILESPEC('N',title)
lp=LASTPOS('.',wave)
mp3=SUBSTR(wave,1,lp)"mp3"
cpath=DIRECTORY() 
DIRECTORY(wavedir)
IF details=1 THEN SAY TIME('l') wave' start MP3 conversion' 
err = command(lamedir'lame.exe -h "'wave'"' '"'mp3'"','listing',,'')
IF err \= "" THEN DO
   SAY err 
   SIGNAL exit8
END
DO i=1 TO listing.0
   SAY i listing.i
END
IF details=1 THEN SAY TIME('l') mp3' conversion completed'
exit8:
DIRECTORY(cpath)
RETURN 
Message9. One other aspect to this ...
#12910
Posted by: Michael S 2009-05-15 14:40:27
Make sure you have a status bar where you can write whichever the current process
is so you know what's going on. Another thing I do a lot is to include a listbox and write a "progress" report to it (I ALSO include menu options to save/print the contents of the listbox, but that's possibly me going OTT)
Message10.
#12915
Posted by: Doug Arndt 2009-05-16 21:27:37
Thanks for all the tips, and other options.   However, I still need to "edit" the extracted wave file to trim off any unnecessary content, like anouncements, etc. I also convert the file from stereo to mono in the MP3 convert step.  I like the status bar suggestion, that would fix my "where did I leave off" memory.  I tried/wanted to change the color of the button, but we can't do that.
I guess since the thread has wandered away from the original question of, can Rexx GUI POST a "button push", that the answer to that is no.
Doug
Message11.
#12924
Posted by: Jeff Glatt 2009-05-22 13:36:58
Actually, you can programmably cause a button to be pushed, but in your particular case, it would have been a really inefficient way to do what you wanted.
/* Get the "handle" to my button associated with the
 * REXX variable "My button"
 */
handle = guiinfo('HANDLE', 'My button')

/* Post a CLICK event */
guisendmsg(handle, "POST CLICK", , handle)
Message12.
#12927
Posted by: Doug Arndt 2009-05-22 22:56:28
This is perfect, thanks Jeff.

Now, within a specific step, once it's determined it's function was good, a simple test of a check box (so I can choose if i want to be auto or not), then POST the click, nice and clean.  Then the current step can finish up and exit cleanly, then the POST CLICK takes effect at the right place.   Keeps the logic nice and clean.
Doug
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Thu 2024-4-18  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0