Jump to content

can a file be created with a proprietary extention


Recommended Posts

I am making an extremely simple script. It goes like this:

Create a file

Run the file

So far the only way i have been able to create the file is by opening a new occurence of notepad, writing in the 2 lines of text, and saving it as my .rd2 file. Then i close notepad and open the file with:

RunWait(@COMSPEC & " /c start C:\ecn.rd2")

which does the job just fine.

The big problem is all of that stuff with notepad cannot possibly be the best way to do that, and i have had no luck so far with anything else like FILEWRITE

any ideas on how i can pull this off quickly without having to run notepad?(or anything else in the foreground for that matter)

also, a bonus would be to be able to have a line of text in the shell that pops up to run the program that says something like "please wait for file to load"

That would be sweet

Thanks a ton

Link to comment
Share on other sites

have a look at FileWriteLine() in the help file. Also read the sample code there.

Cheers

Kurt

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

wow, so when i tried that the first 8 times it didnt work for some reason. I guess i just needed to be reminded. any ideas on adding text to the cmd.exe file running thing?

this is my code right now btw if you want to try it(even though the file wont open for you):

$ECN = int(InputBox("ECN VIEWER", "Enter the ECN number you want to view"))

If @error = 1 Then

MsgBox(4096, "Exiting", "Canceled, bye!")

Else

If $ECN<1 Then

MsgBox(4096, "Error", "You must enter an ""actual"" ECN number!")

$run=0

Else

$run = 1

EndIf

endif

if $run=1 then

$file = FileOpen("c:\ecn.rd2",2)

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

FileWriteLine($file, "ECN-" & $ECN)

FileWriteLine($file, "SIGNATURE REQUEST: FALSE")

FileClose($file)

RunWait(@COMSPEC & " /c start C:\ecn.rd2")

endif

Link to comment
Share on other sites

Not sure exactly what you want to do beyond opening the new file with its default program, but you might be after this:

_ShellExecuteDllCall("c:\ecn.rd2", "open", "", "")

After adding the _ShellExecuteDllCall() UDF <{POST_SNAPBACK}> to your code.

Link to comment
Share on other sites

First

right click on ecn.rd2

left click "open with"

try to choose notepad

.... if needed you select

choose progam

try to choose notepad

check the check-box that states "always use this program.."

this creates the "file association"

then change this line

RunWait(@COMSPEC & " /c start Notepad.exe C:\ecn.rd2")

8)

Edited by Valuater

NEWHeader1.png

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...