PDA

View Full Version : Update for HTTP and LAN


pramod
12-19-2008, 12:13 AM
Hello Friends,

when i m trying to create an script which is used to update from both the HTTP and LAN server. But when use the wizard it work only for one either HTTP or LAN. Please show me the steps to create script for both HTTP and LAN.

Thanks,

jassing
12-19-2008, 10:41 AM
you mean you get some files from the LAN and some files from HTTP?

You're going to have to do some scripting -- but it's easy once you get the hang of it..

pramod
12-19-2008, 11:08 PM
you mean you get some files from the LAN and some files from HTTP?

You're going to have to do some scripting -- but it's easy once you get the hang of it..

Can we take the trueupdate server from the script.

jassing
12-20-2008, 09:11 AM
I don't understand what you mean...

pramod
12-21-2008, 10:48 PM
I don't understand what you mean...

Hello jassing,

Thanks for the reply.
i just want to take the Trueupdate server path from the path specified in the script not the path specified in the project wizard.

jassing
12-22-2008, 11:40 AM
Have a look here:
http://www.indigorose.com/forums/showthread.php?t=22862
that should give you the ideas behind it...

pramod
12-23-2008, 03:40 AM
Have a look here:
http://www.indigorose.com/forums/showthread.php?t=22862
that should give you the ideas behind it...

Hello jassing,

when i m run the TrueUpdateClient.exe then it thrown a error "The requested URL was not found on the server". Below show the error log


[12/23/2008 15:04:51] Success Update started: D:\Projects\VB\Robin\CropTrakGPS\Update Output\UpdateClient.exe
[12/23/2008 15:04:51] Notice Update engine version: 3.0.1.0
[12/23/2008 15:04:51] Notice Product: FDM, version %ProductVer%
[12/23/2008 15:04:51] Success Language set: Primary = 9, Secondary = 1
[12/23/2008 15:04:51] Success Include script: _TU20_Global_Functions.lua
[12/23/2008 15:04:56] Error An error occurred when trying to download the server file. Server ID: TrueUpdate Server 1 : The requested URL was not found on the server. (3624)
[12/23/2008 15:04:56] Error Script: Client Script, Line 61 (3624)
[12/23/2008 15:04:56] Success Run client data event: Client Script
[12/23/2008 15:04:57] Notice Exit update process (Return code: 0)

Thanks & Regards,
Pramod.

pramod
12-23-2008, 07:22 AM
Have a look here:
http://www.indigorose.com/forums/showthread.php?t=22862
that should give you the ideas behind it...

Hello jassing,

The following error is shown: Script: Server Script, Line 56: attempt to index global `g_TargetVersion' (a nil value) (-1)

what was the reason to come this error.
How to solve this error.

Thanks & Regards,
Pramod.

jassing
12-23-2008, 10:33 AM
Hello jassing,

The following error is shown: Script: Server Script, Line 56: attempt to index global `g_TargetVersion' (a nil value) (-1)

what was the reason to come this error.
How to solve this error.

Thanks & Regards,
Pramod.

Since I don't know what is at your line 56 -- I can't even begin to help you there; but you're trying to use nil as a table; which doesn't work.
as for your other error; it sounds like you are trying to access a url on a server that doesn't exist...

pramod
12-24-2008, 06:55 AM
Since I don't know what is at your line 56 -- I can't even begin to help you there; but you're trying to use nil as a table; which doesn't work.
as for your other error; it sounds like you are trying to access a url on a server that doesn't exist...

Thanks for reply....

I'd like to set the location of my TrueUpdate servers by reading from the registry.
I've looked on the TU2 help, but wasn't able to find it.

Ulrich
12-24-2008, 07:13 AM
I'd like to set the location of my TrueUpdate servers by reading from the registry.

You can't insert new information in TrueUpdate's server list table in runtime. All servers have to be informed before you build the updater, if you want to use TrueUpdate.GetServerFile().

You may, however, download the server files by yourself if they are to be retrieved from a location not on the TU server list, and like jassing said - some scripting is required. Here is my suggestion:

For example, you could retrieve the IP address from where to download the server files from an *.INI file with INIFile.GetValue(), or from the registry with Registry.GetValue() if it was inserted there.
After you have the current address from where to check for an update, build the new URL and use HTTP.Download() to retrieve the three files (*.ts1, *.ts2 and *.ts3) from the remote server (or from the LAN) and store them locally in the same (temporary) folder.
Then, after you have managed to fetch the files, use TrueUpdate.LoadServerFile() to load the *.ts1 file with the correct encryption key.
Finally, if the file was loaded without error, use TrueUpdate.RunScript() to perform the steps necessary to update the installation.

You should be able to find examples for each step in the help file.

Ulrich

jassing
12-24-2008, 09:31 AM
Thanks for reply....

I'd like to set the location of my TrueUpdate servers by reading from the registry.
I've looked on the TU2 help, but wasn't able to find it.

have you looked at Registery.GetValue()?

pramod
12-25-2008, 12:50 AM
Thanks for reply,

I want to set the TrueUpdate Server path from the registry in client script (download server script). i'll try to get the servername but it throw error "The requested URL was not found on the server". Can you show me example.

Regards,
Pramod.

jassing
12-25-2008, 10:49 AM
Thanks for reply,

I want to set the TrueUpdate Server path from the registry in client script (download server script). i'll try to get the servername but it throw error "The requested URL was not found on the server". Can you show me example.

Regards,
Pramod.

Didn't you post this the other day? Can you pull up the url on another computer? What url is the client trying to get? did you load the files to the server as specified in the docs?

pramod
12-25-2008, 10:57 PM
Didn't you post this the other day? Can you pull up the url on another computer? What url is the client trying to get? did you load the files to the server as specified in the docs?

Hello Jassing,

yes i have load the file on the server.

and the client script for OnStart is this

function GetServerFileCallback(BytesDownloaded, FileSize, TransferRate, SecondsLeft, EstimatedTimeRemaining, ServerStatusMessage, tableClientUpdateInfo)

-- Did the user click Cancel?
if(screen_globals.Cancelled) then
-- Tell the GetServerFile action to abort
return false;
end


local Downloading = TrueUpdate.GetLocalizedString("MSG_UPDATE_INFORMATION");

-- Set appropriate messages if we're updating the TrueUpdate Client
if(tableClientUpdateInfo) then
-- What part of the Client are we updating?
if(tableClientUpdateInfo.UpdateType == 0) then
Downloading = TrueUpdate.GetLocalizedString("MSG_UPDATE_EXECUTABLE");
else
Downloading = TrueUpdate.GetLocalizedString("MSG_UPDATE_DATA");
end
end

-- Reset the progress bar if we've started downloading something different
if((screen_globals.Downloading == nil) or (Downloading ~= screen_globals.Downloading)) then

DlgProgressBar.SetPos(CTRL_PROGRESS_BAR_01, 0);

screen_globals.Downloading = Downloading;
end

-- Update the status text to show what we're downloading
DlgStaticText.SetProperties(CTRL_STATICTEXT_LABEL_ 01, {Text=TrueUpdate.GetLocalizedString("MSG_DOWNLOADING")..": "..Downloading.." "..TrueUpdate.GetLocalizedString("MSG_FROM").." "..TrueUpdate.GetLocalizedString("MSG_SERVER_NUMBER").." "..screen_globals.CurrentServerIndex});

-- Calculate the percentage that has been downloaded so far
local PercentComplete = 0;
if(FileSize > 0) then
PercentComplete = (BytesDownloaded/FileSize) * 100;
end

-- Update the progress bar
DlgProgressBar.SetPos(CTRL_PROGRESS_BAR_01, PercentComplete);

-- Update the status text
if(ServerStatusMessage == "") then
-- We're downloading...

-- Shorten the TransferRate to 2 decimal places
local TransferRateFormatted = string.format("%.2f", TransferRate);

if(FileSize > 0) then

local StatusText = TrueUpdate.GetLocalizedString("MSG_ESTIMATED_TIME_LEFT")..": "..EstimatedTimeRemaining.." - "..TrueUpdate.GetLocalizedString("MSG_TRANSFER_RATE")..": "..TransferRateFormatted.." "..TrueUpdate.GetLocalizedString("MSG_KB_PER_SEC");
DlgStaticText.SetProperties(CTRL_STATICTEXT_LABEL_ 02, {Text=StatusText});
else

local SecondsElapsed = os.time() - screen_globals.TimeStarted;

local TimeElapsed = g_GetFormattedTime(SecondsElapsed);

local StatusText = TrueUpdate.GetLocalizedString("MSG_ELAPSED_TIME")..": "..TimeElapsed.." - "..TrueUpdate.GetLocalizedString("MSG_TRANSFER_RATE")..": "..TransferRateFormatted.." "..TrueUpdate.GetLocalizedString("MSG_KB_PER_SEC");
DlgStaticText.SetProperties(CTRL_STATICTEXT_LABEL_ 02, {Text=StatusText});
end

else
-- We're waiting for the server...

-- Show the current status message
DlgStaticText.SetProperties(CTRL_STATICTEXT_LABEL_ 02, {Text=ServerStatusMessage});
end

-- Tell the GetServerFile action to continue
return true;
end

------------------------------
-- Download the server files
------------------------------

-- Get the list of TrueUpdate Server locations
local tableTrueUpdateServers = TrueUpdate.GetUpdateServerList();

if(tableTrueUpdateServers) then

screen_globals.TimeStarted = os.time();

for index, ServerName in tableTrueUpdateServers do

screen_globals.CurrentServerIndex = index;

screen_globals.GotServerFiles = TrueUpdate.GetServerFile(ServerName, true, GetServerFileCallback);

-- Break out of this loop if we succeeded
if(screen_globals.GotServerFiles) then
break;
end
end
end


how can i pass the URL form the registry in this code.

please help me.

jassing
12-25-2008, 11:53 PM
did you upload the files to the server?

regarding your "registry" question -- are you reading the local registry to find out where the files are on the server?

Unless it's a local network; you're not going to be able to read a remote registry -- and if you can; it would be a serious security hole.

pramod
12-26-2008, 12:23 AM
did you upload the files to the server?

regarding your "registry" question -- are you reading the local registry to find out where the files are on the server?

Unless it's a local network; you're not going to be able to read a remote registry -- and if you can; it would be a serious security hole.

yes the value of server URL saved in the local registry.

jassing
12-26-2008, 12:47 AM
To read a value from the registry
See:
Registry.GetValue()

pramod
12-26-2008, 05:24 AM
To read a value from the registry
See:
Registry.GetValue()

can i write a script which have read URL for HTTP and LAN server both or not in TrueUpdate 3.0?

jassing
12-26-2008, 11:08 AM
can i write a script which have read URL for HTTP and LAN server both or not in TrueUpdate 3.0?

Hmm. that's a tricky question; the "can" part is the bit I don't know ;-)

But seriously, yes; scripting can be writen to do just about anything you want; as long as it's possible to w/o scripting... IOW --if you can do it on the pc you want to "update" then it can be scripted.

pramod
12-26-2008, 10:44 PM
Hmm. that's a tricky question; the "can" part is the bit I don't know ;-)

But seriously, yes; scripting can be writen to do just about anything you want; as long as it's possible to w/o scripting... IOW --if you can do it on the pc you want to "update" then it can be scripted.


I have written a server script which is parse the code for HTTP server or LAN server and it works but i m not able to get the URL path (HTTP or LAN) from the client script. I m select the Upload Method "I will do this myself manually or will configure it later" but i don't no how to configure it later.
can you help me.....

jassing
12-26-2008, 11:05 PM
I think there's a confusion on the term "client" and "server" scripts.

the server script doesn't actually "run on the server"; think of it as a way to divide up the code abit...

the client side contains sripting before you want to talk the server; then once you are ready to determine if a download is available or not.

nothing you code in TrueUpdate "runs on the server", everything runs on the client PC.

Some things 'always' reside on the client, and other code "resides" on the server, until it's downloaded to the client and then executed.

The "upload method" and "I will do this later" just means you will be responsible for uploading the .ts1/2/&3 files to the server.

You should do a simple wizard based client and run it a few times so you can see what goes on.

pramod
12-26-2008, 11:15 PM
I think there's a confusion on the term "client" and "server" scripts.

the server script doesn't actually "run on the server"; think of it as a way to divide up the code abit...

the client side contains sripting before you want to talk the server; then once you are ready to determine if a download is available or not.

nothing you code in TrueUpdate "runs on the server", everything runs on the client PC.

Some things 'always' reside on the client, and other code "resides" on the server, until it's downloaded to the client and then executed.

The "upload method" and "I will do this later" just means you will be responsible for uploading the .ts1/2/&3 files to the server.

You should do a simple wizard based client and run it a few times so you can see what goes on.


Thanks Jassing,

There are any way to change the TrueUpdate Server URL in the client script. I have set TrueUpdate Server in the Project-> TrueUpdate Servers..

jassing
12-26-2008, 11:43 PM
This isn't 100% -- but my gut says "no" it's an internal bit that is encoded into the .dat file.

But; this isn't to say you can't do it with scripting...

The code (if you do a wizard-'new' project) that handles the server, all it does is check if the server is available with the proper files.

If you want to do things that aren't what TU is "designed" for -- here's what I'd suggest....

in your "client" script -- get your 'server' from registry or xml or whatever, then grab the data files from there & run the "server" script after restart...

A LOT more coding will will be needed. If you were my client; I would start over and consider that TrueUpdate isn't the tool to use for your needs.

IR products are great, and when combined they produce an awesome set of install, update, patch 'suite' of softwares that work well... but sometimes people get stuck in a rut of wanting to use one product becuase they 'want it to fit' the need....

pramod
12-27-2008, 12:03 AM
This isn't 100% -- but my gut says "no" it's an internal bit that is encoded into the .dat file.

But; this isn't to say you can't do it with scripting...

The code (if you do a wizard-'new' project) that handles the server, all it does is check if the server is available with the proper files.

If you want to do things that aren't what TU is "designed" for -- here's what I'd suggest....

in your "client" script -- get your 'server' from registry or xml or whatever, then grab the data files from there & run the "server" script after restart...

A LOT more coding will will be needed. If you were my client; I would start over and consider that TrueUpdate isn't the tool to use for your needs.

IR products are great, and when combined they produce an awesome set of install, update, patch 'suite' of softwares that work well... but sometimes people get stuck in a rut of wanting to use one product becuase they 'want it to fit' the need....


Thanks Jassing,

How to handles the server in the client script. you have sample code to get the server from the registry in client script in the TrueUpdate 3.0.

jassing
12-27-2008, 12:10 AM
Registry.GetValue() will retrieve a value from the registry.

how you put it in there is another question.

pramod
12-27-2008, 12:15 AM
Registry.GetValue() will retrieve a value from the registry.

how you put it in there is another question.


I know Registry.GetValue() is used to retrive value from the registry but i want where to use this in the client script.

jassing
12-27-2008, 12:22 AM
I know Registry.GetValue() is used to retrive value from the registry but i want where to use this in the client script.

Perhaps we have a concept or language problem.

You can use Registry.GetValue() in the client script...

pramod
12-27-2008, 12:26 AM
Perhaps we have a concept or language problem.

You can use Registry.GetValue() in the client script...


can i pass the Server URL from their

ServerName=Registry.GetValue(HKEY_CURRENT_USER, "Software\\VB and VBA Program Settings\\CheckUpdate\\Settings", "URLLocation",true);

screen_globals.GotServerFiles = TrueUpdate.GetServerFile(ServerName, true, GetServerFileCallback);

Is it correct?

jassing
12-27-2008, 12:27 AM
pramod:

We're going in circles now -- why don't you take a step back; and ignore coding; ignore scripting; ignore TrueUpdate.
Explain in simple english, in outline form -- what you want to do.
Let's start there -- I think we'll get better results.

pramod
12-27-2008, 12:38 AM
pramod:

We're going in circles now -- why don't you take a step back; and ignore coding; ignore scripting; ignore TrueUpdate.
Explain in simple english, in outline form -- what you want to do.
Let's start there -- I think we'll get better results.


My requirement is that

1) Write a script which have use for check the update for both HTTP and LAN server.
2) I have already write a script which is used to fulfill this requirement. (script is working for both the server)
3) now i have check the "Upload Locations" from the given path.
4) i want to set this "Upload Locations" from the registry and as well as i want to get the TrueUpdate server (Project->TrueUpdate Server) path from the registry not the set path save in the wizard.

pramod
12-27-2008, 12:50 AM
pramod:

We're going in circles now -- why don't you take a step back; and ignore coding; ignore scripting; ignore TrueUpdate.
Explain in simple english, in outline form -- what you want to do.
Let's start there -- I think we'll get better results.


but when i m try to set the path then it is not able to get the server url and show me the error in the log "An error occurred when trying to download the server file. Server ID: TrueUpdate Server 1 : An error occurred while trying to open the HTTP file. (3611) " and "Script: Download Server Script > On Start, Line 114 (3611)"

jassing
12-27-2008, 01:12 AM
w/o knowing line 114 - can't help.

So you're basically done -- you just want to ADD in server info via the registry -- correct?

So - use the basic wizard to create a TU client; but then; once a server is 'found' (internal) then check the registry -- and set the appropriate variables based on your checks...

pramod
12-27-2008, 01:32 AM
w/o knowing line 114 - can't help.

So you're basically done -- you just want to ADD in server info via the registry -- correct?

So - use the basic wizard to create a TU client; but then; once a server is 'found' (internal) then check the registry -- and set the appropriate variables based on your checks...


Yes.
but when i m try to directly pass the URL into the client->OnStart script
screen_globals.GotServerFiles = TrueUpdate.GetServerFile("www.testurl.com/Elink/", true, GetServerFileCallback);

it doesn't give any error into the log but not connect to the server url.

jassing
12-27-2008, 01:46 AM
you're misusing the TrueUpdate.GetServerFile();

I would suggest that you do one of two things right now:
1) open a supprot ticket with IR -- They have very knowledgeable and helpful staff!
2) look to hiring a consultant to work out the details for you.