Overflow_

StringSplit + FileWrite

20 posts in this topic

I have it on gimmestring.au3

 

FileCopy (@ScriptDir & "\file.exe", @ScriptDir & "\newfile.exe")
FileWrite(@ScriptDir & "\newfile.exe", @CRLF & "//first message//secound message//")
FileClose(@ScriptDir & "\newfile.exe")

 

and it on file.au3

 

$StrSplit = StringSplit(FileRead(@ScriptFullPath), "//", 1)
MsgBox(0, $StrSplit[2], $StrSplit[3])

 

Why i got Error array variable has incorrect number of subscripts if [1] is MZ ?

btw error in newfile.exe

 

Share this post


Link to post
Share on other sites



Another thing:

FileRead(@ScriptFullPath), "//", 1)

FileRead() only accept 2 arguments from the Help File:

FileRead ( "filehandle/filename" [, count] )

You are passing 3 arguments here.

Regards
Alien.
 

 

 

1 person likes this

Share this post


Link to post
Share on other sites
4 minutes ago, alien4u said:
@ScriptFullPath

Refer to the Full path of the running script, so this:

$StrSplit = StringSplit(FileRead(@ScriptFullPath), "//", 1)

Is searching on \file.exe and not in \newfile.exe

Regards
Alien.

nope, its reading the newfile.exe

the file was copied to newfile before read/write/close.

but thanks

 

Share this post


Link to post
Share on other sites

You can't append parameters by appending them to a EXEcutable file!

Share this post


Link to post
Share on other sites

Well, then youre telling to make a builder string is impossible to do ?

Share this post


Link to post
Share on other sites

You are trying to run another program with the parametersand: //first message and //secound message?
Or you're trying to run the script with the parametersand: //first message and //secound message?

If you are running other programs you use: ShellExecute,ShellExecuteWait,Run,RunWait

Run ( "program" [, "workingdir" [, show_flag [, opt_flag]]] )
RunWait ( "program" [, "workingdir" [, show_flag [, opt_flag]]] )
ShellExecute ( "filename" [, "parameters" [, "workingdir" [, "verb" [, showflag]]]] )
ShellExecuteWait ( "filename" [, "parameters" [, "workingdir" [, "verb" [, showflag]]]] )

If you're trying to create your scripts to run with these commands, Try this:
 

If $CmdLine[0] > 0 Then
    If $CmdLine[1] = "Function1" Then Function1()
    If $CmdLine[1] = "Function2" Then Function2()
EndIf

;~ If @Compiled Then
;~     ShellExecute(@AutoItExe, "Function1")
;~     ShellExecute(@AutoItExe, "Function2")
;~ Else
;~     ShellExecute(@ScriptName, "Function1")
;~     ShellExecute(@ScriptName, "Function2")
;~ EndIf

Func Function1()
    MsgBox(0, "", "Function 1", 0)
    Exit
EndFunc   ;==>Function1

Func Function2()
    MsgBox(0, "", "Function 2", 0)
    Exit
EndFunc   ;==>Function2

 


Regards,
 

Share this post


Link to post
Share on other sites

Like I see it @Overflow_ just want to write something inside an exe file and then read that, in the end an exe file is just a file like any other file.

But if he want to past a parameter to an exe(program) then he must fallow @VIP suggestion.

Regards
Alien.

1 person likes this

Share this post


Link to post
Share on other sites

nice tip but let me explain a little bit to you gys, i want to do one Builder and Stub

I think this is the correct name

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Maybe now you can understand.

This is my gen.exe

look that.. creating exacly same file "Stb.exe" but with the new string.

$StringMessage = InputBox('','', 'write ur message here')

    FileCopy(@ScriptDir&"\Stb.exe", @ScriptDir & "\test.exe") ;will copy and gen exactly new equal file

    FileWrite(@ScriptDir & "\test.exe", @CRLF & "|||" & $texte1 &"|||") ;write in new file my string($StringMessage)

    FileClose(@ScriptDir & "\test.exe") ;close.

 

And this is my Stb.exe

Local $dir = FileRead(@ScriptFullPath) ; fullpacth bcause I'm NEW file with new name, dir.. idk.

$StrSplit = StringSplit($dir, "|||") ;split the string INSIDE |||$StringMessage|||    PS: $StringMessage From that exe copied..


$NewStringCall = $StrSplit[2] ;we call secound value bcause 0 is bool, 1 is MZ of exe.

_ShowMsg($NewStringCall)

Func _ShowMsg($String)
   MsgBox(64, "Title", $String)
EndFunc

 

 

Edited by Overflow_

Share this post


Link to post
Share on other sites

c'mon guys, bump

Share this post


Link to post
Share on other sites

You're trying to do a fileread on a binary file, the first NUL it hits in the file stops the file read, it's not going to work.

Why are you trying to append text to the end of an executable? Can't you just add it to the resources the usual way?


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Overflow_,

Please do not bump your own threads within 24 hours.

Remember this is not a 24/7 support forum - those who answer are only here because they like helping others and have some time to spare.  You just have to wait until someone who knows something about your particular problem, and is willing to help, comes online.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
1 hour ago, BrewManNH said:

You're trying to do a fileread on a binary file, the first NUL it hits in the file stops the file read, it's not going to work.

Why are you trying to append text to the end of an executable? Can't you just add it to the resources the usual way?

Yeah, im trying to do looks like it

 

https://www.youtube.com/ watch?v=cVQbZsNilDA

Share this post


Link to post
Share on other sites

Builder/Stub sets off alarm bells when dealing with malware, you need to give a better explanation of why you're trying to do this than you already have.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Overflow_,

Quote

you need to give a better explanation of why you're trying to do this than you already have

I agree - and the explanation had best be a good one.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

I'm trying to do it because i have Generator Launcher to samp game server with settings.ini where you edit with ip to server, port, name of server etc..

to v2 i want make without ini settings.

this is official server list

http://prntscr.com/ax5od4

i just making my launcher auto join

has nothing with malware, just launcher to join in my server

if you want know more about my project, is just commandline to join server

Share this post


Link to post
Share on other sites

Overflow_,

So this is just a script to interact with your game server?

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Just now, Melba23 said:

Overflow_,

So this is just a script to interact with your game server?

M23

well, not only with my gm

will be release source code free to all admins of samp server

Share this post


Link to post
Share on other sites

Overflow_,

You appear not to have read the Forum rules since your arrival. Please do read them - particularly the bit about not discussing game or game server interaction - before you post again and then you will understand why you will get no further help and this thread will now be locked.

M23

 


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.