Jump to content

error handeling


sabhazi
 Share

Recommended Posts

Hello,

I am a very noob and learning autoit now.

I am building an script that can delete package from app-v cache. The script i use works with this line:

Runas ("administrator", @ComputerName, "1234", 0, 'C:\Program Files\Microsoft Application Virtualization Client\sftmime.exe delete app:"Oracle Login 1.0"')

The application is gone :x

Now, when i run the script again the application sftmime.exe returns an warning that says: The application cannot been found. This is okay because the script deleted this application.

Is it possible to work with error handeling to disable this message?

I don't know where to start!

Thx

Link to comment
Share on other sites

Its good practice if you are going to delete a file, to check it exists first.

If FileExists("C:\Program Files\Microsoft Application Virtualization Client\sftmime.exe") Then
    Runas ("administrator", @ComputerName, "1234", 0, 'C:\Program Files\Microsoft Application Virtualization Client\sftmime.exe delete app:"Oracle Login 1.0"')
EndIf

EDIT:

Or of its another app you will be deleting via that mine thing, then check for that instead.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Its good practice if you are going to delete a file, to check it exists first.

If FileExists("C:\Program Files\Microsoft Application Virtualization Client\sftmime.exe") Then
    Runas ("administrator", @ComputerName, "1234", 0, 'C:\Program Files\Microsoft Application Virtualization Client\sftmime.exe delete app:"Oracle Login 1.0"')
EndIf

EDIT:

Or of its another app you will be deleting via that mine thing, then check for that instead.

Thx JohnOne but this is not what i mean.

This command 'C:\Program Files\Microsoft Application Virtualization Client\sftmime.exe delete app:"Oracle Login 1.0 deletes the app: Oracle Login 1.0 from the App-v cache. When i open the cache, the app is gone. That is oke.

When i run it again, it generates a windows pop-up warning that says : CAnnot find the application Oracle Login 1.0.

I only want to hide that pop-up warning.

Link to comment
Share on other sites

If you delete the file, then you won't be able to repeat the same operation. That is why John's method is recommended. There will be no error message and the function won't run. That is the better than trying to run a function that won't run. However you could try using: @error

If @error Then
    ; Do something
EndIf
Edited by czardas
Link to comment
Share on other sites

If you delete the file, then you won't be able to repeat the same operation. That is why John's method is recommended. There will be no error message and the function won't run. That is the better than trying to run a function that won't run. However you could try using: @error

If @error Then
    ; Do something
EndIf

Sure i understand this but i won't delete a file, i want to delete the cache with de sftmime.exe commmand. I cannont check on the existing of the app Oracle Login 1.0 in de cache. That is not possible with the sftmime.exe command.

Link to comment
Share on other sites

I don't really know how this works. Perhaps you can create an event log and somehow use that as a check instead. But if changes are made by another process, you may still need update the log. The question is: how to do that.

Edited by czardas
Link to comment
Share on other sites

I don't really know how this works. Perhaps you can create an event log and somehow use that as a check instead. But if changes are made by another process, you may still need update the log. The question is: how to do that.

hmm...oke Thx

So there is now way that autoit can hide that warming window? disable warnings of somethin like that? The warming comes from the sftmime.exe application. That is the one that generates that warming?

Link to comment
Share on other sites

Autoit has no control over 3 party applications error warnings (at least not to my knowledge)

Thats why we suggest you find a way of checking cache file exists before running command to delete it.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

So there is now way that autoit can hide that warming window? disable warnings of somethin like that?

If the error is thrown by another program, then I think the best thing you can do is to allow the error, and then decide what to do about it. You can interact with the error message using autoit: Hide it or close it (which is probably better). If you want to avoid annoying audio beeps you can adjust volume settings while the script runs.

NOTE: It is still far better to avoid the error in the first place, unless you have a valid reason to do otherwise.

Edited by czardas
Link to comment
Share on other sites

quote name='czardas' timestamp='1293715938' post='859317']

If the error is thrown by another program, then I think the best thing you can do is to allow the error, and then decide what to do about it. You can interact with the error message using autoit: Hide it or close it (which is probably better). If you want to avoid annoying audio beeps you can adjust volume settings while the script runs.

NOTE: It is still far better to avoid the error in the first place, unless you have a valid reason to do otherwise.

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