Jump to content

StringSplit + FileWrite


Recommended Posts

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

 

Link to comment
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,
 

Link to comment
Share on other sites

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_
Link to comment
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

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
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

Link to comment
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

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
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

Link to comment
Share on other sites

  • Moderators

Overflow_,

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

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

  • Moderators

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

 

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...