PDA

View Full Version : Question about silent wucheck?



NewsArchive
11-02-2010, 10:07 AM
Hello all,

This is what I want:

I want wuckeck to do its thing completely silent.

If an update is available, I want to display a message, "An update is
available. Do you you want to update XXXXXX?"

I know how to do the silent part. How do I do the message part?

Th SB docs say:
wucheck.exe /C /S - Check for a web update in silent mode. Returns "1" if an
update is available. Returns "0" if no update is available.

I don't know how to use the Returns "1", Returns "0" part.

Do I use the return value in the clarion EXE or in the SB setup?

Thanks,
Don

NewsArchive
11-02-2010, 10:08 AM
Hi Don,

> This is what I want:
>
> I want wuckeck to do its thing completely silent.
>
> If an update is available, I want to display a message, "An update is
> available. Do you you want to update XXXXXX?"
>
> I know how to do the silent part. How do I do the message part?
>
> Th SB docs say:
> wucheck.exe /C /S - Check for a web update in silent mode. Returns "1" if
> an update is available. Returns "0" if no update is available.
>
> I don't know how to use the Returns "1", Returns "0" part.
>
> Do I use the return value in the clarion EXE or in the SB setup?

You call (run) wucheck.exe from your own application and "wait" for it. If
it returns "1" then an update is available -- display your "An update is
available. Do you want to update XXXXXX?" message. If it returns "0" then
no update is available.

Does this help?

Friedrich

--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910

SetupBuilder is Windows 7 installation -- "point. click. ship"

-- Official Comodo Code Signing and SSL Certificate Partner

NewsArchive
11-04-2010, 01:45 AM
How do know what it returned? Or should I say, how do a capture the return
value to do what I want?

If ReturnValue = 1
message('YadaYadaYada')
Else
!Do nothing
End

Donald Ridley

NewsArchive
11-04-2010, 02:03 AM
> How do know what it returned? Or should I say, how do a capture the
> return value to do what I want?
>
> If ReturnValue = 1
> message('YadaYadaYada')
> Else
> !Do nothing
> End

It depends on what you are using to launch the external program:
ShellExecute(Ex), CreateProcess, Clarion RUN(), a 3rd-party tool, etc.

In Windows, if you use ShellExecuteEx, you have to "wait" for the launched
application to retrieve the return value from that app. You have to use the
WaitForSingleObject Windows API to wait and then GetExitCodeProcess to
retrieve the exit code.

BTW, this is not only for wupdate.exe or wucheck.exe. This is for all
Windows applications.

Here is a quick and dirty ShellExecute demo for Clarion developers:

http://www.lindersoft.com/forums/showthread.php?p=44868&highlight=shellexecute#post44868
http://www.lindersoft.com/projects/ClarionShellExec.zip

If you are using the Clarion RUN() command with the waitflag option enabled,
then (IIRC) you can use the RUNCODE() function to retrieve the exit code.

Does this help?

Friedrich

NewsArchive
11-06-2010, 02:29 AM
Hey Friedrich,

There should be an award for best customer service..... :-)

I'm not too familiar with ShellExecute at this moment. I'm using the RUN
command.

I read the docs on RUNCODE() and I see where I can execute code based upon
the returned code.

Wucheck returns 0 if no update and 1 if there is an update. Can I use that
0 or 1 with RUNCODE or do I have to use the codes listed in the Clarion
docs?

Just needing a little education here..

THANKS!
Don

NewsArchive
11-06-2010, 02:29 AM
Hi Donald,

> Wucheck returns 0 if no update and 1 if there is an update. Can I use that
> 0 or 1 with RUNCODE or do I have to use the codes listed in the Clarion
> docs?
>
> Just needing a little education here..

Run('wucheck.exe /S /C')
If RunCode() = 1
If Message('There is a new version available for download. Do you want to
install it now?','New version
available',ICON:Exclamation,BUTTON:Yes+BUTTON:NO,B UTTON:Yes) = BUTTON:Yes
Run('wupdate.exe')
Halt()
End
End

This will check for update and if an update is available it will download it
and install it. The Halt() will stop the program so you can install the new
version without rebooting:)

Note that Run() (at least in C6) is not reliable under UAC on Vista/Win7 if
the program you are running is not elevated (manifested asInvoker) and the
install is manifested as RequireAdministrator. What happens is that the
Run() command will NOT trigger the elevation prompt and simply not do
anything. To solve that you need to use ShellExecute/ShellExecuteEx.

Hope this helps:)

Best regards,

--
Arnór Baldvinsson - Icetips Alta LLC
Port Angeles, Washington
www.icetips.com - www.buildautomator.com - www.altawebworks.com

Icetips product subscriptions at http://www.icetips.com/subscribe.php

NewsArchive
11-07-2010, 02:12 AM
LOL! Hey Arnor,

I had coded something almost identical to what you did.

You know what I learned?

You HAVE to spell "wucheck" correctly!

Thanks Arnor!!

Don

NewsArchive
11-07-2010, 02:13 AM
Hi Don,

> There should be an award for best customer service..... :-)

Thank you!!! :-)

> I'm not too familiar with ShellExecute at this moment. I'm using the RUN
> command.
>
> I read the docs on RUNCODE() and I see where I can execute code based upon
> the returned code.
>
> Wucheck returns 0 if no update and 1 if there is an update. Can I use
> that 0 or 1 with RUNCODE or do I have to use the codes listed in the
> Clarion docs?
>
> Just needing a little education here..

You can use something like this to check if an update is available. If it
is available, call wucheck.exe again to download and execute it.

RUN('wucheck.exe /S /C')
IF RUNCODE() = 1 THEN
MESSAGE('Update available - download and install...', 'Update available')
RUN('wucheck.exe /S')
END

The problem with RUN() in Clarion 6 is, that it is a wrapper around the
CreateProcess Windows API. CreateProcess will always fail if a non-elevated
application under Vista/2008/Win7 attempts to launch another application
whose manifest requires elevation. GetLastError will return 740
(ERROR_ELEVATION_REQUIRED) in this case. In other words, you can't use the
Clarion RUN() command with wupdate.exe on UAC-aware operating systems. But
wucheck.exe does not require administrator execution level privileges, so
this should work fine here.

Friedrich

--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910

SetupBuilder is Windows 7 installation -- "point. click. ship"

-- Official Comodo Code Signing and SSL Certificate Partner

NewsArchive
11-07-2010, 02:13 AM
I'm running C7.2 7653. Did SV fix it in my version?

I've seen some negative comments toward RUN in the NG's even for C7.

Thanks again!
Don

NewsArchive
11-07-2010, 02:13 AM
Hi Don,

> I'm running C7.2 7653. Did SV fix it in my version?
>
> I've seen some negative comments toward RUN in the NG's even for C7.

Yes, as far as I know, SV changed the RUN() command in C7 to exactly solve
this UAC "elevation" problem.

Friedrich

NewsArchive
11-07-2010, 02:14 AM
BTW, if you are using "wucheck.exe" then you should not experience any
problems with the UAC thing.

Friedrich

NewsArchive
11-07-2010, 02:14 AM
Yeah, I'm trying out your version of suggested code.

Donald Ridley

NewsArchive
11-07-2010, 02:15 AM
For some reason the RunCode part is not executing:

If RunCode() = 1
If Message('There is a new version available for download. Do you want to
install it now?','New version
available',ICON:Exclamation,BUTTON:Yes+BUTTON:NO,B UTTON:Yes) = BUTTON:Yes

Despite my best efforts, I'm not getting the message to fire.

Don

NewsArchive
11-07-2010, 02:15 AM
Hi Donald,

> If RunCode() = 1
> If Message('There is a new version available for download. Do you want to
> install it now?','New version
> available',ICON:Exclamation,BUTTON:Yes+BUTTON:NO,B UTTON:Yes) = BUTTON:Yes

Check the value of the RunCode() after the Run():

Run(...)
Message('RunCode() = ' & RunCode())
If RunCode() = 1
End

WuCheck can return more than just 0 or 1 - see the wucheck.sb7 script for
more information about the codes it can return (I'm not sure if they are in
the help)

Best regards,

--
Arnór Baldvinsson - Icetips Alta LLC
Port Angeles, Washington
www.icetips.com - www.buildautomator.com - www.altawebworks.com

Icetips product subscriptions at http://www.icetips.com/subscribe.php

NewsArchive
11-07-2010, 02:15 AM
Hey Arnor,

I thought about this after I posted that last post. What about the waitflag
property in the run command?

Shouldn't it be there for RUNCODE to work?

Instead of RUN('wucheck.exe /S /C')

use

RUN('wucheck.exe /S /C',1)

What do you think?

Don

NewsArchive
11-07-2010, 02:16 AM
Don,

> Shouldn't it be there for RUNCODE to work?

Yes.

--
Lee White

RPM Report Viewer.: http://www.cwaddons.com/products/rpm/
RPM Review........: http://www.clarionmag.com/cmag/v11/v11n06rpm.html
Report Faxing.....: http://www.cwaddons.com/products/afe/
---Enroll Today---: http://CWaddons.com

Enhanced Reporting: http://www.cpcs-inc.com

NewsArchive
11-07-2010, 02:16 AM
Hi Donald,

> I thought about this after I posted that last post. What about the waitflag
> property in the run command?

Yes, absolutely! Sorry if I wasn't clear. I haven't used RUN() in years
and I'm getting a bit rusty;)

Best regards,

--
Arnór Baldvinsson - Icetips Alta LLC
Port Angeles, Washington
www.icetips.com - www.buildautomator.com - www.altawebworks.com

Icetips product subscriptions at http://www.icetips.com/subscribe.php

NewsArchive
11-07-2010, 02:17 AM
Hi Don,

> I thought about this after I posted that last post. What about the
> waitflag property in the run command?
>
> Shouldn't it be there for RUNCODE to work?
>
> Instead of RUN('wucheck.exe /S /C')
>
> use
>
> RUN('wucheck.exe /S /C',1)
>
> What do you think?

I also forgot that "waitflag" in my code snippet, sorry :-(

RUN('wucheck.exe /S /C', 1) is correct.

Friedrich

NewsArchive
11-08-2010, 12:27 AM
That's okay Arnor. Thanks a million for your help! You too Friedrich!

Donald Ridley

NewsArchive
11-08-2010, 12:28 AM
Friedrich,

> I also forgot that "waitflag" in my code snippet, sorry :-(

What? My simple "Yes" wasn't sufficient?!<g>

--
Lee White

RPM Report Viewer.: http://www.cwaddons.com/products/rpm/
RPM Review........: http://www.clarionmag.com/cmag/v11/v11n06rpm.html
Report Faxing.....: http://www.cwaddons.com/products/afe/
---Enroll Today---: http://CWaddons.com

Enhanced Reporting: http://www.cpcs-inc.com

NewsArchive
11-08-2010, 12:28 AM
LOL!!!

Thanks to both of you for your help!

Don

NewsArchive
11-10-2010, 12:31 AM
BTW Friedrich, it is working PERFECTLY now! THANK YOU for Setup Builder!

Don

NewsArchive
11-10-2010, 12:31 AM
>
> BTW Friedrich, it is working PERFECTLY now! THANK YOU for Setup Builder!
>

Thank you for the very good news, Don :)

Friedrich