Sign in to follow this  
Followers 0
sabhazi

error handeling

10 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

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

Share this post


Link to post
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.

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