Sign in to follow this  
Followers 0
buzzbomb

Check File Version, Then Upgrade

13 posts in this topic

Hi, guys - my name is Kirk, I'm a new user from Atlanta, GA. I've always been a batch file guy, and the ones I write have gotten to where they're typically six or seven pages, and extremely complicated. I think, though, that I've finally hit the limitations of the DOS batch scripts, and I'm helping Auto IT can help me. Let me describe what I'm trying to do this time:

Basically we have many older versions of the Cisco Systems VPN client. I started off writing a batch file that would look at the version, uninstall it if it wasn't the newest one, then install our new one. It seems pretty simple and it's something I've done hundreds of times. What's getting me this time, though, is that the version information isn't located anywhere in the registry for this software. You can see it if you right click the actual executable itself. Well, even the filever.exe that Microsoft has won't work in telling me the file version, so I'm kind of stuck it seems.

Has anyone here done something like this? Is this something that Auto IT can do? And most importantly, could someone give me some pointers in the right direction, and perhaps an example script I could modify to get me on my way?

Thanks, folks.

Share this post


Link to post
Share on other sites

Hi and Welcome to the forums!

Have you tried FileGetVersion()?

All functions are explained and have examples in the helpfile, so just use that and you'll be fine.

Here's a list of tutorials you can try to learn the language.

Share this post


Link to post
Share on other sites

I'll be real honest - so far I haven't even figured out what program I am supposed to run to run the actual Auto IT program! I've just been right-clicking some scripts and clicking "edit" to see whats going on.

I'll mess around some more and see what I can see here. Thanks for that, though.

Hi and Welcome to the forums!

Have you tried FileGetVersion()?

All functions are explained and have examples in the helpfile, so just use that and you'll be fine.

Here's a list of tutorials you can try to learn the language.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Anyone know why this keeps erroring out?

$ver = FileGetVersion ( "C:\Program Files\Cisco Systems\VPN Client\ipsecdialer.exe" [,"FileVersion"] )

MsgBox(0, "VPN Version", $ver)

It seems to be erroring out on the [,"FileVersion"] part.

Edit - nevermind, I deleted the brackets and it worked great. Sorry!

I'll be real honest - so far I haven't even figured out what program I am supposed to run to run the actual Auto IT program! I've just been right-clicking some scripts and clicking "edit" to see whats going on.

I'll mess around some more and see what I can see here. Thanks for that, though.

Edited by buzzbomb

Share this post


Link to post
Share on other sites

I'd suggest a rather "brute force" approach which you should make to work in all cases.

Make a MD5 of the main executable you whish to see installed everywhere and compare to known latest version MD5. Anything different is either an obsolete version, a hack, a trojan or a new unsupported version! Of course you may have to differentiate x86 and x64.

It might reveal more robust than trying to find version information on old software, where the way to access that version info or its format may have changed over time.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

Im using this, maybe something you can use :mellow:

Func Update()

        GUISetState(@SW_DISABLE, $Form1)

    $AboutGUI = GUICreate("Update", 260, 79)
                $Download = GUICtrlCreateButton("Download", 130, 50, 72, 25, $WS_GROUP)
                $OK = GUICtrlCreateButton("Ok", 203, 50, 50, 25, $WS_GROUP)
                GUICtrlCreateLabel("Hero OnLine All In One", 79, 12, 140, 17)
                GUICtrlCreateLabel("Your Version: 0.11.11.3", 79, 27, 140, 17)
                $donate = GUICtrlCreateButton("", 24, 128, 89, 33, BitOR($BS_BITMAP,$WS_GROUP))
                GUICtrlCreatePic("files/top.BMP", 13, 11, 57, 57, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))



    GUISetState()
    While 1
        Switch GUIGetMsg()
        Case -3
            GUIDelete($AboutGUI)
            GUISetState(@SW_ENABLE, $Form1)
            GUISetState(@SW_RESTORE, $Form1)
            ExitLoop

        Case $OK
            GUIDelete($AboutGUI)
            GUISetState(@SW_ENABLE, $Form1)
            GUISetState(@SW_RESTORE, $Form1)
            ExitLoop

        Case $Download

$FileURL = "WEBSITE WHERE TO DOWNLOAD"
$FileName = "Hero OnLine All In One.exe"
$FileSaveLocation = FileSaveDialog("Save Location",@ScriptDir,"All (*.*)",18,$FileName)
$FileSize = InetGetSize($FileURL)

InetGet($FileURL,$FileName,0,1)

ProgressOn("","")
While @InetGetActive
    $Percentage = @InetGetBytesRead * 100 / $FileSize
    ProgressSet($Percentage,"Downloaded " & @InetGetBytesRead & " of " & $FileSize & " bytes","Downloading " & $FileName)
    Sleep(250)
Wend
ProgressOff()

MsgBox(0, "Done","Download Complete!")
        EndSwitch
    WEnd
EndFunc

Share this post


Link to post
Share on other sites

G'day buzzbomb

You maybe interested in my "Adobe Reader" update program. It checks the version of the installed program against either a value you hard code or the version of the installer (IF the installer has the same version as the program that is being installed).

Take a look and let me know what you think.

http://www.autoitscript.com/forum/index.php?showtopic=114184

Have fun

John Morrison

AKA

Storm-E

Share this post


Link to post
Share on other sites

Thank you guys SO much for all the help so far. I've come light years in the last week with my knowledge of AutoIT. But here's a really simple, yet stupid question I have:

OK, I come from a batch file background. I can batch file circles around the batchinest batcher ever to batch. But how the heck do I run an executable from AutoIT?

For example - I have a file (an MSI in this case) that I will need to run on these machines if they meet my criteria. How do I have that file copy locally to their machine, then have that MSI ran if their machine meets the criteria?

I know thats probably a really dumb question, but I cant seem to find anything in the help about that. So... help!

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Typically, while in a testing environment, I execute the .au3 source from within the SciTE editor by pressing "F5". Once I have the script ready to send out into the big wide world, I right-click the source in Windows Explorer and select a compile option from the context menu. All the run-time goodies get packaged in and you end up with a stand-alone .exe file.

There are also entries in the SciTE "tools" menu that accomplish the same thing, as well as related hotkeys other than F5.

Pardon, maybe I'm answering the wrong question...

Read the hellfile about Run() and Runas() and (my personal favorite) ShellExecute().

Edited by Spiff59

Share this post


Link to post
Share on other sites

I just now pressed F5, which just runs the script. I was probably unclear in my last post, sorry.

I have an MSI that I want to run to install a program. That is part of the whole thing I am trying to do here. How do I run an external EXE or MSI or something from AutoIT? Also, you have me thinking from your post that maybe there's a way to zip up that MSI inside of the executable here?

Share this post


Link to post
Share on other sites

You can do both, so the choice is yours.

You can Run(), RunAs(), RunWait(), RunAsWait() an executable (lookup helpfile).

For registered types, you can ShellExecute() and let the system determine how it should deal with what you gave as parameter (see helpfile as well).

You can FileInstall() [see helpfile again] any kind of file in your AutoIt compiled script as well, and drop it where you need (temporary directory of whatever) and do what you need with it.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

Is there a way to "zip" the file I want to execute into the .exe I create when I finish this script? So that basically there is only one file?

You can do both, so the choice is yours.

You can Run(), RunAs(), RunWait(), RunAsWait() an executable (lookup helpfile).

For registered types, you can ShellExecute() and let the system determine how it should deal with what you gave as parameter (see helpfile as well).

You can FileInstall() [see helpfile again] any kind of file in your AutoIt compiled script as well, and drop it where you need (temporary directory of whatever) and do what you need with it.

Share this post


Link to post
Share on other sites

Of course FileInstall doesn't give a dam to what the file is, how it is encoded, packed ot whatever. It's just a string of bytes for it.

So yes you can pack, zip, 7z, whatever your file(s) but understand that it won't unpack, unzip, un7z, unrar by itself. You need to select a self-extracting format, or rely on the presence of an extractor on the target machine(s), or FileInstall a suitable extractor as well, or include a suitable UDF to extract under your AutoIt script control.

Maybe it's possible to use the compacter/decompactor that comes along with AutoIt executables, but I'm unsure if it can work on FileInstalled files as well. That might be the easiest way if it works.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0