Jump to content

exit but don't exit


 Share

Recommended Posts

  • Moderators

@SmOke_N,

Maybe I have read the thread incorrectly. I thought that the scripts to be included (the modules) work as standalone code. To me that means that the script works for true and false of the "If" line of code in the post... but now that I re-read things, perhaps that is not the case. I actually repeated jpm's admonishment to check that return value in my first post to this thread, but then took it out.

I wasn't making a point in this thread topic at all really :lmao:

My point was I saw how everyone else was incorrectly giving advice on how to check something. Even if in theory their suggestions would work, it wouldn't work correctly because of how they were comparing a String to an Int.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

This is maybe stupid.. But should it not be as this:

$check = RegRead("HKEY_CURRENT_USER\Software\Ventrilo\Automation","recog")
If $check = 1 Then
Exit
EndIf
@XInFisk: close but no cigar...if I use close then the whole script ends. And that's where my problem is. I need to find something so that it will move to the last line in that specific script or something.

Check the help file under "If...Then", it states in part:

@Overlord,

As best I can tell from your posts, your individual scripts seem to work for you. You would like to combine several existing/functioning scripts into one main script (using #include) without making the other scripts into functions. One of the "included" scripts causes your main script to exit.

This seems to be an easy fix from BitRot:

http://www.autoitscript.com/forum/index.ph...st&p=252423

That should allow your main script to keep going as well as leave your smaller script as a functioning standalone script...

@herewasplato : thank you very much for your support and humble words for a complete loob on auto-it.

It's indeed true that my scripts work standalone but that they need some improvement when including them in different scripts

Everyone is still missing what jpm said and what Chris itterated, you should work on first retrieving the correct value, in order to test any of the theory's above.

If Int(RegRead("HKEY_CURRENT_USER\Software\Ventrilo\Automation","recog")) = 1 Then ... Here you are comparing an Integer to an Integer.

If RegRead("HKEY_CURRENT_USER\Software\Ventrilo\Automation","recog") = 1 Then ... Here you are comparing a String to an Integer.

@SmOke_N: when I run the standalone the script works like it's build now.

Why are you including a file? Why not just put it in the main script?

ok...some explanation cause it seems that it aint that simple as it seemed. Maybe I just provided not enough info.

@Icekirby1: the reason I want them in #include is because they work standalone and so I don't need to rewrite them completely in a new script. Even copy-paste wouldn't do the same trick since some variables could get messed up with the rest of the script

@BitRot: Thank you. I haven't tested it yet but I think this is what I need.

EDIT: @BitRot: won't work. I have some for if next parts used in the rest of the script and if I put endif at the end of the script then I get errors that that endif shouldnt be there and that I'm missing a endif somewhere else....

can't I simply tell to goto a certain line in the script?

Edited by Overlord
Link to comment
Share on other sites

EDIT: @BitRot: won't work. I have some for if next parts used in the rest of the script and if I put endif at the end of the script then I get errors that that endif shouldnt be there and that I'm missing a endif somewhere else....

That means you made a mistake somewhere in your code, or did not place that "endif" at the end of the script-block. :lmao:

can't I simply tell to goto a certain line in the script?

Nope. Not in this scripting-language (nor in most others).

Suggestion : show that scriptblock, so we/I can see where the error is and determine whats causing it.

Link to comment
Share on other sites

Ok, but it if is standalone, how does it work inside another program?

I really don't want to hijack Overlord's thread to explain this in too much detail, but I'll attempt to give you an example.

Before you read this - think of running most - if not all - of your scripts as au3 files, not as compiled scripts:

Suppose that you had a script that clears IE's temp files/cookies cache and maybe the surfing history too. This "clear-IE" script works fine all by itself.

Now suppose you have another script that takes you to (and logs you into) a web-based e-mail account... but the logon page changes based on past cookies - solution = clear cookies before going to that account.

You could copy/paste the code from that mythical "clear-IE" script into your "e-mail" script or you could just add one "include" line into your "e-mail" script.

Suppose that you find several other scripts that could make use of the "clear-IE" code... again you could copy/paste the code into each script or just add that one include line.

Now let's say that some things change within IE - or that you just want to do one more thing in that "clear-IE" script - maybe set the display text size. You could edit each script that you copied/pasted the "clear-IE" code into or - had you used the one include line - you could just change the few lines of code in the "clear-IE" "module" (to use the OP's term) and all of your other scripts are "changed" as well. [Again, I'm not talking about compiled scripts here - although the principle would be the same - but you would have to recompile all of your scripts to include the change made in the "clear-IE" module.]

I hope that this blurb helps - and I hope that this does not constitute a hijack.

Caveat: Using "include" as described above may cost you more time in debugging scripts than it ever saves you in editing.. it just depends on the complexity of what is included and how well the code to be include is written.

[size="1"][font="Arial"].[u].[/u][/font][/size]

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