Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


os.execute(cmd) flashing past without executing app

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Ludwig
Advanced Cheater
Reputation: 0

Joined: 10 Jan 2016
Posts: 68

PostPosted: Tue May 03, 2016 10:20 am    Post subject: os.execute(cmd) flashing past without executing app Reply with quote

with reference to
http://forum.cheatengine.org/viewtopic.php?t=588507
and
http://forum.cheatengine.org/viewtopic.php?t=590152

my below code i build the cmd for os.execute(cmd)
but
when running the script it just flashes past the cmd interface, without running the app...
however...
if i copy paste my printout of cmd and paste it in the command interface...it executes correctly...
i also compared the actual command with the printout and it matches...
it seem similar than the error i had on my Vbs scritp...but, i cant seem to get it fixed, though i tried some combinations as to where to put "...and '

Code:
search_array[nr2max]=temp_search2
cmd="\"C:\\Users\\Dell\\Downloads\\fnr.exe\" \-\-cl \-\-dir \"D:\\hacks\\SWF files\\rab\\277_clean\\name\-0\" \-\-fileMask \"*.*\" \-\-excludeFileMask \"*.dll, *.exe\" \-\-includeSubDirectories \-\-find \"\""..search_array[nr2max].."\"\" \-\-replace \"\""..replace_array[nrmax].."\"\""

--"C:\Users\Dell\Downloads\fnr.exe" --cl --dir "D:\hacks\SWF files\rab\277_clean\name-0" --fileMask "*.*" --excludeFileMask "*.dll, *.exe" --includeSubDirectories --find """display""" --replace """sj839wldtxqhft2dxsvjadturac6ljy57dfv3hnlwfaltrl271f9d5i"""
--"C:\Users\Dell\Downloads\fnr.exe" --cl --dir "D:\hacks\SWF files\rab\277_clean\name-0" --fileMask "*.*" --excludeFileMask "*.dll, *.exe" --includeSubDirectories --find """display""" --replace """y4f79tpodgg6o5nuwh2yaipx5nsjw616yhbv53izdei79acncpy39v5"""

print(cmd)
  os.execute(cmd)

showMessage("search= "..search_array[nr2max].."    Replace= "..replace_array[nrmax])
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Tue May 03, 2016 10:56 am    Post subject: Reply with quote

Why are you escaping the - character? Printing out that string gives me an invalid escape sequence error, but removing all those escape sequences lets me print it out correctly.
_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Ludwig
Advanced Cheater
Reputation: 0

Joined: 10 Jan 2016
Posts: 68

PostPosted: Tue May 03, 2016 11:33 am    Post subject: Reply with quote

ok...so i copied the app to my root directory...
changed the cmd to
Code:
cmd='"C:/fnr.exe"'.." \--cl \--dir \"D:\\hacks\\SWF files\\rab\\277_clean\\name-0\" \--fileMask \"*.*\" \--excludeFileMask \"*.dll, *.exe\" \--includeSubDirectories \--find \"\""..search_array[nr2max].."\"\" \--replace \"\""..replace_array[nrmax].."\"\""

  os.execute(cmd)


still the same...my cmd promt thru the app flashes past to fast to read anything, but doesnt execute the app...the result for the "cmd" that i built still executes fine if i copy paste it manualy

was escaping both "-"because i thought it might give an error...dint test b4 the time...but the end result on my side is the same
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Tue May 03, 2016 11:45 am    Post subject: Reply with quote

Again- why are you escaping the - character? Putting a backslash (the charater \ ) before any other character is an escape sequence. \- is an invalid escape sequence.
_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Ludwig
Advanced Cheater
Reputation: 0

Joined: 10 Jan 2016
Posts: 68

PostPosted: Tue May 03, 2016 12:05 pm    Post subject: Reply with quote

ParkourPenguin wrote:
Again- why are you escaping the - character? Putting a backslash (the charater \ ) before any other character is an escape sequence. \- is an invalid escape sequence.

removed them...went to single qoutes...as dbl qoutes gave issues...
Code:
cmd='"C:/fnr.exe" --cl --dir "D:\\hacks\\SWF files\\rab\\277_clean\\name-0" --fileMask "*.*" --excludeFileMask "*.dll, *.exe" --includeSubDirectories --find ""'..search_array[nr2max]..'"" --replace ""'..replace_array[nrmax]..'""'


but still not executing app
tried run = io.popen(cmd)
aswell
will look at shell execute now
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Tue May 03, 2016 12:18 pm    Post subject: Reply with quote

Code:
--find ""'..search_array[nr2max]..'"" --replace ""'..replace_array[nrmax]..'""'

Are you sure this part is correct? I don't see any reason to have two empty strings surrounding something.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Ludwig
Advanced Cheater
Reputation: 0

Joined: 10 Jan 2016
Posts: 68

PostPosted: Tue May 03, 2016 12:39 pm    Post subject: Reply with quote

ParkourPenguin wrote:
Code:
--find ""'..search_array[nr2max]..'"" --replace ""'..replace_array[nrmax]..'""'

Are you sure this part is correct? I don't see any reason to have two empty strings surrounding something.

yes...the app got a windows interface with which u can build command line interfaces...so i give an search and replace with the parameters i need in the windows interface, click the build command line option, and it builds te required command line, "C:\fnr.exe" --cl --dir "D:\hacks\SWF files\rab\277_clean\name-0" --fileMask "*.*" --excludeFileMask "*.dll, *.exe" --includeSubDirectories --find """search""" --replace """replacing_with"""

which i subsituted with
Code:
--find ""'..search_array[nr2max]..'"" --replace ""'..replace_array[nrmax]..'""'


if its wrong, the app gives an error requiring user input from command line
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Tue May 03, 2016 12:54 pm    Post subject: Reply with quote

The command line that program built for you has 3 double quotes surrounding the search and replace fields. You have two in your string.
It also uses a backslash after the drive ("C:\fnr.exe") compared to your forward slash ("C:/fnr.exe"), but I'm not sure if that would cause it to fail.

Here's how you'd print that string out with all the proper escape sequences in Lua:
Code:
-- surrounding double quotes (must escape internal double quotes):
print("\"C:\\fnr.exe\" --cl --dir \"D:\\hacks\\SWF files\\rab\\277_clean\\name-0\" --fileMask \"*.*\" --excludeFileMask \"*.dll, *.exe\" --includeSubDirectories --find \"\"\"search\"\"\" --replace \"\"\"replacing_with\"\"\"")

-- surrounding single quotes (don't have to escape double quotes):
print('"C:\\fnr.exe" --cl --dir "D:\\hacks\\SWF files\\rab\\277_clean\\name-0" --fileMask "*.*" --excludeFileMask "*.dll, *.exe" --includeSubDirectories --find """search""" --replace """replacing_with"""')

Replace search and replacing_with without deleting those 3 double quotes surrounding them.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Ludwig
Advanced Cheater
Reputation: 0

Joined: 10 Jan 2016
Posts: 68

PostPosted: Tue May 03, 2016 1:30 pm    Post subject: Reply with quote

ParkourPenguin wrote:
The command line that program built for you has 3 double quotes surrounding the search and replace fields. You have two in your string.
It also uses a backslash after the drive ("C:\fnr.exe") compared to your forward slash ("C:/fnr.exe"), but I'm not sure if that would cause it to fail.

Here's how you'd print that string out with all the proper escape sequences in Lua:
Code:
-- surrounding double quotes (must escape internal double quotes):
print("\"C:\\fnr.exe\" --cl --dir \"D:\\hacks\\SWF files\\rab\\277_clean\\name-0\" --fileMask \"*.*\" --excludeFileMask \"*.dll, *.exe\" --includeSubDirectories --find \"\"\"search\"\"\" --replace \"\"\"replacing_with\"\"\"")

-- surrounding single quotes (don't have to escape double quotes):
print('"C:\\fnr.exe" --cl --dir "D:\\hacks\\SWF files\\rab\\277_clean\\name-0" --fileMask "*.*" --excludeFileMask "*.dll, *.exe" --includeSubDirectories --find """searchtring """ --replace """replacing_with"""')

Replace search and replacing_with without deleting those 3 double quotes surrounding them.


my search and replace i add in there got the extra " on each side to make up for that...thnx on the hlp on the print of cmd, the "/" instead of "\" doesnt give a error...

EDIT...
fixed...
the command line that the app gave doesnt work thru LUA... as it is, tho it does directly in command prompt...but...if i take
"C:\\fnr.exe" --cl ...........
and remove the "
so that it is C:\\fnr.exe --cl .........
it works fine...Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites