Jump to content
Sign in to follow this  
ur

How to log info with Installshield

Recommended Posts

I have written a script to build the Installshield project file(.ism) to setup files(.msi or .exe based on the release settings..).

So when the user runs the script the process will be automatic for multiple ism files.

Func Build($sOutputIsm,$ReleaseName,$sFilePath="None",$NewName="None")  ;build the ism to get the msi

    If not FileExists($sOutputIsm) Then
        Logging("File Not Found: $sOutputIsm$",4)
        MsgBox($MB_OK + $MB_ICONERROR, "Error", "Could not find file ""$sOutputIsm$"".")
        Return
    EndIf
    Logging("Started Building $sOutputIsm$",4)
    ShowTrayTip($AppName, "Started Building $sOutputIsm$", 10, $TIP_ICONASTERISK)
    Dim $sBuildExe,$sBuildCommand,$Ret
    $sBuildExe = FindFileInPath("ISCmdBld.exe", "%ProgramFiles(x86)%\InstallShield")
    $sBuildCommand = """$sBuildExe$"" -p ""$sOutputIsm$"" -r ""$ReleaseName$"" -s"
    ;MsgBox(0,"",$sBuildCommand)
    $Ret = RunWait($sBuildCommand)
    If $Ret <> 0 Then
        ShowTrayTip($AppName,"ISM Build Failed, Please build the ISM Manually.",10, $TIP_ICONHAND)
        MsgBox($MB_OK + $MB_ICONERROR, "Error", "Could not build ""$sOutputIsm$"". Please build manually.")
        Logging("Error $Ret$ while Building $sOutputIsm$",4)
        Return;Exit(1)
    Else
        ShowTrayTip($AppName,"ISM Build Completed",10, $TIP_ICONASTERISK)
        Logging("Completed Building $sOutputIsm$",4)
        if not StringCompare($NewName, "None")=0 then MoveEXE($sFilePath,$NewName)
    EndIf
EndFunc

The problem is when we run the ISCmdBuild.exe the RunWait will give whether fail or success but not what are the errors we got.
If we use Run, it will give that logging but we don't have the feature of getting fail/success as RunWait.

If we run the above code by removing -s and using redirection operator > to a file, it is running manually but failing with autoit.

Like
 

$sBuildCommand = """$sBuildExe$"" -p ""$sOutputIsm$"" -r ""$ReleaseName$"" > c:\logs\uday.log"

Any help on this??

 

And also, in some machines the installshield shortcut is launching fine as licensed version but with ISCmdBld.exe it is giving error as licensing info missing or not registered.

 

Any suggestion on this too??

Share this post


Link to post
Share on other sites

If you want to capture both the Exit Code and the Console Output, you would have to do some tricky things. Luckily I have made a UDF for that ;), Try my Process UDF :D.


A cross-platform implementation of the AutoIt language

My contributions to the AutoIt Community ##AutoIt at freenode, real-time chat

3fHNZJ.gif

Spoiler

If I have hurt or offended you in anyway, Please accept my apologies, I never (regardless of the situation) intend to do that to anybody.

Share this post


Link to post
Share on other sites
3 hours ago, TheDcoder said:

If you want to capture both the Exit Code and the Console Output, you would have to do some tricky things. Luckily I have made a UDF for that ;), Try my Process UDF :D.

Thank you very much TheDcoder....

Share this post


Link to post
Share on other sites
22 minutes ago, TheDcoder said:

My pleasure @ur :thumbsup:

Any suggestion for the second issue mentioned too.

In some machines the installshield shortcut is launching fine as licensed version but with ISCmdBld.exe it is giving error as licensing info missing or not registered.

Share this post


Link to post
Share on other sites
31 minutes ago, ur said:

In some machines the installshield shortcut is launching fine as licensed version but with ISCmdBld.exe it is giving error as licensing info missing or not registered.

Hmm... I can't help you with such issue as I don't use InstallShield. Try contacting InstallShield support regarding this issue.


A cross-platform implementation of the AutoIt language

My contributions to the AutoIt Community ##AutoIt at freenode, real-time chat

3fHNZJ.gif

Spoiler

If I have hurt or offended you in anyway, Please accept my apologies, I never (regardless of the situation) intend to do that to anybody.

Share this post


Link to post
Share on other sites

Hi @TheDcoder

I have been using the method mentioned by you to log the info and also to track the error code.It is working fine.

 

But it is logging the output at the end of the process execution.

Whereas now a days, the installshield building is taking around 2 hours and even more and it is failing at the end.

Could you please suggest anything so that it would write the log data since the start of process instead of making it available only at the end.As the command line output of installshield is available form the execution start itself.

Share this post


Link to post
Share on other sites
On 26/9/2016 at 4:22 PM, ur said:

Could you please suggest anything so that it would write the log data since the start of process instead of making it available only at the end.As the command line output of installshield is available form the execution start itself.

There are 2 ways you can use my UDF. The 1st is the simplest which returns the Exit Code + Output at the end, The 2nd one is more hard to do but with it you will be able to get the output from the start of the process!

The 2nd method is demonstrated in the example script, its the part where you see live output from tracert google.com :), you can study the code and check the documentation for more information :D.


A cross-platform implementation of the AutoIt language

My contributions to the AutoIt Community ##AutoIt at freenode, real-time chat

3fHNZJ.gif

Spoiler

If I have hurt or offended you in anyway, Please accept my apologies, I never (regardless of the situation) intend to do that to anybody.

Share this post


Link to post
Share on other sites

But I didn't get documentation there.Generally where can I check any existing UDF repositories and its use and documentation?

Edited by ur

Share this post


Link to post
Share on other sites
4 hours ago, ur said:

Generally where can I check any existing UDF repositories and its use and documentation?

There is no repository for UDFs, you have to just download the .au3 scripts from the web and read them in SciTE, that's the only way :D


A cross-platform implementation of the AutoIt language

My contributions to the AutoIt Community ##AutoIt at freenode, real-time chat

3fHNZJ.gif

Spoiler

If I have hurt or offended you in anyway, Please accept my apologies, I never (regardless of the situation) intend to do that to anybody.

Share this post


Link to post
Share on other sites
1 hour ago, TheDcoder said:

There is no repository for UDFs, you have to just download the .au3 scripts from the web and read them in SciTE, that's the only way :D

That's the normal case, just reading function headers. Best case are demostrated by:

and i'm sure there are some more well documented udfs available.

Share this post


Link to post
Share on other sites
On 9/28/2016 at 2:27 PM, TheDcoder said:

There are 2 ways you can use my UDF. The 1st is the simplest which returns the Exit Code + Output at the end, The 2nd one is more hard to do but with it you will be able to get the output from the start of the process!

The 2nd method is demonstrated in the example script, its the part where you see live output from tracert google.com :), you can study the code and check the documentation for more information :D.

The second method is displaying the output on a window.

Is there any way to redirect the output to a file during the execution instead of end of execution.

Share this post


Link to post
Share on other sites
6 hours ago, ur said:

Is there any way to redirect the output to a file during the execution instead of end of execution.

Yes, just look at my code which redirects the output to the GUI. This part (highlighted) is what you need to study and understand ;).

Edited by TheDcoder

A cross-platform implementation of the AutoIt language

My contributions to the AutoIt Community ##AutoIt at freenode, real-time chat

3fHNZJ.gif

Spoiler

If I have hurt or offended you in anyway, Please accept my apologies, I never (regardless of the situation) intend to do that to anybody.

Share this post


Link to post
Share on other sites

Yeah got that...thanks TheDcoder.

Added this function in the UDF file for this purpose.

 

Func Logging($sMessage,$sLogFile=@TempDir&"\Logging_Runtime.log")
    FileWrite($sLogFile,$sMessage&@CRLF)
EndFunc

Func _Process_DebugLogRunCommand($hProcessHandle, $iPID)

    Local $sOutput = "", $sPartialOutput = "" ; Declare the output variable
    While ProcessExists($iPID) ; Loop until the process finishes
        $sPartialOutput = StdoutRead($iPID) ; Record the output
        ;$sOutput &= $sPartialOutput
        Logging($sPartialOutput)
        Sleep(1000) ; Don't kill the CPU
    WEnd
    $sPartialOutput = StdoutRead($iPID) ; Record the output
    Logging($sPartialOutput)
    ;$sOutput &= $sPartialOutput
    Local $iExitCode = _Process_GetExitCode($hProcessHandle)
    Logging(@CRLF & @CRLF & "Debug Complete! The Exit Code was: " & $iExitCode) ; Display the exit code
    Return $iExitCode
    ;Return SetExtended($iExitCode, $sOutput) ; Return True
EndFunc

 

Share this post


Link to post
Share on other sites

That was a very quick adoption of my code @ur :D.


A cross-platform implementation of the AutoIt language

My contributions to the AutoIt Community ##AutoIt at freenode, real-time chat

3fHNZJ.gif

Spoiler

If I have hurt or offended you in anyway, Please accept my apologies, I never (regardless of the situation) intend to do that to anybody.

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By WoodGrain
      Hi All,
      Trying to open windows explorer to a WebDav location and it's not working quite how I want, on the computers it is setup as a "network location" (as opposed to a "mapped drive", and this unfortunately can't be changed), the "Data" WebDav folder sits directly under "This PC" if that's an easier way to get to it. any suggestions as to what I can correct to get the 2nd example to work?
      ; This works, but I'm trying to avoid this as users normally see the URL style in the 2nd example below $folderToOpen = "\\mycompany.sharepoint.com@SSL\DavWWWRoot\Data" Run("Explorer.exe " & $folderToOpen) ; This does not work, it tries to open the WebDav url in the default web browser $folderToOpen = "https://mycompany.sharepoint.com/Data" Run("Explorer.exe " & $folderToOpen) ShellExecute also opens it in the default browser.
      Saw _WinAPI_ShellOpenFolderAndSelectItems but couldn't get the 2nd example to work.
      If I manually open Windows Explorer and paste in https://mycompany.sharepoint.com/Data it loads the WebDav directory without issue.
      If I have to use the pathing from the first example it is fine, just trying to give users a familiar experience.
      Thanks!
    • By nacerbaaziz
      hello autoit team
      is there any wey to check if any process run as admin or no?
      i mean e.g if i want to restart any process, now i have the ability to get the process path and commands line
      what i need is a wey to check if the process was runing as admin or no to restart it with the same state.
      here is the part that am using it to restart the process
      func _processRestart($i_pid, $s_ProcessPath) if not (ProcessExists($i_ProcessPid)) then return SetError(1, 0, -1) local $s_ProcessWorkDir = _WinAPI_GetProcessWorkingDirectory($i_ProcessPid) ProcessClose($i_ProcessPid) ProcessWaitClose($i_ProcessPid) ProcessWait(ShellExecute($i_pid,"", $s_ProcessWorkDir)) ProcessesGetList() return true endFunc thanks in advance
    • By lonardd
      Hi
      I have to run an executable with a parameter preceded by a /, like this:
      c:\myfolder\Tools\AutomaticRun\myexe.EXE /filename=c:\myfolder\Tools\AutomaticRun\myTemplate.xml")
      I tried both this:
      $iReturn = RunWait ("c:\myfolder\Tools\AutomaticRun\myexe.EXE"," /filename=c:\myfolder\Tools\AutomaticRun\myTemplate.xml")
      and using COMSPEC as per some posted suggestions on this forum:
      Run(@comspec & ' /c "c:\myfolder\Tools\AutomaticRun\myexe.EXE" /filename=c:\myfolder\Tools\AutomaticRun\myTemplate.xml')
      They both seem to fail.
      Can you please tell me what I'm doing wrong?
      Thanks
      Dave
       
    • By AnonymousX
      So I just got a new computer, and instantly went and installed Autoit onto it. I selected run script as default action when clicking on an au3 file, however every time I do this it opens the script in the editor. I can from there run the script no problem.
      I've tried reinstalling and checking the settings by hitting "Ctrl+1" and have confirmed it is set to run, but yet it just continues to open in the editor.
      Any ideas why this is happening or how to solve?
      New system is windows 10, old was windows 7
    • By HariKara
      Hi AutoIters!
       
      Im trying to launch a .exe file that is nested within the program files (x86) folder structure. i have already used the standard RunAs Syntax and found that it fails to launch the application. I have switched to Run and that seems to work. My issue is I have to use RunAs as the applicaton would need to run under a completely different account. The Current logged in user is a Local User on the machine, however, the application must be run as a domain user. The Machine is domain connected.
       
       have tried the following:
      RunAs("username","logonpassword", $RUN_LOGON_PROFILE, "D:\Program Files (x86)\Vendor\Application Name\Exe Location\Executable.exe") The above fails to launch, there are no errors or syntax issues, it just does nothing when the variables are replaced for the correct values.
      I did the same using the Run command
      Run("D:\Program Files (x86)\Vendor\Application Name\Exe Location\Executable.exe") That seems to work fine, but runs in local user context. Any thoughts? Could it be a local Machine rights issue? Or have i missed something glaring in my script
×
×
  • Create New...