PDA

View Full Version : argument 2 must be of type string


carlossequeira
06-04-2005, 09:27 AM
Hi some one could help me

hi have this code

Application.Minimize();
ligacaoweb = HTTP.TestConnection("http://www.beprofit.pt", 20, 80, nil, nil);
teste1 = Dialog.Message("", "Voltar ao Mega Pacote de Jogos.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
Dialog.Message("Resultado:", teste1);
Dialog.Message("Resultado:", ligacaoweb);
x1 = ligacaoweb
Dialog.Message("Resultado:", x1);

hi need to receive a true or false result from the string ligacaoweb

thanks

Intrigued
06-04-2005, 09:50 AM
Here's an example to check for an active Internet connection:

Application.Minimize();

ligacaoweb = HTTP.TestConnection("http://www.beprofit.pt", 20, 80, nil, nil);

if (ligacaoweb) then -- ligacaoweb already returns 'true' or 'false'. This can be also: if (ligacaoweb = true) then (but the '= true' is not needed.
Dialog.Message("Notice", "Yes, there is an active Internet connection.")
else
Dialog.Message("Alert!", "No, there is not an active Internet connection!")
end

And the error code you are getting (SEE: Subject of this thread) is because you are trying to print, directly, a boolean Return. (what's handed back from the HTTP action):

Dialog.Message("Resultado:", ligacaoweb);

Sincerely,

{Edit}

Let me put in a suggestion that I use all the time still. Check the help file for the Action you want to know about (say the Return value, ie. was it a boolean it gives back, a string, a number, etc. etc.). These are stated at the bottom, or near to such, of each Action that has a Return value in the help file.

:yes

carlossequeira
06-04-2005, 10:59 AM
Thanks for the Help :)

Intrigued
06-04-2005, 11:55 AM
Anytime Carlos.

One other thing... Indigo Rose offers for download (or via 'hard copy', aka. book) the Users Guide and one about the Scripting side of AMS 5. That's how I got much more comfortable with AMS 5. Read, try, read, try... all the way through those points of help.

:yes

carlossequeira
06-04-2005, 03:21 PM
Could you help me with this code

liga = Button.GetText("Som");



if liga == "Som Desligado" then
Audio.Pause(CHANNEL_NARRATION);
Button.SetText("Som", "Som Ligado");

elseif liga == "Som Ligado" then
Audio.Play(CHANNEL_NARRATION);
Button.SetText("Som", "Som Desligado");
end

The text togle ob in the button but the funcion to pause doesnt work

thanks

Corey
06-04-2005, 03:29 PM
Hi here's a demo project which shows an example of toggle button text. Hope that helps. :)