Sign in to follow this  
Followers 0
Tommyknockers

Running Scripts From Excel 2003

13 posts in this topic

#1 ·  Posted (edited)

Hi, hope someone can help me...

I am using Microsoft Excel 2003 to start upto 4 AutoIt scripts. But, the problem I have is that it runs the scripts at the same time.

Can any one help me, is there a way to setup AutoIt to run one script at a time.

Thank's in advance for any help.

Sorry if I've put this in the wrong section...

Edited by Tommyknockers

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi, hope someone can help me...

I am using Microsoft Excel 2003 to start upto 4 AutoIt scripts. But, the problem I have is that it runs the scripts at the same time.

Can any one help me, is there a way to setup AutoIt to run one script at a time.

Thank's in advance for any help.

Sorry if I've put this in the wrong section...

i have a couple of workbooks i've made that do the same thing. typically the way that i do it, is i'll make a toggle file that is just a switch. excel deletes the file, then runs a script, then i suspend excel until the file exists again, then continue. here's some code...

'this code goes into the vba editor in excel
Set fs = CreateObject("Scripting.FileSystemObject") 'creates file system object
If fs.fileexists("c:\toggle") Then fs.deletefile ("c:\toggle") 'deletes file if it exists
    ShellExecute 0&, vbNullString, """L:\Customer Care Center\Not Ready Files\QA\Agent Summary Interval.acsup""", vbNullString, vbNullString, vbNormalFocus
    Shell "c:\Documents and Settings\sdisanti\My Documents\deprecated and sources\test.exe " & y & " " & theinput
While Not fs.fileexists("c:\toggle")
DoEvents
Wend

and

;this code is the autoit code for test.exe
$agentname = $CmdLine[1]
$date = $CmdLine[2]
If WinExists("Agent Summary Interval") Then WinActivate("Agent Summary Interval")
WinWaitActive("Agent Summary Interval")
ControlSetText("Agent Summary Interval","","Edit1",$agentname)
ControlSetText("Agent Summary Interval","","Edit2",$date)
ControlSetText("Agent Summary Interval","","Edit3","00:00-23:30")
ControlClick("Agent Summary Interval","",23)
WinWaitActive("Agent Summary Interval - ")
Send("!ea")
WinWaitActive("Export All Data")
ControlClick("Export All Data","",6)
ControlClick("Export All Data","",16)
WinWaitActive("Avaya CMS Supervisor","records exported to")
ControlClick("Avaya CMS Supervisor","records exported to",2)
WinClose("Agent Summary Interval -")
While ProcessExists("ACScript.exe")
    sleep(100)
WEnd
$file = FileOpen("u:\toggle",1)
FileWriteLine($file,"done with my stuff. yo")
FileClose($file)

***edit*** changed verbage and added

Edited by cameronsdad

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

Hi, hope someone can help me...

I am using Microsoft Excel 2003 to start upto 4 AutoIt scripts. But, the problem I have is that it runs the scripts at the same time.

Can any one help me, is there a way to setup AutoIt to run one script at a time.

Thank's in advance for any help.

Sorry if I've put this in the wrong section...

Is it as simple as writing one script to call the other four in order?

One script to call them all, one script to find them

One script to run them all, and in the darkness bind them

:think:

If you have a VBA macro like:

retVal = shell("C:\Program Files\AutoIT\AutoIT.exe MyScript.au3", vbNormalFocus)

Then MyScript.au3 just runs what you wanted. The cool thing is your macro can pass command line parameters too:

retVal = shell("C:\Program Files\AutoIT\AutoIT.exe MyScript.au3 " & MyParam1 & " " & MyParam2, vbNormalFocus)

Hope that helps! :(


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Is it as simple as writing one script to call the other four in order?

One script to call them all, one script to find them

One script to run them all, and in the darkness bind them

:think:

If you have a VBA macro like:

retVal = shell("C:\Program Files\AutoIT\AutoIT.exe MyScript.au3", vbNormalFocus)

Then MyScript.au3 just runs what you wanted. The cool thing is your macro can pass command line parameters too:

retVal = shell("C:\Program Files\AutoIT\AutoIT.exe MyScript.au3 " & MyParam1 & " " & MyParam2, vbNormalFocus)

Hope that helps! :(

i've done stuff like that also, and consolidating your code is always the best way to go, but sometimes (like the scripts i pulled code from for example) someone else has already made a working solution (badly) in excel that you can only alter so much (permissions etc). or you don't always need to run every script. sometimes it's just easier to track by modulizing and running multiple scripts.

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

i have a couple of workbooks i've made that do the same thing. typically the way that i do it, is i'll make a toggle file that is just a switch. excel deletes the file, then runs a script, then i suspend excel until the file exists again, then continue. here's some code...

'this code goes into the vba editor in excel
Set fs = CreateObject("Scripting.FileSystemObject") 'creates file system object
If fs.fileexists("c:\toggle") Then fs.deletefile ("c:\toggle") 'deletes file if it exists
    ShellExecute 0&, vbNullString, """L:\Customer Care Center\Not Ready Files\QA\Agent Summary Interval.acsup""", vbNullString, vbNullString, vbNormalFocus
    Shell "c:\Documents and Settings\sdisanti\My Documents\deprecated and sources\test.exe " & y & " " & theinput
While Not fs.fileexists("c:\toggle")
DoEvents
Wend

and

;this code is the autoit code for test.exe
$agentname = $CmdLine[1]
$date = $CmdLine[2]
If WinExists("Agent Summary Interval") Then WinActivate("Agent Summary Interval")
WinWaitActive("Agent Summary Interval")
ControlSetText("Agent Summary Interval","","Edit1",$agentname)
ControlSetText("Agent Summary Interval","","Edit2",$date)
ControlSetText("Agent Summary Interval","","Edit3","00:00-23:30")
ControlClick("Agent Summary Interval","",23)
WinWaitActive("Agent Summary Interval - ")
Send("!ea")
WinWaitActive("Export All Data")
ControlClick("Export All Data","",6)
ControlClick("Export All Data","",16)
WinWaitActive("Avaya CMS Supervisor","records exported to")
ControlClick("Avaya CMS Supervisor","records exported to",2)
WinClose("Agent Summary Interval -")
While ProcessExists("ACScript.exe")
    sleep(100)
WEnd
$file = FileOpen("u:\toggle",1)
FileWriteLine($file,"done with my stuff. yo")
FileClose($file)

***edit*** changed verbage and added

Thank's to you both, that's exactly what I was looking for. I will fit it into my scripts and see what happens.

Again, Thanks....

Share this post


Link to post
Share on other sites

Just entered the code into the excel scripts and AutoIt scripts and it's working perfectly.

Thanks very much for all your help....

Share this post


Link to post
Share on other sites

Just entered the code into the excel scripts and AutoIt scripts and it's working perfectly.

Thanks very much for all your help....

no problem. glad to help

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

hello everything,

i have a question to the ACScript of AVAYA. I seek to get a VBA solution that the values from a ACScript to excel transferred.

Or can i use the ACScript directly in Excel VBA?

How can I make that?

Thanks Steffen

Share this post


Link to post
Share on other sites

hello everything,

i have a question to the ACScript of AVAYA. I seek to get a VBA solution that the values from a ACScript to excel transferred.

Or can i use the ACScript directly in Excel VBA?

How can I make that?

Thanks Steffen

Have you called Avaya Tech support???

This is an AutoIt forum...

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Have you called Avaya Tech support???

This is an AutoIt forum...

:)

no, the Avaya Scripts are running with AutoIt. I have this forum over google found.

The posted code was from one avaya script.

I would like to only call autoit script by excel and process the values.

Can you help me?

Thanks Steffen

Share this post


Link to post
Share on other sites

no, the Avaya Scripts are running with AutoIt. I have this forum over google found.

The posted code was from one avaya script.

I would like to only call autoit script by excel and process the values.

Can you help me?

Thanks Steffen

There is an ExcelCOM_UDF.au3 file by Locodarwin that provides very good access to Excel files from an AutoIt scirpt. My understanding is that VBA can launch any .exe, and therefore could launch any compiled AutoIt script. What, exactly, is your sticking point?

If it's specific to Avaya ACScript, then you are back to calling Tech Support.

If it's just a matter of launching the AutoIt script from Excel VBA, or getting the AutoIt script to write data into Excel, we can handle that!

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

If it's just a matter of launching the AutoIt script from Excel VBA, or getting the AutoIt script to write data into Excel, we can handle that!

:)

yes, that´s my problem, i will get to write data from AutoIt to Excel. How can i do this?

Share this post


Link to post
Share on other sites

yes, that´s my problem, i will get to write data from AutoIt to Excel. How can i do this?

Go to the link in my previous post and download ExcelCOM_UDF.au3 from Locodarwin. Also get the example scripts, ExcelCOM_UDF_Example01.au3 and ExcelCOM_UDF_Example02.au3. Open the example scripts in SciTE and study them first.

Come back with your questions after you do that.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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  
Followers 0