Hi Doug: Sorry to keep hammering on this matter that we talked about the other day, but I found a new problem. I followed your suggestion and created a variable called MyWindowOfInterest and I set it to the ActiveSettings object. Then I did "MyWindowOfInterest.save" in my dialog and it did not save the settings for the application I was using, let's just say Notepad as an example. I did a little digging and I found that if I changed a property of ActiveSettings, then the corresponding property of MyRealWindowOfInterest got changed as well. To test this, open the Immed window and type the following code: dim MyRealWindowOfInterest set MyRealWindowOfInterest = ActiveSettings set MyRealWindowOfInterest.Screen.CapitalizationAlert = 2 speak ActiveSettings.Screen.CapitalizationAlert 'it should equal 2 set MyRealWindowOfInterest.Screen.CapitalizationAlert = 0 speak ActiveSettings.Screen.CapitalizationAlert 'you should find that it equals 0, thus proving that they are always identical. Now, when I bring my SaveSettings dialog up and the active settings change from NotePad.Set to Wineyes.set, MyWindowOfInterest also changes from the Notepad settings to the Wineyes settings. , . So while I am doing "MyWindowOfInterest.Save" the ActiveSettings are being saved as well. The question is how can I make a copy of the ActiveSettings object which is independent of the ActiveSettings object. Kevin Huber
On 1/27/12, Kevin Huber <[email protected]> wrote: > Thanks for your patience Doug. I just thought there was more to it than > that. > > > On 1/25/12, Doug Geoffray <[email protected]> wrote: >> Kevin, >> >> You don't have to declare variables in VBScript unless your code starts >> with "Option Explicit". Option Explicit just says to VBScript that all >> variables have to be defined before they are used so it knows if it is >> valid or not when you use it. But to define any variable you just do >> something like: >> >> dim blah >> >> Variables in VBScript are all variants...so blah could be an object or >> an int or a string or whatever. If you don't have the Option Explicit >> than you just use the variable. >> >> We are getting more into VBScript than Window-Eyes object model. So if >> this still isn't clear to you I would suggest Chip's training materials >> or a VBScript user's manual of some sort. >> >> Doug >> >> On 1/25/2012 3:40 PM, Kevin Huber wrote: >>> Hi Doug: >>> How would you declare that variable? >>> Kevin Huber >>> >>> On 1/25/12, Doug Geoffray<[email protected]> wrote: >>>> Kevin, >>>> >>>> When you assign a variable to an object in VBScript you have to use the >>>> Set command. I used this in my example when I responded the first >>>> time. The one line is just: >>>> >>>> Set MyVariable = ActiveSettings >>>> >>>> Doug >>>> >>>> On 1/25/2012 2:44 PM, Kevin Huber wrote: >>>>> On 1/23/12, Kevin Huber<[email protected]> wrote: >>>>>> Thanks Doug: >>>>>> Sounds like a good plan. I'll work on it. >>>>>> Kevin Huber >>>>>> >>>>>> >>>>>> On 1/23/12, Doug Geoffray<[email protected]> wrote: >>>>>>> Kevin, >>>>>>> >>>>>>> You just need to get a copy of the ActiveSettings before you change >>>>>>> it. >>>>>>> For example when you hotkey is pressed you can get the >>>>>>> ActiveSettings >>>>>>> and save it off while you then go and bring up your dialog. The >>>>>>> active >>>>>>> window will change thereby making the ActiveSettings change but you >>>>>>> can >>>>>>> go back and used your previously saved version. So for example the >>>>>>> first line of your hotkey (I'm assuming you are using hotkey but >>>>>>> anything would work). >>>>>>> >>>>>>> set MyRealWindowOfInterest = ActiveSettings >>>>>>> >>>>>>> Than when you want to save their settings just do >>>>>>> >>>>>>> MyRealWindowOfInterest .Save >>>>>>> >>>>>>> Or instead of saving it off you could just find the window of >>>>>>> interest >>>>>>> and get the SetFile object from there. There are lots of ways to >>>>>>> get >>>>>>> the object you want. It just depends on what you are doing. >>>>>>> >>>>>>> Doug >>>>>>> >>>>>>> On 1/20/2012 4:44 PM, Kevin Huber wrote: >>>>>>>> Hi Doug: >>>>>>>> I think you just hit the nail on the head. >>>>>>>> Based on some testing that I did,I think that the settings are >>>>>>>> being >>>>>>>> saved to Wineyes.set. I want to save the settings to the >>>>>>>> application >>>>>>>> that had focus just before the dialog was called up. >>>>>>>> For example, if I am in Notepad, and I want to change the >>>>>>>> punctuation >>>>>>>> settings, then save them, I want to be able to save the new >>>>>>>> settings >>>>>>>> in Notepad.set using my dialog. >>>>>>>> Is there a way to accomplish this? >>>>>>>> Kevin Huber >>>>>>>> >>>>>>>> On 1/17/12, Doug Geoffray<[email protected]> wrote: >>>>>>>>> Kevin, >>>>>>>>> >>>>>>>>> One possibility is you aren't saving the set you think you are or >>>>>>>>> want >>>>>>>>> to. Based on this being in your dialog proc, you have an app >>>>>>>>> dialog >>>>>>>>> up. So the active settings would be the set file being used by >>>>>>>>> your >>>>>>>>> app, not the underlying program. I'm not sure what ActiveSettings >>>>>>>>> you >>>>>>>>> are really wanting as there isn't enough context but just a >>>>>>>>> thought. >>>>>>>>> >>>>>>>>> Doug >>>>>>>>> >>>>>>>>> On 1/13/2012 4:04 PM, Kevin Huber wrote: >>>>>>>>>> Hi: >>>>>>>>>> In my Proofreading script, the eventhandler that I use to save >>>>>>>>>> settings does not work as it should. >>>>>>>>>> the code is as follows: >>>>>>>>>> Function DialogEventHandler(dObj, dEvent, dId, dControl) >>>>>>>>>> DialogEventHandler = False >>>>>>>>>> if Keyboard.KeyDescriberActive then >>>>>>>>>> silence >>>>>>>>>> exit function >>>>>>>>>> end if >>>>>>>>>> Select Case dId >>>>>>>>>> >>>>>>>>>> Case "button_yes" >>>>>>>>>> If dEvent = buttonClicked Then >>>>>>>>>> activesettings.save >>>>>>>>>> Speak mystrings("ActiveSettingsSaved") >>>>>>>>>> DialogEventHandler = True >>>>>>>>>> isVisible = 0 >>>>>>>>>> dObj.Close >>>>>>>>>> Exit Function >>>>>>>>>> End If >>>>>>>>>> >>>>>>>>>> Case "button_no" >>>>>>>>>> If dEvent = buttonClicked Then >>>>>>>>>> Speak mystrings("ActiveSettingsNotSaved") >>>>>>>>>> DialogEventHandler = True >>>>>>>>>> isVisible = 0 >>>>>>>>>> dObj.Close >>>>>>>>>> Exit Function >>>>>>>>>> End If >>>>>>>>>> >>>>>>>>>> End Select >>>>>>>>>> End Function >>>>>>>>>> >>>>>>>>>> The problem is that the code in the "yes" case should save the >>>>>>>>>> settings but it appears to do nothing. >>>>>>>>>> I think that the "settings.save" command isn't working. >>>>>>>>>> Is there a work-around for this? >>>>>>>>>> Kevin Huber >>>>>>>>>> >>>>> Hi Doug: >>>>> If I do what you suggest, and make a copy of my activesettings like: >>>>> set RealWindowOfInterest = ActiveSettings >>>>> Do I have to declare ahe variable called >>>>> RealWindowOfInterest, or do I have to create an object. >>>>> >>>>> Maybe you can point me to an example of how to make a copy of an >>>>> object. >>>>> Kevin Huber >>>>> >>> Hi Doug: >>> How do you declare that variable. >>> >> >
