Sign in to follow this  
Followers 0
leuce

Colon becomes semicolon during Send

10 posts in this topic

G'day everyone

I have the following script:

WinWaitActive ("somedocument.txt")
Send ("^{F2}"); This means "Save As"
ControlSend ("Save As", "", "Edit1", "C:\bitext\aatemp.txt")
ControlClick ("Save As", "&Save", "Button2")
Sleep (100)
If WinActive ("Save As") Then; If file exists, then click Yes overwrite it
ControlClick ("Save As", "&Yes", "Button1")
EndIf

But when the file name is sent to the Save As window, the script sends a semicolon instead of a colon, and I keep getting the error message that C;\bitext\aatemp.txt isn't a valid path name (which it isn't, because that semicolon should be a colon).

Any ideas?

Thanks

Samuel

Share this post


Link to post
Share on other sites



Hi,

works for me. Which editor for txt files do you use?

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Works for me. Which editor for txt files do you use?

I use Metapad. The script worked for me too, for a while, and then suddenly this semicolon-thing started happening.

PS Do you know of a tiny GPL text editor that can do Find/Replace with @CRLF? Metapad isn't GPL and I'd like to bundle the text editor with my script.

Share this post


Link to post
Share on other sites

I use Metapad. The script worked for me too, for a while, and then suddenly this semicolon-thing started happening.

PS Do you know of a tiny GPL text editor that can do Find/Replace with @CRLF? Metapad isn't GPL and I'd like to bundle the text editor with my script.

A quick search on SourceForge for "text editor" with a filter for OS=Win32 turned up 12 projects. I don't know exactly which would be best for your app, but that gives you choices.

Of course, AutoIT can probably do what you describe through internal functions, what makes you need to include an external editor...? :D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Of course, AutoIT can probably do what you describe through internal functions, what makes you need to include an external editor...?

Well, that's why I asked my other question here:

http://www.autoitscript.com/forum/index.php?showtopic=28426

All I need to do in that text editor is Find/Replace with @CRLF.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

ControlSend ("Save As", "", "Edit1", "C:\bitext\aatemp.txt")

It may not make a difference, but try changing the above line to:

ControlSend ("Save As", "", "Edit1", "C:\bitext\aatemp.txt",1) ; Flag 1 = SendRaw

I have had similar problems in the past with certain control/windows on certain PC's,

notepad seems rarely to experience the problem, but other apps can.

As everyone tries to reproduce the problem in

notepad, they invariably dont see a problem & dismiss it.

There is a quirk somewhere in the Send & ControlSend commands, but very hard to reproduce. As result can differ from machine to machine. May even be a bios setting at fault, I have no clue.

Next time I encounter it, I will try and give the developers some better details as to my problem.

The output sent & recieved can differ, like as if a phantom is pressing shift whilst sending the output.

Sending an uppercase 'A' is interpreted & sent as shift+a not 'A'. Or in your case u want colon and it sends a semi colon, which is shift+semicolon

Over my head what may be causing it. But I usually end up working round it.

It may even be something to do with Capslock mode, but to be honest, I got tired of trying different options.

As i have said, sometimes it's just fine! Tricky one for sure.

HardCopy

Just seen Larry's comment, which prompts me to "ask"

Could ControlSendPlus not be incorporated into the Core Beta Release UDF Functions?

Edited by HardCopy

Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad

Share this post


Link to post
Share on other sites

It may not make a difference, but try changing the above line to:

ControlSend ("Save As", "", "Edit1", "C:\bitext\aatemp.txt",1) ; Flag 1 = SendRaw
Nope, no difference. But I just gave up and did it the way I did it before I discovered ControlSend, which is:

Send ("^{F2}")
Send ("c:\bitext\aatemp.txt")
Send ("{TAB 2}")
Send ("{ENTER}")
Sleep (100)
If WinActive ("Save As") Then
Send ("{LEFT}")
Send ("{ENTER}")
EndIf

Thanks for your comments, though.

Share this post


Link to post
Share on other sites

All I need to do in that text editor is Find/Replace with @CRLF.

Well, as it turns out, Metapad isn't opensource but it is freely distributable, which is all I needed (and it weighs in at less than 100 kb).

Share this post


Link to post
Share on other sites

Would ControlSetText() do the same thing?

Share this post


Link to post
Share on other sites

Hi! Under locked workstation's this code

Run("c:\windows\system32\cmd.exe", "", @SW_MINIMIZE)
sleep(5000)
$hwnd = WinGetHandle("c:\windows\system32\cmd.exe")
sleep(1000)
ControlSend($hwnd, "", "", ":\:{:}", 1)
ControlSend($hwnd, "", "", " - ")
ControlSend($hwnd, "", "", ":\:{:}{SHIFTDOWN}:{SHIFTUP}+;+:")
ControlSend($hwnd, "", "", " - ")
$s = Chr(58)
ControlSend($hwnd, "", "", $s)
ControlSend($hwnd, "", "", " - ")
$s = Chr(59)
ControlSend($hwnd, "", "", $s)

Exit

return

;\;[;] - ;\;;;;; - ; - ;

Please, help me send ":" into console window under locked ws.

Under unlocked ws write correctly:

:\:{:} - :\::;:: - : - ;

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