Hi there,
I'm wondering if this is possible... I'm hoping to use this as part of a custom action within an InstallShield solution if so.
So at the moment I have the following vbscript which basically does 2 things for me...
The first part looks at a folder path on the network and then gets the most recent subfolder within it by checking DateLastModified, the folder name is then put into a variable called 'LastFolder'
The second part will look at a file called Setup.exe and get the ProductVersion from it, also put into a variable called 'ProductVersion'
Then it just echoes these variables so I can check if they are correct or not.
What I would like to know, is this:
"If the folder path was, say at a FTP location, so "\\servername\releases\example folder" was something like "ftp://usernameassword@ftp.example.com/example folder"
and I wanted the script to act in the same way, what do I need to change in the example below to make it function correctly?"
I've been searching the internet today just trying to find some simple examples of how I might even begin, but I haven't had much luck and I'm not the greatest when it comes to creating these sorts of scripts, so I thought I might ask here to see if anyone could help at all.
Thank you.
Paul
'First section gets the most recent subfolder (last modified) from the Releases folder
Set fs = CreateObject("Scripting.FileSystemObject")
Set MainFolder = fs.GetFolder("\\servername\releases\product name")
For Each fldr In MainFolder.SubFolders
''As per comment
If fldr.DateLastModified > LastDate Or IsEmpty(LastDate) Then
LastFolder = fldr.Name
LastDate = fldr.DateLastModified
End If
Next
'Second section gets the product version information from Setup.exe
strPath = ""+MainFolder+"\"+LastFolder+""
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(strPath)
Dim arrHeaders(301)
For i = 0 to 300
arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i)
Next
For Each strFName in objFolder.Items
If strFName = "Setup.exe" Then
For i = 0 to 300
If LCase(arrHeaders(i)) = "product version" Then ProductVersion = objFolder.GetDetailsOf(strFName, i)
Next
End If
Next
'Sets the MSI properties to be used in the LaunchNewerSetup custom action
'session.property("PRODUCT_VERSION") = ProductVersion
'session.property("SETUP_PATH") = strPath
WScript.Echo strPath
WScript.Echo ProductVersion
I'm wondering if this is possible... I'm hoping to use this as part of a custom action within an InstallShield solution if so.
So at the moment I have the following vbscript which basically does 2 things for me...
The first part looks at a folder path on the network and then gets the most recent subfolder within it by checking DateLastModified, the folder name is then put into a variable called 'LastFolder'
The second part will look at a file called Setup.exe and get the ProductVersion from it, also put into a variable called 'ProductVersion'
Then it just echoes these variables so I can check if they are correct or not.
What I would like to know, is this:
"If the folder path was, say at a FTP location, so "\\servername\releases\example folder" was something like "ftp://usernameassword@ftp.example.com/example folder"
and I wanted the script to act in the same way, what do I need to change in the example below to make it function correctly?"
I've been searching the internet today just trying to find some simple examples of how I might even begin, but I haven't had much luck and I'm not the greatest when it comes to creating these sorts of scripts, so I thought I might ask here to see if anyone could help at all.
Thank you.
Paul
'First section gets the most recent subfolder (last modified) from the Releases folder
Set fs = CreateObject("Scripting.FileSystemObject")
Set MainFolder = fs.GetFolder("\\servername\releases\product name")
For Each fldr In MainFolder.SubFolders
''As per comment
If fldr.DateLastModified > LastDate Or IsEmpty(LastDate) Then
LastFolder = fldr.Name
LastDate = fldr.DateLastModified
End If
Next
'Second section gets the product version information from Setup.exe
strPath = ""+MainFolder+"\"+LastFolder+""
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(strPath)
Dim arrHeaders(301)
For i = 0 to 300
arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i)
Next
For Each strFName in objFolder.Items
If strFName = "Setup.exe" Then
For i = 0 to 300
If LCase(arrHeaders(i)) = "product version" Then ProductVersion = objFolder.GetDetailsOf(strFName, i)
Next
End If
Next
'Sets the MSI properties to be used in the LaunchNewerSetup custom action
'session.property("PRODUCT_VERSION") = ProductVersion
'session.property("SETUP_PATH") = strPath
WScript.Echo strPath
WScript.Echo ProductVersion