Sign in to follow this  
Followers 0
Azu

A few questions

24 posts in this topic

I can only seem to get one adlibenable working at a time.. very frustrating. How do I get more then 1 going?

Whenever I try to compile my code, for some reason the exe is very very bloated, for example just a simple

while 1
sleep(50)
wend
results in a whopping 202,043 bytes! I am trying to compile by right clicking on the .au3 file and clicking compile. Please tell me what I am doing wrong and how I can fix it :)

How can I make an autoit window be ALWAYS on top, meaning even if I have a full screen application running. Always.

How can I tell how many characters are in a set of variables,

GUICtrlSetData($20,$10[$1]&" "&$11[$2]&" "&$12[$3]&" "&$13[$4]&$15[$6]&$17[$8])
for example? I need to know so I can make an input box resize itself to match how many characters are in it.

How can I have the effect of the moving the mouse and using it to click on stuff, without actually effecting the user's cursor? I know I can save the location of the cursor, move it, and then move it back, but it doesn't work very good, and moving the mouse at the same time will mess it up.

How can I make an autoit script modify itself? I want it to store some variables, kind of like writing to an ini, except I want it to simply write it into itself, so it's just one file, and you can move it around and restart the computer etc and it will be able to read what it wrote to itself.

How can I have autoit detect whether a 3D application or game is running in windowed mode? How can I have it detect the color depth settings of it?

How can I simulate the effect of double clicking on a file? Like I put in the path of the file and autoit will try to open it exactly like if the user had manually clicked on that file?

How can I have autoit read from a file like, have it search the file for a line that starts with something=

And then record whatever is after it on that line? So like for example in something.ini on line 7 it says something=123456 autoit would be able to grab that 123456

How can I have autoit look at individual characters in strings and break them apart?

For example if the second character in $a is the letter z, it would call function a, but if it isn't z, if it's a different letter or a number or that variable doesn't have a second character, it would call function b, or even just not do anything at all.

Thanks in advance to anyone who can answer any of my questions! I'm looking forward to it.. :whistle:

Share this post


Link to post
Share on other sites



I can only seem to get one adlibenable working at a time.. very frustrating. How do I get more then 1 going?

Unless you run seperate scripts, I beleive you are only allowed to run one AdlibEnable at a time.

Whenever I try to compile my code, for some reason the exe is very very bloated, for example just a simple

while 1
sleep(50)
wend
results in a whopping 202,043 bytes! I am trying to compile by right clicking on the .au3 file and clicking compile. Please tell me what I am doing wrong and how I can fix it :whistle:
Are you using any #include statements?

As for some of the other questions, some functions to look at are: StringSplit, StringLen, _FileReadToArray, StringInStr

Oh, and It isnt possible to modify the .exe once its compiled so no I do not beleive its possible for it to modify itself, you would have to use a file to store the information.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I can only seem to get one adlibenable working at a time.. very frustrating. How do I get more then 1 going?

You can't directly, have an another adlib defined in your current adlib that stops the first one from occuing and starts the second.

Whenever I try to compile my code, for some reason the exe is very very bloated, for example just a simpleCODEwhile 1

sleep(50)

wendresults in a whopping 202,043 bytes! I am trying to compile by right clicking on the .au3 file and clicking compile. Please tell me what I am doing wrong and how I can fix it

No problem, that's how it supsed to be. Please don't complain about autoits file size... it's very small (look at a VB file or a .net compiled file...they are 2 times larger ussually).

I think there was a size increase recently when the dev team started using VS2005....but it wasnt much

How can I tell how many characters are in a set of variables,CODEGUICtrlSetData($20,$10[$1]&" "&$11[$2]&" "&$12[$3]&" "&$13[$4]&$15[$6]&$17[$8])for example? I need to know so I can make an input box resize itself to match how many characters are in it.

StringLen()

How can I have the effect of the moving the mouse and using it to click on stuff, without actually effecting the user's cursor? I know I can save the location of the cursor, move it, and then move it back, but it doesn't work very good, and moving the mouse at the same time will mess it up.

Humm, in autoit i dont think you really can other than refined methods of what you describe. You may try controlsend(). Or I've heard of system that are compatable with 2 mice (and have 2 cursors) but I dont know really how that works.

How can I make an autoit script modify itself? I want it to store some variables, kind of like writing to an ini, except I want it to simply write it into itself, so it's just one file, and you can move it around and restart the computer etc and it will be able to read what it wrote to itself.

Self Modifing code is one of the weakness of autoit (it is a scripting lanaguage after all). I THINK some one atually did what your descripbing and posted in the the scripts and scarps a while back but i can't seem to find it anymore. Best bet is an INI file or registry key for now i think.

How can I have autoit detect whether a 3D application or game is running in windowed mode? How can I have it detect the color depth settings of it?

1st- Use ProcessExists (), 2nd- That's kidna tricky..I don't know if you can...maybe by using some fancy PixelGetColor()'s

How can I simulate the effect of double clicking on a file? Like I put in the path of the file and autoit will try to open it exactly like if the user had manually clicked on that file?

The command line command "Start' does this (_RunDos("Start "&$Path))

How can I have autoit read from a file like, have it search the file for a line that starts with something=

And then record whatever is after it on that line? So like for example in something.ini on line 7 it says something=123456 autoit would be able to grab that 123456

The INIRead() command? Seems to be what your after...

How can I have autoit look at individual characters in strings and break them apart?

For example if the second character in $a is the letter z, it would call function a, but if it isn't z, if it's a different letter or a number or that variable doesn't have a second character, it would call function b, or even just not do anything at all.

StringMid() can extract cerrtian charactors from a string.

Then use an if-then stament for logic control

if stringmid($a,2,1)="z" then

do somthing

else

do somthing else

endif

Edit: Phew!

Edit2: Fixed a bunch of typos

Edited by evilertoaster

Share this post


Link to post
Share on other sites

Unless you run seperate scripts, I beleive you are only allowed to run one AdlibEnable at a time.

How come? I need to use more then one at a time in this script.. :whistle:

As for some of the other questions, some functions to look at are: StringSplit, StringLen, _FileReadToArray, StringInStr

Thanks! I'll take a look at them..

Oh, and It isnt possible to modify the .exe once its compiled so no I do not beleive its possible for it to modify itself, you would have to use a file to store the information.

Okay. I'll just leave it uncompiled in au3 format. So.. any ideas how?

Are you using any #include statements?

No that was the whole file. I didn't leave anything out. It's just those three lines.

Share this post


Link to post
Share on other sites

You can use more than one AdlibEnable() in a way... You have to use a manager... do a search for:

"_AdlibManager" and you'll see a few links where I demonstrate it. It also allows you to pass parameters if necessary this way.


[center]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.[/center]

Share this post


Link to post
Share on other sites

You can't directly, have an another adlib defined in your current adlib that stops the first one from occuing and starts the second.

No problem, that's how it supsed to be. Please don't complain about autoits file size... it's very small (look at a VB file or a .net compiled file...they are 2 times larger ussually).

I think there was a size increase recently when the dev team started using VS2005....but it wasnt much

StringLen()

Humm, in autoit i dont think you really can other than refined methods of what you describe. You may try controlsend(). Or I've heard of system that are compatable with 2 mice (and have 2 cursors) but I dont know really how that works.

Self Modifing code is one of the weakness of autoit (it is a scripting lanaguage after all). I THINK some one atually did what your descripbing and posted in the the scripts and scarps a while back but i can't seem to find it anymore. Best bet is an INI file or registry key for now i think.

1st- Use ProcessExists (), 2nd- That's kidna tricky..I don't know if you can...maybe by using some fancy PixelGetColor()'s

The command line command "Start' does this (_RunDos("Start "&$Path))

The INIRead() command? Seems to be what your after...

StringMid() can extract cerrtian charactors from a string.

Then use an if-then stament for logic control

if stringmid($a,2,1)="z" then

do somthing

else

do somthing else

endif

Edit: Phew!

Edit2: Fixed a bunch of typos

Ah.. you posted while I was posting =p

I'm going to go try that stuff and see if it works.. thanks!

I thought iniread only worked on files in the format autoit writes them in.. e.g. the

[something]

something=something

Will it work on a file that is just

something=something

something=something

?

And do you have a link to that post for self modifying? I've searched for everything that I asked here and wasn't able to find what any of it..

I wasn't complaining about the file size, just confused.

Even if I compile a totally blank file, the exe is around 190KB

I'm trying to make a lightweight script it's around 5KB but when I compile it it makes it about 40 times larger.. I was just wandering how to remedy this..

Thanks again!

Share this post


Link to post
Share on other sites

How come? I need to use more then one at a time in this script.. :whistle:

Because thats how it works. Something you could try, sort of like what eviltoaster said, you could write some code that makes it switch back and forth between two or more adlib functions

AdlibEnable("FirstAdlib")

Func FirstAdlib()
    WhatEverFunction()
    AdlibDisable()
    AdlibEnable("SecondAdlib")
EndFunc;==>FirstAdlib

Func SecondAdlib()
    WhatEverFunction()
    AdlibDisable()
    AdlibEnable("FirstAdlib")
EndFunc;==>SecondAdlib

Would something like that work for you?

Share this post


Link to post
Share on other sites

Because thats how it works. Something you could try, sort of like what eviltoaster said, you could write some code that makes it switch back and forth between two or more adlib functions

AdlibEnable("FirstAdlib")

Func FirstAdlib()
    WhatEverFunction()
    AdlibDisable()
    AdlibEnable("SecondAdlib")
EndFunc;==>FirstAdlib

Func SecondAdlib()
    WhatEverFunction()
    AdlibDisable()
    AdlibEnable("FirstAdlib")
EndFunc;==>SecondAdlib

Would something like that work for you?

Thanks! That is a good work around I think. :whistle:

Share this post


Link to post
Share on other sites

Thanks! That is a good work around I think. :whistle:

Not the right one though:

Global $iCount1, $iCount2

AdlibEnable('_AdlibManager', 10)

While 1
    ToolTip('Count 1 = ' & $iCount1 & @CR & 'Count 2 = ' & $iCount2, 0, 0)
    Sleep(10)
WEnd

Func _AdlibManager()
    _GoToFunc1()
    _GoToFunc2()
EndFunc

Func _GoToFunc1()
    $iCount1 += 1
EndFunc

Func _GoToFunc2()
    $iCount2 += 1
EndFunc

[center]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.[/center]

Share this post


Link to post
Share on other sites

I thought iniread only worked on files in the format autoit writes them in.. e.g. the

[something]something=something

Will it work on a file that is just

something=something

something=something

?

This is true. It's not only AutoIt format it's standard INI format. You can put it all udner one header though.

Is this gonna hurt your script somehow?

And do you have a link to that post for self modifying? I've searched for everything that I asked here and wasn't able to find what any of it..

Well im sure most of your questions HAVE been answered before. But as for that self modifing thing-- http://www.autoitscript.com/forum/index.php?showtopic=26360

wasn't complaining about the file size, just confused.

Even if I compile a totally blank file, the exe is around 190KB

I'm trying to make a lightweight script it's around 5KB but when I compile it it makes it about 40 times larger.. I was just wandering how to remedy this..

ANY compiled exe is going to be pretty big by thsoe standards (even most C compiled ones are 60KB+).

The simple fact is that Autoit has to wrap it inturpriter around every exe. 190 is a very lightwight application by most standards.... you can try writing it in ASM to get rid of ALL overhead...there you can get some very small file sizes

Share this post


Link to post
Share on other sites

Not the right one though:

Global $iCount1, $iCount2

AdlibEnable('_AdlibManager', 10)

While 1
    ToolTip('Count 1 = ' & $iCount1 & @CR & 'Count 2 = ' & $iCount2, 0, 0)
    Sleep(10)
WEnd

Func _AdlibManager()
    _GoToFunc1()
    _GoToFunc2()
EndFunc

Func _GoToFunc1()
    $iCount1 += 1
EndFunc

Func _GoToFunc2()
    $iCount2 += 1
EndFunc

Edit:

You can thank Valik for pointing this out quite some time ago, I was using BPBNA's method for a while, just too much work being done that can be solved so easily.


[center]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.[/center]

Share this post


Link to post
Share on other sites

This is true. It's not only AutoIt format it's standard INI format. You can put it all udner one header though.

Is this gonna hurt your script somehow?

Well im sure most of your questions HAVE been answered before. But as for that self modifing thing-- http://www.autoitscript.com/forum/index.php?showtopic=26360

ANY compiled exe is going to be pretty big by thsoe standards (even most C compiled ones are 60KB+).

The simple fact is that Autoit has to wrap it inturpriter around every exe. 190 is a very lightwight application by most standards.... you can try writing it in ASM to get rid of ALL overhead...there you can get some very small file sizes

Thanks for the link, that looks like something that could be very useful. It's not quite what I had in mind though; it doesn't work on a running file, so it can't self modify.

And thank you for explaining to me about the interpreter, and the suggestion about the ASM. I'll try that.

I don't understand about the ini though.

I need it to read an ini file that is automatically generated by another program over and over, so I can't add a header to it. Is it possible to use iniread on an ini that doesn't have a header?

Share this post


Link to post
Share on other sites

Not the right one though:

Global $iCount1, $iCount2

AdlibEnable('_AdlibManager', 10)

While 1
    ToolTip('Count 1 = ' & $iCount1 & @CR & 'Count 2 = ' & $iCount2, 0, 0)
    Sleep(10)
WEnd

Func _AdlibManager()
    _GoToFunc1()
    _GoToFunc2()
EndFunc

Func _GoToFunc1()
    $iCount1 += 1
EndFunc

Func _GoToFunc2()
    $iCount2 += 1
EndFunc
Hmm.. that looks even better.. I'll give it a shot! Thanks! :whistle:

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

I need it to read an ini file that is automatically generated by another program over and over, so I can't add a header to it. Is it possible to use iniread on an ini that doesn't have a header?

So there's another program making .ini files with no section header? Unfortuatly the INI functions of autoit only work with standard INI files. Oterhwise you can try a simple FileReadLine() Edited by evilertoaster

Share this post


Link to post
Share on other sites

Thanks SmOke_N, I'm not new to AutoIt but theres many UDF's that I don't know about yet. Always good to keep learning!

Share this post


Link to post
Share on other sites

How can I make an autoit window be ALWAYS on top, meaning even if I have a full screen application running. Always.

:whistle:

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

Thanks SmOke_N, I'm not new to AutoIt but theres many UDF's that I don't know about yet. Always good to keep learning!

Crappy part is, we make stuff harder than need be!!

Edit:

@Azu... you're really dissapointing... you don't ever have an original thought, and if you try something, you never state what it is in detail you tried. So, assuming you've done all of the other stuff, what we need to assume is that WinSetOnTop() isn't working for you?

Edited by SmOke_N

[center]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.[/center]

Share this post


Link to post
Share on other sites

I'm sorry that I disappoint you. :whistle:

I already tried WinSetOnTop("Test", "", 1) but it doesn't work when I have a have something full screen up.

Share this post


Link to post
Share on other sites

I'm sorry that I disappoint you. :whistle:

I already tried WinSetOnTop("Test", "", 1) but it doesn't work when I have a have something full screen up.

No need to be sorry, just do something about it.

If WinSetOnTop() didn't work for me, I would assume that he game I was playing made sure it was always on top?


[center]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.[/center]

Share this post


Link to post
Share on other sites

I can't do something about something when I have no clue what's causing it.

AFAIK WinSetOnTop doesn't work on anything that is fullscreen..

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