Modify resource file entries


 


In my prior two posts (This code queries the foxuser resource file. What does it do? and More Resource file data mining), I showed how to read resource file entries.


 


Here’s code that shows how to modify the entries.


 


 


SET RESOURCE ON  && make sure Foxuser is being used to store preferences


USE SET(“Resource”,1) AGAIN ALIAS foxuser


 


cFilename=”testprog.prg”


FOR i = 1 TO 10


      ERASE testprog.prg      && start with no file existing


      _cliptext=”This is some sample text”+CHR(13)+” More text”   && put some text on the clipboard


      KEYBOARD ‘{CTRL+v}’     && put a paste command in the keyboard buffer to paste it in


      MODIFY COMMAND (cFilename) nowait   && open an editor window


      DOEVENTS    && allow the paste


      KEYBOARD “Y”      && put a ‘Y’ to save changes  in the buffer


      RELEASE WINDOWS testprog.prg  && Close the edit window


      LOCATE FOR id=”WINDMODIFY” AND name=cFilename   && find the record in the resource table


      nLeft=INT(VAL(TRANSFORM(CTOBIN(SUBSTR(Data,13,4),”4rs”),”9999″)))


      nleft=nleft+1


      ?nLeft


      newdata = LEFT(data,12)+BINTOC(nLeft,”4rs”)+SUBSTR(data,17)


      REPLACE data WITH newdata,ckval WITH VAL(SYS(2007,SUBSTR(newdata,3)))


ENDFOR


 

Comments (2)

  1. MikeOC says:

    I am trying to take the printer buttton off the print preview menu when a user enters print preview.  The way it is suppose to be done prior to fox 9.0 is create empty resource file and then interactively remove the printer ico through the toolbar customization.  I would like to and then entry to my new resource table by making a new entry where name = ‘Print Preview’ but not sure how to add new entry for data field.  I didn’t really understand what you were trying to do with this line INT(VAL(TRANSFORM(CTOBIN(SUBSTR(Data,13,4),"4rs"),"9999"))) can you explain.

    Thanks

  2. MikeOC says:

    I am trying to take the printer buttton off the print preview menu when a user enters print preview.  The way it is suppose to be done prior to fox 9.0 is create empty resource file and then interactively remove the printer ico through the toolbar customization.  I would like to and then entry to my new resource table by making a new entry where name = ‘Print Preview’ but not sure how to add new entry for data field.  I didn’t really understand what you were trying to do with this line INT(VAL(TRANSFORM(CTOBIN(SUBSTR(Data,13,4),"4rs"),"9999"))) can you explain.

    Thanks