PDA

View Full Version : Help With Application.LoadValue(). Bug In The Program, Or My Code?


Draygoes
10-18-2008, 05:03 PM
I am having some trouble.
Application.LoadValue() is not returning a value.

Here is my code.

In the "On Click" event of the button:

Application.SaveValue("Intro_To_AutoIT", "Lesson Data", "AutoPlay\Docs\BGUIS_1.html");


My program should then load the value and pass it to a
browser object on the next page.

In the "On Show" event of the page:

result = Application.LoadValue("Intro_To_AutoIT", "Lesson Data");
Web.LoadURL("Web1", result);


Shouldnt that work?

RizlaUK
10-18-2008, 05:21 PM
when refering to a local filepath in AMS you must escape the backslash

"AutoPlay\Docs\BGUIS_1.html"

should be

"AutoPlay\\Docs\\BGUIS_1.html"

also, Application.SaveValue saves the entry to the registry, vista UAC might block access to this registry preventing the key from being saved

Draygoes
10-18-2008, 05:39 PM
Hi,
Thank you for your reply.

I did what you said, but it still isnt saving the value.



I tried checking to see if the value is being saved with a message dialog, but the dialog is popuping empty where it should say the saved value.

Also, the web object returns an error:

The address is not valid

Most likely causes:
There might be a typing error in the address.
If you clicked on a link, it may be out of date.

What you can try:
Retype the address.

Go back to the previous page.




Vista's UAC is turned off. I turned it off a few days after installing Vista.

Dermot
10-18-2008, 07:02 PM
Use the full path.

_SourceFolder.."\\AutoPlay\\Docs\\BGUIS_1.html"

Draygoes
10-18-2008, 07:13 PM
That did not work eather...

Modified code:
The onclick event of the button:

Application.SaveValue(HKEY_CURRENT_USER, "Intro_To_AutoIT", "Lesson Data", _SourceFolder.."AutoPlay\\Docs\\BGUIS_1.html",REG_SZ);



The on show event of the result page:

result = Application.LoadValue(HKEY_CURRENT_USER,"Intro_To_AutoIT", "Lesson Data",true);
Web.LoadURL("Web1", result);

Dermot
10-18-2008, 07:32 PM
You are missing a set of \\

Application.SaveValue(HKEY_CURRENT_USER, "Intro_To_AutoIT", "Lesson Data", _SourceFolder.."\\AutoPlay\\Docs\\BGUIS_1.html",REG_SZ);

Draygoes
10-18-2008, 08:20 PM
Unfortunatly, the same thing happened with the code that you posted above... :huh


I have a feeling that it isnt setting the data, but I cannot immagion why.


As I said before, I have tried getting it to show me the data that it is reading, and the msgbox that I have it create comes up blank. That makes me think that it isnt setting the data.

Dermot
10-18-2008, 08:38 PM
OK, the LoadValue action only has 3 arguments, but you are passing 4. You need to lose the first one.

Application.SaveValue("Intro_To_AutoIT", "Lesson Data", _SourceFolder.."\\AutoPlay\\Docs\\BGUIS_1.html",REG_SZ);

Draygoes
10-18-2008, 08:54 PM
Still doesnt seem to be returning a value. Despite all the changes in the code, nothing seems to be changing.

I dont understand. Is this a bug in the SDK?

Dermot
10-18-2008, 09:09 PM
This works for me. You actually had 5 arguments instead of 3. I missed the one on the end the last time.

Application.SaveValue("Intro_To_AutoIT", "Lesson Data", _SourceFolder.."\\AutoPlay\\Docs\\BGUIS_1.html");

result = Application.LoadValue("Intro_To_AutoIT", "Lesson Data")

Dialog.Message("Value", result)

Draygoes
10-18-2008, 09:11 PM
Using the code that you just posted, the dialog comes up empty in the current project for me...
However, when I create a clean "test" project, it works fine. What is going on??




:EDIT:
Wait.. Could it be that having a quick action set forces it to completely ignore the On Click script???

Draygoes
10-18-2008, 09:21 PM
Yep that was it!!!!!

I removed the Quick Action, and placed the following code in the "On Click" event of the button:


Application.SaveValue("Intro_To_AutoIT", "Lesson Data", _SourceFolder.."\\AutoPlay\\Docs\\BGUIS_1.html");
Page.Jump("Tutorial_Text");


If anyone else has the same problem, it is because setting a quick action makes it completely ignore scripts.






Thank you all for your help, and your patiance.