Jump to content

Noob at this


Recommended Posts

I am trying to click a button in a program that launches. This is an old program that will only alow input after it has been focused and clicked on. I don't know how to program in this at all I have just started learing to program. Can anyone give me some help and write some code to get this done if it can be done at all?

Thanks in advance

Jon

Link to comment
Share on other sites

are you saying winactivate does not give focus to the program?

PS: most ppl on this forum would be glad to help you if u show some of the things you have tried.

<package>

<job id="vbs">

<script language="VBScript">

set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.Run "C:\3apps\Catapult\3spmif.exe -start"

WScript.Sleep 100

WshShell.AppActivate "C:\3apps\Catapult\3spmif.exe"

WScript.Sleep 500

WshShell.SendKeys "(%{TAB})"

WScript.Sleep 500

WshShell.SendKeys "(%{TAB})"

WScript.Sleep 500

WshShell.SendKeys "{RIGHT}"

WScript.Sleep 100

WshShell.SendKeys "%"

WScript.Sleep 100

</script>

</job>

</package>

This is all the farther I have got. I got this off of microsofts website. The problem is that the program that I am trying to do this with will not alow any input into it until you click within the window. If I could simulate a click in the window that this opens in I could get it to run the program.

Link to comment
Share on other sites

Help File>Functions>Windows

and

Help File>Functions>Windows>Control

Or follow the on-line link in my sig for the same info

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

.... <script language="VBScript">

set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.Run "C:\3apps\Catapult\3spmif.exe -start"

WScript.Sleep 100 .....

This is all the farther I have got. I got this off of microsofts website. The problem is that the program that I am trying to do this with will not alow any input into it until you click within the window. If I could simulate a click in the window that this opens in I could get it to run the program.

Though I could be wrong, I don't think you're using the correct au3 commands to control your 3spmif.exe program. For example your "WshShell.Run 'C:\3apps\Catapult\3spmif.exe -start'" in au3 would be "Run('C:\3apps\Catapult\#spif.exe -start') and "WScript.Sleep 100" in au3 would be "Sleep(100)".

I'm still pretty new at this stuff too, but three tools I couldn't live without are help file, au3recorder, and au3info. Not to mention this forum. I'm sure once you start using the correct syntax and commands you'll be amazed how great au3 is.

Good luck!

Link to comment
Share on other sites

Though I could be wrong, I don't think you're using the correct au3 commands to control your 3spmif.exe program. For example your "WshShell.Run 'C:\3apps\Catapult\3spmif.exe -start'" in au3 would be "Run('C:\3apps\Catapult\#spif.exe -start') and "WScript.Sleep 100" in au3 would be "Sleep(100)".

I'm still pretty new at this stuff too, but three tools I couldn't live without are help file, au3recorder, and au3info. Not to mention this forum. I'm sure once you start using the correct syntax and commands you'll be amazed how great au3 is.

Good luck!

I tried running this in VB first and found out that the program didn't work without a click I have been searching for a alternate and found this program.

Thanks,

Jon

Link to comment
Share on other sites

I tried running this in VB first and found out that the program didn't work without a click I have been searching for a alternate and found this program.

Thanks,

Jon

I'm not sure if the link to the VB2Au script is stll around or not. If I was at home I'd send you a copy of that. It pretty much does the conversion for you but below I've included part of the conversion methods

For what you posted

Scrap the first 2 lines ........ not requires

All of the Wscript.sleep lines change to Sleep(<value>) <value> is just the number at the end of the line.

delete the word set on the 4th line

Replace all of the occurances of Wshshell with a simple string name like $Obj

Replace WScript.CreateObject( with ObjCreate(

Replace all WshShell.SendKeys "(%{TAB})" With Send ("{TAB}")

Replace WshShell.SendKeys "{RIGHT}" With Send ("{RIGHT}")

I THINK you can just scrap the WshShell.SendKeys "%" line I don't have a vb reference available and I don't remember what the % is for. If it is important then the Send("{TAB}") lines might also need to be modified.

Scrap the last 3 lines .......... not required

HTH

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

I'm not sure if the link to the VB2Au script is stll around or not. If I was at home I'd send you a copy of that. It pretty much does the conversion for you but below I've included part of the conversion methods

For what you posted

Scrap the first 2 lines ........ not requires

All of the Wscript.sleep lines change to Sleep(<value>) <value> is just the number at the end of the line.

delete the word set on the 4th line

Replace all of the occurances of Wshshell with a simple string name like $Obj

Replace WScript.CreateObject( with ObjCreate(

Replace all WshShell.SendKeys "(%{TAB})" With Send ("{TAB}")

Replace WshShell.SendKeys "{RIGHT}" With Send ("{RIGHT}")

I THINK you can just scrap the WshShell.SendKeys "%" line I don't have a vb reference available and I don't remember what the % is for. If it is important then the Send("{TAB}") lines might also need to be modified.

Scrap the last 3 lines .......... not required

HTH

Thanks for all the help I finaly got it working.

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...