[Solved] Create new file and move cursor to it?

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
sirksel
Junior Member
Junior Member
Posts: 71
Joined: 2013-04-24, 10:24 UTC

[Solved] Create new file and move cursor to it?

Post by *sirksel »

I want to assign to a keystroke the following to create a new file:
1. Prompt for a filename -- which I think is done with the ? param
2. Create the file -- maybe something like nul > name ?
3. Move the cursor to that filename but without selecting it -- ???

I know I could maybe send keys from AHK, but it seemed like I could do this with native commands. I was trying to write an em_ command for it. I saw LoadSelectionFromClip in other forum threads, but there were two issues. First, I don't really want to select it, but instead just move the cursor to it. Second, I'm not even sure how the response to the ? parameter to a custom command would get into the Clipboard with native commands.

I'm sure I'm missing the easy solution here. Is there a good way to do this with native commands? Many thanks.
Last edited by sirksel on 2024-06-16, 12:46 UTC, edited 1 time in total.
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Create new file and move cursor to it?

Post by *Stefan2 »

Try Shift+F4        (that's cm_Edit to create a new file on default setup)



More solutions can be found by googling "create new file site:www.ghisler.ch"


For more help just asks.


 
Fla$her
Power Member
Power Member
Posts: 2985
Joined: 2020-01-18, 04:03 UTC

Re: Create new file and move cursor to it?

Post by *Fla$her »

2sirksel
Example: cm_Edit /CGL0N="<[P].txt" (or)

PS: By the way, you didn't answer me in the thread.
Overquoting is evil! 👎
sirksel
Junior Member
Junior Member
Posts: 71
Joined: 2013-04-24, 10:24 UTC

Re: Create new file and move cursor to it?

Post by *sirksel »

2Stefan2

Thanks for your suggestion. I tried cm_Edit, which isn't Shift+F4 in my custom mappings, but it still wanted to open the file.

I liked your idea to find ghisler.ch matches, and found some for the cm_Edit parameters, which I figured must exist, based on Fla$her's answer.

2Fla$her

Thanks for your hints and links! So I followed your lead, and ended up using:
cmd=cm_Edit /CL0
I wanted it to prompt me for a name, go to the name, but not open it. L0 seemed to be the magic I didn't know existed.

P.S. Also, I answered you on the other thread, but I'm still trying to figure a good way to test your button bar. Sorry for my delay!
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Create new file and move cursor to it?

Post by *Stefan2 »

2sirksel

So you're satisfied now? Do it works for you as you wanted it?





 
sirksel
Junior Member
Junior Member
Posts: 71
Joined: 2013-04-24, 10:24 UTC

Re: Create new file and move cursor to it?

Post by *sirksel »

Yes, it works great. I'm not sure if there's a way I'm supposed to mark it as closed? I don't see the "accepted answer" button I see on some forum sites. Anyhow, thank you all so much.
User avatar
white
Power Member
Power Member
Posts: 5753
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Create new file and move cursor to it?

Post by *white »

sirksel wrote: 2024-06-16, 02:17 UTC I'm not sure if there's a way I'm supposed to mark it as closed?
No, nothing is closed on this forum so no action is necessary ;)
If you wish, you can edit your first post and edit the subject (and add "[Solved]" for example). This will change the thread's title.
Post Reply