Sign in to follow this  
Followers 0
Autoxics

Trying To Open Notepads Open Dialogbox! With No Succes

12 posts in this topic

Trying without succes to Run notepad and send ctrl+O to open the dialogbox open in notepad,

Couldent get any Control ID so iam lost here as how could i do this in the correct manner?

Run("Notepad")
ControlSend("Untitle - Notepad", "","(CTRL+O)")

No matter what ive tried i cant get it to open, i know am still a noob

Share this post


Link to post
Share on other sites



Well you've misspelled Untitled - Notepad for 1, you have the wrong number of parameters for 2, try this:

Run("Notepad.exe")
WinWait('Untitled - Notepad')
WinMenuSelectItem('Untitled - ', '', '&File', '&Open...' )


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Holly was it that easy, well not for me,but for you,

Thanks yet again SmOke_N

I really got to prectice allot more,

its mostly the combining scripts that one has not used that is the hardest part to get a hang of,

but ones used, then its easier to come up with a combination of another working script.

, i gues i need to be more openminded in the future, satt 2 hours with this and you posted it in a few minutes,

:)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Holly was it that easy, well not for me,but for you,

Thanks yet again SmOke_N

I really got to prectice allot more,

its mostly the combining scripts that one has not used that is the hardest part to get a hang of,

but ones used, then its easier to come up with a combination of another working script.

, i gues i need to be more openminded in the future, satt 2 hours with this and you posted it in a few minutes,

:)

I would suggest using SciTe, it would have told you you had the wrong parameters :(.

Edit:

Also when using Window names consistently, you might just put that window name in a Global var:

Global $NotePad = 'Untitled - Notepad'
Run("Notepad.exe")
WinWait($NotePad)
WinMenuSelectItem($NotePad, '', '&File', '&Open...' )
That way you only have to pay special attention to your spelling one time. Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Thanks for the tip SmOke_N , il do that

, Scite i used it sometimes but for doing some lua scripting, but havent used it more than a few times for au3.

Share this post


Link to post
Share on other sites

Thanks for the tip SmOke_N , il do that

, Scite i used it sometimes but for doing some lua scripting, but havent used it more than a few times for au3.

Keeping up with the new definitions, Jdeb does a great job, not using SciTe with an .au3 script is like eating a PeanutButter and Jelly sandwich without the Jelly.

Also, after looking at what you were doing, and alternative to think about may be:

$FileOpenDialog = FileOpenDialog('Open a Text File', @ScriptDir, 'Text Files (*.txt)')
Run('Notepad.exe ' & $FileOpenDialog)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Well your probably right, since you have been doing this much longer then me , am sure you know what your talking about,

well actualy what am trying to do it not actually not just open the notepad open dialog,

i had an idea, when i managed to work out the other script with the clipboard, that creating a script that copys the selected text from the clipboard and witch inturns writes a au3 file and closes it and opens autoIt compiler and sends open file to compile and then saves it to a location and compiles it, in a single script iam trying to do all this, with the autoit compiler window hiden , so that it compiles the script silently for a user,

Share this post


Link to post
Share on other sites

Well your probably right, since you have been doing this much longer then me , am sure you know what your talking about,

well actualy what am trying to do it not actually not just open the notepad open dialog,

i had an idea, when i managed to work out the other script with the clipboard, that creating a script that copys the selected text from the clipboard and witch inturns writes a au3 file and closes it and opens autoIt compiler and sends open file to compile and then saves it to a location and compiles it, in a single script iam trying to do all this, with the autoit compiler window hiden , so that it compiles the script silently for a user,

Here, try this:
$File2Create = @ScriptDir & '\ClipGet.au3'

If Not _CreateCompileAU3($File2Create, ClipGet()) Then
    If @error = 1 Then 
        MsgBox(64, 'Error', 'File ' & StringTrimRight($File2Create, 3) & '.exe was not created!')
    ElseIf @error = 2 Then
        MsgBox(64, 'Error', 'Most scripts now require Beta, lets make sure we do not throw any errors and download it now')
    EndIf
EndIf
    
Func _CreateCompileAU3($h_FilePath, $v_Info); $h_FilePath = .au3 to convert to and write, $v_info can be whatever you want to write to the .au3 (ClipGet() or whatever)
    Local $h_CreateEraseFile = FileOpen($h_FilePath, 10), $h_OutPath = StringTrimRight($h_FilePath, 3) & '.exe'
    FileWrite($h_CreateEraseFile, $v_Info)
    FileClose($h_CreateEraseFile)
    
    If FileExists(@ProgramFilesDir & '\AutoIt3\Beta\Aut2EXE\Aut2EXE.exe') Then
        RunWait(@ProgramFilesDir & '\AutoIt3\Beta\Aut2EXE\Aut2EXE.exe /in "' & $h_FilePath & '" /out "' & $h_OutPath & '" /pass "A"')
        If Not FileExists($h_OutPath) Then
            SetError(1)
            Return 0
        EndIf
        Return 1
    Else
        SetError(2)
        Return 0
    EndIf
EndFunc
It's thrown together, and I only tested it once, could probably use another error check for FileOpen()

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Il try it out,

i was currently working on this and i, saw your post

:)

WinWait('Aut2Exe v3 - AutoIt Script to EXE Converter')
ControlClick("Aut2Exe v3 - AutoIt Script to EXE Converter", "", 'Button2')
Send("Helloa.au3")
ControlClick("Open", "", 'Button2')
ControlClick("Aut2Exe v3 - AutoIt Script to EXE Converter", "", 'Button3')
ControlClick("Save As", "", 'ToolbarWindow322')
Send("Helloa.au3")
ControlClick("Save As", "", 'Button2')
ControlClick("Aut2Exe v3 - AutoIt Script to EXE Converter", "", 'Button9')
ControlClick("Aut2Exe", "", 'Button1')
WinMenuSelectItem('Aut2Exe v3 - AutoIt Script to EXE Converter', '', '&File', '&Exit' )

this is one of the part i was working on

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

:) Its working to great its way better then my version of the script,

, thats it, thats how i wanted it to work, and you did it,

Well, what can i say, more than a Big thanks for the help,script.

Edited by Autoxics

Share this post


Link to post
Share on other sites

#11 ·  Posted

Ive tried out your script Encode It , witch is really great for protecting the scripts,

i just thouth id give you a tip back as a thanks for helping me, why not create a script that takes care of the encode It and the Compiling with au3 in the same process,

Share this post


Link to post
Share on other sites

#12 ·  Posted

Ive tried out your script Encode It , witch is really great for protecting the scripts,

i just thouth id give you a tip back as a thanks for helping me, why not create a script that takes care of the encode It and the Compiling with au3 in the same process,

I could add the option I guess, I already have something similar to what I gave you in it.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
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
Sign in to follow this  
Followers 0