Jump to content

Converting WScript to AutoIt


Recommended Posts

I am trying to convert a js script into auto it code to implement in a program I am trying to update. The script runs OK when called from AutoIt but I need to alter some exes and command line parameters for it to work smoothly.

I have tried to convert it to AutoIt with a script I found on here but there are a few errors and I know nothing about the script language. I have looked at the js script and I cannot understand it to try to convert it. Is there a program or script someone knows of that I could use or would someone be able to spare the time to have a look at it?. I know it is a lot to ask and this forum is a help not a do forum but I have tried to understand but it gives me a headache :)

The code is below for both the js file and the convert au3 script. I have used code box because they are a bit long.

Sort2Cabs.au3

 

Edit: Removed code - post too big and crashing the forum upgrade.

Link to comment
Share on other sites

Hi,

Looks like a lot of hard work and it is nowhere near done; i think you would be better re-writing it from scratch, but then you would need to know its mechanism better.

I suggest you

1. read the script as a file into variable.

2. stringreplace the directories or whatever you need to change

3. write new script file and run that.

Best, Randall

Link to comment
Share on other sites

Hi,

Looks like a lot of hard work and it is nowhere near done; i think you would be better re-writing it from scratch, but then you would need to know its mechanism better.

I suggest you

1. read the script as a file into variable.

2. stringreplace the directories or whatever you need to change

3. write new script file and run that.

Best, Randall

Thanks Randall, that's a good idea, up to yet there are two things that I will need to change

1. Update_msi_tables.exe (AutoIt), this opens orca, and presses the keys to import the tables back to the MSI files. I have since found MsiDb.Exe and this can do it silently.

2. Add the command line parameters for MsiDb.exe, so I will need to change this aRun = "Update_msi_tables.exe" to aRun = "MsiDb.Exe" but how do you add command line parameters to the script?. This is the line I think needs changing

oExec = wsh.Exec(aRun)

and I need to add something like this

-i -dC:\Office2k3\VISPRO.MSI -fC:\Office2k3\Sort\VisPro *new*.idt

would this be right?.

oExec = wsh.Exec(aRun + " -i -dC:\\Office2k3\\VISPRO.MSI -fC:\\Office2k3\\Sort\\VisPro *new*.idt")
Edited by benners
Link to comment
Share on other sites

@benners

Maybe this MSI Editor can help you out.

regards

ptrex

@ptrex

Thanks I will look at the script. I ran it quickly and got an error w.r.t deleting listview items. Line 479 needs changing from

_GUICtrlListView_DeleteAllItems ($listview)
to
_GUICtrlListView_DeleteAllItems (GUICtrlGetHandle($listview))

What the sort2cabs script does is silently recompiles files in cabs and edits the tables to reflect new and updated files, it is for a program that integrates service packs and hotfixes into an Office source then instead of having the files uncompressed it recabs them and deletes the uncompressed files, this saves space on the media.

I am a bit busy with the program script but will look when I get to the point that needs the code, can your script be altered to work in a similar way to the js file or does it require a GUI?.

Thanks

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...