Jump to content

Need help editting a function


Recommended Posts

Thanks for the very valuable help guys.

Because you know, nowhere in my post did it say that I was MAKING something illegal.

Anyway.

Say I have a text file, right?

Maybe an essay, what have you.

And if a part of it looks like this:

This is how we do it

I don't believe you

Why not?

Cause I said so

Oh yes

How could I copy from "I don't believe you" to "Cause I said so"?

Edited by Fewmitz
Link to comment
Share on other sites

In a previous thread

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

I decompiled it from an exe

I found out (once again thanks to one of the members on here) that when it was decompiled, an external script, hence the "file instal" at the beginning. To get this file I need to, apparently

And I have an idea of what this means, but no idea how to do it.

.... and

Yes, it is.

There is historically very little sympathy on this forum for people trying to decompile and rework the scripts of others.

:)

I agree with salty and dan!!!

8)

NEWHeader1.png

Link to comment
Share on other sites

The following assumes you have a file named "textfile.txt" on the root of C:\ with the following contents:

This is how we do it

I don't believe you

Why not?

Cause I said so

Oh yes

If you knew that you wanted take everything before the line "Oh yes", This would work:
#include <GuiConstants.au3>
#include <File.au3>
Opt("GUIOnEventMode", 1 )
GuiCreate("MyGUI", 200, 250,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Read = GuiCtrlCreateButton("Read C:\textfile.txt", 10, 20, 180, 80)
GUICtrlSetOnEvent(-1, "_readfile" )
$Edit1 = GUICtrlCreateEdit( "", 0, 100, 200, 150)
GuiSetState()
While 1
Sleep(10)
WEnd

Func _readfile()
    $file = "C:\textfile.txt"
    $fileh = FileOpen($file, 0 )
    $string = ""
    For $avar = 1 to _FileCountLines( $file ) ; if you are just wanted a certain number of lines you can set that here
        $line = FileReadLine( $fileh, $avar )
        If $line = "Oh yes" Then
            ExitLoop
        Else
            $string = $string & $line & @CRLF
        EndIf
    Next
    FileClose( $fileh )
    GUICtrlSetData( $Edit1, $string )
EndFuncoÝ÷ Øò¢é'{ajܨ»§µçew¶bæ-éí+0¢é]Âäjëh×6#include <GuiConstants.au3>
#include <File.au3>
Opt("GUIOnEventMode", 1 )
GuiCreate("MyGUI", 200, 250,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Read = GuiCtrlCreateButton("Read C:\textfile.txt", 10, 20, 180, 80)
GUICtrlSetOnEvent(-1, "_readfile" )
$Edit1 = GUICtrlCreateEdit( "", 0, 100, 200, 150)
GuiSetState()
While 1
Sleep(10)
WEnd

Func _readfile()
    $file = "C:\textfile.txt"
    $fileh = FileOpen($file, 0 )
    $string = ""
    $x = 1
    $y = 4
    For $avar = $x to $y
        $line = FileReadLine( $fileh, $avar )
        $string = $string & $line & @CRLF
    Next
    FileClose( $fileh )
    GUICtrlSetData( $Edit1, $string )
EndFuncoÝ÷ Øò¢é'{ajܨ»§µç^½êò¶§·­Á秪ê-'ßÛ[zX½ì¨º«¨µ©Ýªê-   «¬xÛ(ªê-N¬Â¥w
+«­¢+Ø¥¹±Õ±ÐíÕ¥
½¹ÍѹÑ̹ÔÌÐì(¥¹±Õ±Ðí¥±¹ÔÌÐì)=ÁÐ ÅÕ½ÐíU%=¹Ù¹Ñ5½ÅÕ½Ðì°Ä¤)U%
ÉÑ ÅÕ½Ðí5åU$ÅÕ½Ðì°ÈÀÀ°ÈÔÀ°´Ä°´Ä°    ¥Ñ=H ÀÌØí]M}=YI1AA]%9=°ÀÌØí]M}
1%AM%   1%9L¤¤((ÀÌØíIôU%
Ñɱ
ÉÑ    ÕÑѽ¸ ÅÕ½ÐíIèÀäÈíÑáÑ¥±¹ÑáÐÅÕ½Ðì°ÄÀ°ÈÀ°ÄàÀ°àÀ¤)U%
ÑɱMÑ=¹Ù¹Ð ´Ä°ÅÕ½Ðí}É¥±ÅÕ½Ðì¤(ÀÌØí¥ÐÄôU%
Ñɱ
ÉѥРÅÕ½ÐìÅÕ½Ðì°À°ÄÀÀ°ÈÀÀ°ÄÔÀ¤)U%MÑMÑÑ ¤)]¡¥±Ä(%M±À ÄÀ¤)]¹()Õ¹}É¥± ¤($ÀÌØí¥±ôÅÕ½ÐíèÀäÈíÑáÑ¥±¹ÑáÐÅÕ½Ðì($ÀÌØí¥± ô¥±=Á¸ ÀÌØí¥±°À¤($ÀÌØíÍÑÉ¥¹ôÅÕ½ÐìÅÕ½Ðì($ÀÌØí±ôÀ(%½ÈÀÌØíÙÈôÄQ¼}¥±
½Õ¹Ñ1¥¹Ì ÀÌØí¥±¤($$ÀÌØí±¥¹ô¥±I1¥¹ ÀÌØí¥± °ÀÌØíÙȤ($%%ÀÌØí±¥¹ôÅÕ½Ðí$½¸Ìäíб¥Ùå½ÔÅÕ½Ðì=ÈÀÌØí±ôÄQ¡¸($$$ÀÌØí±ôÄ($$$ÀÌØíÍÑÉ¥¹ôÀÌØíÍÑÉ¥¹µÀìÀÌØí±¥¹µÀì
I1($$%%ÀÌØí±¥¹ôÅÕ½Ðí
ÕÍ$ͥͼÅÕ½ÐìQ¡¸á¥Ñ1½½À($%¹%(%9áÐ(%¥±
±½Í ÀÌØí¥± ¤(%U%
ÑɱMÑÑ ÀÌØí¥ÐÄ°ÀÌØíÍÑÉ¥¹¤)¹Õ¹ìôôÐí}É¥±
Link to comment
Share on other sites

Okay cool, that worked great, but now I have another question:

If I had those lines buried in a text file in a random place on my computer, is there a way to search the computer for them?

Like, for example, if I knew that the text file was in a folder called "potato", but it might be in one of the folders in "Potato". is there a function to search through that folder to find the text file?

Link to comment
Share on other sites

  • Moderators

_FileListToArray() + FileGetAttrib() to make sure it's a Directory... Possibly even _PathSplit() if you want to separate the Directories... but I don't think that would be necessary.

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

I'll have to look into that, but I was actually lying, cause I have another question.

What I need to do now is take some text, and make a text file with this text in it. I looked around and couldn't find anything useful, so does anyone here know how to do it?

Edited by Fewmitz
Link to comment
Share on other sites

  • Moderators

I'll have to look into that, but I was actually lying, cause I have another question.

What I need to do now is take some text, and make a text file with this text in it. I looked around and couldn't find anything useful, so does anyone here know how to do it?

Keep looking... kind of obvious questions... it's becoming apparent you aren't trying very hard.

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

Keep looking... kind of obvious questions... it's becoming apparent you aren't trying very hard.

Or I'm trying hard, just looking in the wrong place.

Edit: Nevermind, I'm just dumb >_>

Edited by Fewmitz
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...