Jump to content

how to make a program stable


yasha
 Share

Recommended Posts

$fileoutput = false
while $fileoutput = false
; WinActive("Microsoft Excel")
 WinWaitActive("Microsoft Excel")
 If WinExists ('File in Use') Then
 Send("{ENTER}")
 sleep(100)
 Send("{ENTER}")
 sleep(100)
 Send("{ENTER}")
 WinWaitActive("Microsoft Excel - tmp")
    $title1 = WinGetTitle("Microsoft Excel - tmp", "")
    if fileexists($baantmpdir & "tmp\" & StringMid($title1,19,12) & ".txt") then
        $filetime = filegettime ($baantmpdir & "tmp\" & StringMid($title1,19,12) & ".txt",1,1)
        if $filetime > $nowtime then
            $fileoutput = true
            endif
         EndIf
      EndIf
 If Not  WinExists ('File in Use') Then
    WinActive("Microsoft Excel")
    WinWaitActive("Microsoft Excel")
    Send("{ENTER}")
    sleep(200)
    Send("{ENTER}")
    sleep(200)
    Send("{ENTER}")
    WinWaitActive("Microsoft Excel - tmp")
    $title1 = WinGetTitle("Microsoft Excel - tmp", "")
    if fileexists($baantmpdir & "tmp\" & StringMid($title1,19,12) & ".txt") then
        $filetime = filegettime ($baantmpdir & "tmp\" & StringMid($title1,19,12) & ".txt",1,1)
        if $filetime > $nowtime then
            $fileoutput = true
         EndIf
      EndIf
  EndIf
  FileCopy($baantmpdir & "tmp\" & StringMid($title1,19,12) & ".txt", "J:\OPS\OPS_Share\Planners\2 - Weekly Reports\Auto download\.xls files\Pur " & $YY & $MM & $DD & ".xls", 1)

so my full program runs something and an excel file comes out . my computer has a shared macro which cannot be removed so if i have another excel file open ,every time another excel comes out a file in use window will appear. if i just let my program run and not go to any other excel file my program automatically keys in enter so i dont need to key in enter but if i open another another excel while the program is running it will ask me to press enter any ideas how can i solve this.

Link to comment
Share on other sites

  • Moderators

@yasha Please look at the excel functions in the help file. You will thank yourself for using these functions to control Excel at the object level, rather than all of these unreliable Sends.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

I am beginner in the excel UDF but i can help you :) That will improve my skill so we are both together winners on this hard life :evil:

I can help you to solve the main problem too. 

But i will enforce what JL said you. 

The most "Stable" thing is to use the Water's UDF. Good thing for you. It 's now on in the install pack even in the smaller one if i am not mistaking. 

And the only thing you have to do is : Open help file 

Type inside _Excel_ and read/learn/test ask qestion here if needed.

 

Oh i forgot to say... it wont be easy... so be prepared to hardcode and test. Or maybe it is hard only for me idk   ( o:) Please @JLogan3o13 not the face :lol: )

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

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