Jump to content
aa2zz6

Script won't run Notepad in Array

Recommended Posts

aa2zz6

When I try to run the script nothing happens and the script ends without errors. I think maybe the array is wrong by chance.

 

 

Func Script1()
    Run("notepad.exe")
    WinWaitActive("Untitled - Notepad")
    Send("This is script 1.")
    Send("!n")
EndFunc   ;==>Script1

Func Script2()
    Run("notepad.exe")
    WinWaitActive("Untitled - Notepad")
    Send("This is script 2.")
    Send("!n")
EndFunc   ;==>Script2

Func Script3()
    Run("notepad.exe")
    WinWaitActive("Untitled - Notepad")
    Send("This is script 3.")
    Send("!n")
EndFunc   ;==>Script3

If $CmdLine[0] = 1 Then
    Switch $CmdLine[1]
        Case "/1"
            Script1()
        Case "/2"
            Script2()
        Case "/3"
            Script3()
    EndSwitch
EndIf

 

Share this post


Link to post
Share on other sites
Danyfirex

Use WinWaitActive("[CLASS:Notepad]") instead your way.


Saludos

Share this post


Link to post
Share on other sites
iamtheky

It works fine...(though probably not ideal). just compile it to an exe. and then run it from the command line using the command line parameters you specified.  

You are certainly welcome to entertain us with the way you thought you were running it.

Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites
Danyfirex

I think your problem is that your OS is not English. For me, It does not work. I use Spanish OS. So I use the CLASS Name.

 

Saludos

Share this post


Link to post
Share on other sites
iamtheky

that doesnt even execute notepad on the Spanish OS?


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites
Danyfirex

that doesnt even execute notepad on the Spanish OS?

Yes It runs. But does not work this part 

WinWaitActive("Untitled - Notepad")
    Send("This is script 2.")
    Send("!n")

 

@aa2zz6

If you want to test in Scite just add your parameters  Shift+F8 

Saludos

Edited by Danyfirex
Add

Share this post


Link to post
Share on other sites
aa2zz6

I tried running it on the script form where you script by pressing F5 but nothing happened. Maybe I'm doing something wrong?

Thanks for the replies @ Danyfirex & boththose

Share this post


Link to post
Share on other sites
Danyfirex

Did you first add the command line parameter using Shift+F8 ?

I should work if you first add the command line parameter.

 

Saludos

Share this post


Link to post
Share on other sites
aa2zz6

I haven't done much with command line parameter and after examining the Help File I don't seem to have a clear understanding. 

Share this post


Link to post
Share on other sites
iamtheky

nothing mysterious about them.  Just think of command line parameters as parameters for the command line  :)

hit - F7

open - command prompt

navigate to the path and type -  WhateverYouNamedThatFile.exe /1

Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites
aa2zz6

Alright got it! Thank you and I appreciate all the help.

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

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.