Jump to content

Recommended Posts

Posted

Hello, I looked around but could not find an answer to this, it may be that its too simple. But I am trying to create an executable from a simple 10 line batch file.

When I use autoit to do it I get the  attached error.

Any Ideas?

Thanks 

Joe

Capture.JPG

  • Moderators
Posted

joesedroid,

Welcome to the AutoIt forums.

You cannot use AutoIt to convert a batch file to an executable - the file to convert needs to be a working AutoIt script.  But you can probably get AutoIt to do whatever the batch file does - and then you will be able to make an executable. So I suggest you post the batch file (see here how to do it) and then we can see how you might proceed.

M23

 

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted
slmgr.vbs /ipk xxxx-xxxx-xxxx-xxxx-xxx-xxxx

slmgr.vbs /skms Server.org.location

slmgr.vbs /ato

cd "c:\program files (x86)\Microsoft Office\Office14"

cscript ospp.vbs /sethst:Server.org.location

cscript ospp.vbs /act

slmgr.vbs /dli

cscript ospp.vbs/dhistorykms

=============================

Excellent, thanks for getting back to me, I am just trying to activate licenses for office.

Hope this works.

Posted

Welcome to Autoit and the forum!

What do you want to do with the output of slmgr.vbs etc? Retrieve the output and check for errors?
If I start it from the command line I get a MsgBox.

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted
RunWait(@ComSpec & " /c "&"slmgr.vbs /ipk xxxx-xxxx-xxxx-xxxx-xxx-xxxx","",@SW_HIDE)
RunWait(@ComSpec & " /c "&"slmgr.vbs /skms Server.org.location","",@SW_HIDE)
RunWait(@ComSpec & " /c "&"slmgr.vbs /ato","",@SW_HIDE)
RunWait(@ComSpec & " /c "&"cscript ospp.vbs /sethst:Server.org.location","c:\program files (x86)\Microsoft Office\Office14",@SW_HIDE)
RunWait(@ComSpec & " /c "&"cscript ospp.vbs /act","c:\program files (x86)\Microsoft Office\Office14",@SW_HIDE)
RunWait(@ComSpec & " /c "&"slmgr.vbs /dli","c:\program files (x86)\Microsoft Office\Office14",@SW_HIDE)
RunWait(@ComSpec & " /c "&"cscript ospp.vbs/dhistorykms","c:\program files (x86)\Microsoft Office\Office14",@SW_HIDE)

 

Regards,
 

Posted
  On 11/13/2015 at 3:49 PM, Trong said:
 

slmgr.vbs (Windows7/2008)

Software Licensing Management Tool.

This just allows us to point to the KMS key and authenticate it with our KMS server/Microsoft and activate it.

The only output we want to see is if it was successful. I tried to use Trongs command but am unsure where to do it. I made it a .txt file and an .au3, says it compiles successfully but nothing happens when I run it.

Thanks again for your help.

 

  On 11/13/2015 at 3:49 PM, Trong said:
RunWait(@ComSpec & " /c "&"slmgr.vbs /ipk xxxx-xxxx-xxxx-xxxx-xxx-xxxx","",@SW_HIDE)
RunWait(@ComSpec & " /c "&"slmgr.vbs /skms Server.org.location","",@SW_HIDE)
RunWait(@ComSpec & " /c "&"slmgr.vbs /ato","",@SW_HIDE)
RunWait(@ComSpec & " /c "&"cscript ospp.vbs /sethst:Server.org.location","c:\program files (x86)\Microsoft Office\Office14",@SW_HIDE)
RunWait(@ComSpec & " /c "&"cscript ospp.vbs /act","c:\program files (x86)\Microsoft Office\Office14",@SW_HIDE)
RunWait(@ComSpec & " /c "&"slmgr.vbs /dli","c:\program files (x86)\Microsoft Office\Office14",@SW_HIDE)
RunWait(@ComSpec & " /c "&"cscript ospp.vbs/dhistorykms","c:\program files (x86)\Microsoft Office\Office14",@SW_HIDE)

 

Posted

Nothing happens because the scripts are being run hidden (caused by @SW_HIDE).

Option "/dli" displays the license information. What do you want to do with this information?

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted
  On 11/16/2015 at 1:54 PM, joesedroid said:

That makes sense however when I run the .exe it creates, I see a paused script in the task bar by the clock and its got a flashing X. Do you think im doing something wrong with it? All im really doing is copying the text to a .au3 file and making it a .exe

I have about 4 or 5 similar scripts I want to run silently in my environment and I have not used this product before. All i need is for these batch files to be executables. I guess I don't need the full functionality of AutoIT but it seems like it would be a great product to learn and use. 

 

 

Posted

The flashing "X" in the taskbar simply means that you paused the script by clicking on the icon. Unselect the "Script Paused" selection in the context menu and you are fine.
If needed you can suppress the taskbar icon.

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

Ok but when I run it in the SciTE editor i get this...

>Running:(3.3.15.0):C:\Program Files (x86)\AutoIt3\Beta\autoit3.exe "C:\Activations\autoit\test.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop

>Process failed to respond; forcing abrupt termination...
>Exit code: 1    Time: 8.876

Can you direct me to some good training on this? Like I said this is my 1st attempt at this kind of scripting.

Thanks

Posted

Did you press Ctrl+Break to stop execution?

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted (edited)

That is to be expected:
Seems to be the normal message when  you kill a script using Ctrl+Break.

Edited by water

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted (edited)

Ok, I think I got this now... its mostly working however Im not sure how to path to my office folder, right now I have...

RunWait(@ComSpec & " /c "&"cd c:\program files (x86)\Microsoft Office\Office14","",@SW_HIDE)
RunWait(@ComSpec & " /c "&"cscript ospp.vbs /inpkey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX","",@SW_HIDE)
RunWait(@ComSpec & " /c "&"cscript ospp.vbs /act","",@SW_HIDE)
RunWait(@ComSpec & " /c "&"slmgr.vbs /dli","",@SW_HIDE)

And it is saying path not found or script not found (its going to fast to read). Do I need to have this script all on one line?

EDIT: After taking a screen shot its pathing to my local profile to run these scripts I.E.

           Input error: Cannot find Script file "C:\Users\admin\desktop\ospp.vbs"

Looks like its not pointing to the c:\program files (x86)\Microsoft Office\Office14"

Again, thanks for all your help, I believe this is the last part of my script.

Edited by joesedroid
  • Developers
Posted (edited)

try:

FileChangeDir("c:\program files (x86)\Microsoft Office\Office14")
RunWait(@ComSpec & " /c cscript ospp.vbs /inpkey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX","",@SW_HIDE)
RunWait(@ComSpec & " /c cscript ospp.vbs /act","",@SW_HIDE)
RunWait(@ComSpec & " /c slmgr.vbs /dli","",@SW_HIDE)

... and change the /c to /k in case of issues with one of the commands.

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

Thanks, that seemed fix some if it, two questions though.

1) What does the /c /k do?

2) When I run this I get a Windows popup showing that ive activated the key AND the key number. id like to not show that. I guessing thats something in the windows OS. Is there a way to not show it?

Thanks!

  • Developers
Posted

1) each dos command has a help function so this is easily figure out by yourself. As a one time favor:

  Quote

C:\>cmd /?
Starts a new instance of the Windows command interpreter

CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF]
    [ [/C | /K] string]

/C      Carries out the command specified by string and then terminates
/K      Carries out the command specified by string but remains

2) there is a helpfile that comes with AutoIt3, have you looked at the options for RunWait. As it was a one time favor , no additional pointer are provided here. ;)

Jos

 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

I guess I asked the wrong question. When this script runs it put up the Key in a window that is waiting for an OK. I tried 

SW_HIDE

SW_DISABLE

Send (enter) key

Is this window something that will need to be manually clicked?

Thanks

Joe

  • Developers
Posted

Ah ok:
there is probably not much you can do to avoid it poping up unless the program supports a alternative to provide the key.
You could monitor and hide it asap and then fill in the key with ControlSend().

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

:sweating:

Run(@ComSpec & ' /k cd\&&cls ', "", @SW_SHOWMAXIMIZED)
    Local $hWnd = WinWait("[CLASS:cmd]", "", 2)
    WinActivate($hWnd)
    Send('cd "c:\program files (x86)\Microsoft Office\Office14"'& "{Enter}")
    Sleep(500)
    Send('cscript ospp.vbs /inpkey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX'& "{Enter}")
    Sleep(500)
    Send('cscript ospp.vbs /act'& "{Enter}")
    Sleep(500)
    Send('slmgr.vbs /dli'& "{Enter}")
    Sleep(500)
    Send("Exit{Enter}")

 

Regards,
 

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
  • Recently Browsing   0 members

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