Jump to content

Recommended Posts

Posted

Hi Everyone,

I'm opening up a dialog box and the File Name field is the active field, so far so good.

Then I'm using Send() to pass in the path and file name to open. Send() keep truncating my string, which by the way is a variable.

my string should be:

C:\Documents and Settings\username\Desktop\AutoIt\models\first.txt

what keeps getting "Sent()" is

ings\username\Desktop\AutoIt\models\first.txt

I've tried using

Sleeps

WinWaitActive

and anything else I can think of.

Why is it doing that?

Thank you.

Cygnus

Cygnus

Posted

Hi Everyone,

I'm opening up a dialog box and the File Name field is the active field, so far so good.

Then I'm using Send() to pass in the path and file name to open. Send() keep truncating my string, which by the way is a variable.

my string should be:

C:\Documents and Settings\username\Desktop\AutoIt\models\first.txt

what keeps getting "Sent()" is

ings\username\Desktop\AutoIt\models\first.txt

I've tried using

Sleeps

WinWaitActive

and anything else I can think of.

Why is it doing that?

Thank you.

Cygnus

Do you have a code snippet for us to analyze? It would help to see if maybe it's a syntactical issue or some such roadblock.

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Posted (edited)

Func OpenModel($str)
    WinMenuSelectItem($SUTitle, "", "&File", "Open..."); File > Open
    WinWaitActive("Open", "&Open", 5);Wait for Open dialog box
    Sleep(2000);just so I can see it
    Send("{DELETE}");erase existing name in File Name field
    Sleep(2000);more waiting
    Send($ModelPath & $str); string to dir and file name
    Sleep(1000);more waiting
    Send("{Enter}");send enter to press default active button "Open"
EndFunc

Here is my code.

Hope that helps.

Cygnus

Edited by CygnusX1

Cygnus

Posted (edited)

I have the exact same question actually....

If someone knows the solution then you help us out both :-)

This is my code:

#include <GUIConstants.au3>

$Form1 = GUICreate("Form1", 312, 61, 193, 125)
$Text = GUICtrlCreateInput("puttexthere", 8, 8, 297, 21)
$Spam = GUICtrlCreateButton("Spam", 208, 32, 99, 25, 0)
$Stop = GUICtrlCreateButton("Stop", 8, 32, 49, 17)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $Spam
                Sleep ( 5000 )              ;Time it takes for me to put the cursor somewhere
          Do
        Send ( "$Text" )              ;Doesn't work
        Send ( "{ENTER}" )
          Until $Stop
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd
Edited by nf67
Posted

Here is more to my puzzle:

I have a check to see if the WinExists, if it doesn't use

Run(); start the application
WinWait($SUTitle)
WinMove($SUTitle, "", 0, 0, 800, 600)
WinActivate($SUTitle, "")

I have a code block that I also see if it does WinExits() then do blah blah blah... After each code block is when I use the WinMenuSelectItem() and Send() methods.

If the application was not running and AutoIt has to invoke it sometimes, most of the time WinMenuSelectItem() never works. If I manually do File > Open, the next I run the script with the program open WinMenuSelectItem() and Send() work everytime.

If the application was running WinMenuSelectItem() works but truncates the string.

Weird.

I have the exact same question actually....

If someone knows the solution then you help us out both :-)

This is my code:

#include <GUIConstants.au3>

$Form1 = GUICreate("Form1", 312, 61, 193, 125)
$Text = GUICtrlCreateInput("puttexthere", 8, 8, 297, 21)
$Spam = GUICtrlCreateButton("Spam", 208, 32, 99, 25, 0)
$Stop = GUICtrlCreateButton("Stop", 8, 32, 49, 17)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $Spam
                Sleep ( 5000 )          ;Time it takes for me to put the cursor somewhere
          Do
        Send ( "$Text" )             ;Doesn't work
        Send ( "{ENTER}" )
          Until $Stop
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Cygnus

Posted (edited)

Hello, I have had this problem too.

I fixed it with the option SendKeyDelay "Alters the the length of the brief pause in between sent keystrokes.

Time in milliseconds to pause (default=5). Sometimes a value of 0 does not work; use 1 instead."

Set this to a higher value than 5 (default) and test again!

So insert for example this after the includes or in the beginning of the script:

AutoItSetOption ( "SendKeyDelay", 10 )

Check it out, it might help!

Edited by LinuZ

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...