Jump to content

Process should run in background


Recommended Posts

Hallo,

how can I describe a programm, that it should run in the background, that you can't see any windows and so on, and that it isn't affected by inputs of the keyboard?

THank you!!!

You just described one... now what are you really wanting to know?

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Hi JSThePatriot,

I want to know, how the script can run in the background.

When I run my script and the content of the script is:

run("notepad.exe)

send ("Hello")

Then the programm save the file and close "notepad"

The whole programm should run in the background, that I can't see how notepad start and write "Hello".

Link to comment
Share on other sites

@Seth27,

look at '#NoTrayIcon '. If you don't use a GUI in your script you only can find your program in the processlist, I think. How to hide a pcrocess? I don't know.

Briegel

EDIT1: Sorry I don't read all. Look at 'run' and '@SW_HIDE'.

EDIT2: I tried it with notepad by using 'ControlSend()' but 'ControlSend()' only can send a string to a active window. How to activate a hidden window? If you want to write a file have a look at 'User Defined Function Reference - File Management'.

Edited by Briegel
Link to comment
Share on other sites

@Skruge,

this little script works.

$filenamepath= 'C:\TEMP\test.txt'

Run('notepad.exe','')
ProcessWait('notepad.exe')
ControlSend('Unbenannt - Editor', "", 15, "Hallo" )
ControlSend('Unbenannt - Editor', "", 15, "!d" & 'b' )
Sleep(500)
ControlClick('Editor','',6)
Sleep(500)
ControlFocus('Speichern unter','',1148)
ControlSetText('Speichern unter','',1148,$filenamepath)
ControlClick('Speichern unter','',1148)
Sleep(500)
ControlSend('Speichern unter','',1,'!s')

it doesn't.

I wonder how to check what goes wrong with a hidden window. :D

Link to comment
Share on other sites

@Briegel -

I think the problem may be with ControlSend.

It appears that you're sending menu keystrokes to the Edit control, which apparently works while visible.

I used ClassNameNN notation because I don't know your Control IDs.

I also translated it to english because I'm not sure what [Alt+d, b] represents. (Mein Deutsch ist nicht so gut)

@Seth27 -

This works for me... Hopefully you can adapt that to what you wanted to accomplish.

#notrayicon
Opt("WinTitleMatchMode", 2)

; Remove Test file
$filenamepath = 'C:\test.txt'
FileDelete($filenamepath)

; Launch Notepad and Enter some text
Run("notepad", "", @SW_HIDE)
ProcessWait("notepad.exe")
ControlSend("Notepad", "", "Edit1", "Hallo")

; Save as $filenamepath
WinMenuSelectItem("Notepad", "", "&File", "Save &As...")
WinWait("Save As", "")
ControlSetText("Save As", "", "Edit1", $filenamepath)
ControlClick("Save As", "", "Button2")

; Show the window after a brief delay
Sleep(5000)
WinSetState("Notepad", "", @SW_SHOW)

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Link to comment
Share on other sites

  • Moderators

@Briegel -

I think the problem may be with ControlSend.

It appears that you're sending menu keystrokes to the Edit control, which apparently works while visible.

I used ClassNameNN notation because I don't know your Control IDs.

I also translated it to english because I'm not sure what [Alt+d, b] represents. (Mein Deutsch ist nicht so gut)

@Seth27 -

This works for me... Hopefully you can adapt that to what you wanted to accomplish.

#notrayicon
Opt("WinTitleMatchMode", 2)

; Remove Test file
$filenamepath = 'C:\test.txt'
FileDelete($filenamepath)

; Launch Notepad and Enter some text
Run("notepad", "", @SW_HIDE)
ProcessWait("notepad.exe")
ControlSend("Notepad", "", "Edit1", "Hallo")

; Save as $filenamepath
WinMenuSelectItem("Notepad", "", "&File", "Save &As...")
WinWait("Save As", "")
ControlSetText("Save As", "", "Edit1", $filenamepath)
ControlClick("Save As", "", "Button2")

; Show the window after a brief delay
Sleep(5000)
WinSetState("Notepad", "", @SW_SHOW)oÝ÷ Ûú®¢×¢ç(ºWZ²±È^jÛh¡«­¢+ع½ÑÉ好¸(ÀÌØí¥±¹µÁÑ ô!½µÉ¥ÙµÀìÌäìÀäÈíQÍÑ¥¹QáÐÄĹÑáÐÌäì)¥±]É¥Ñ ÀÌØí¥±¹µÁÑ °Ìäí!±±¼Ìäì¤)IÕ¸ Ìäí¹½ÑÁ¹áÅÕ½ÐìÌäìµÀìÀÌØí¥±¹µÁÑ µÀìÌäìÅÕ½ÐìÌäì¤
:D

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.

Link to comment
Share on other sites

@Skruge,

thanks for explanation what did I wrong. Again I've learned something.

The 'Save As' window is visible during control functions works. Is it possible to hide this window too? I tried it with

WinWait('Save As', '')
WinSetState('Save As', '',@SW_HIDE )oÝ÷ Ù»­¶­g­ì"Ú0Ëâ²&åzÖ¤zÈî²Ö¬àÂ+a¢ëwõh§IëRµ«^ßÔ¶»"¯{*.¶ z¹ÚÚÉZ¶*'"׬µçpØ[yÆ®±â-)äʧyçbµ«­¢+ع½ÑÉ好¸)=ÁÐ ÅÕ½Ðí]¥¹Q¥Ñ±5Ñ¡5½ÅÕ½Ðì°È¤((ìIµ½ÙQÍÐ¥±(ÀÌØí¥±¹µÁÑ ôÌäíèÀäÈíQµÀÀäÈíÑÍйÑáÐÌäì)¥±±Ñ ÀÌØí¥±¹µÁÑ ¤((ì1Õ¹ 9½ÑÁ¹¹ÑÈͽµÑáÐ)IÕ¸ Ìäí¹½ÑÁÌäì°ÌäìÌäì°M]}!%¤)AɽÍÍ]¥Ð Ìäí¹½ÑÁ¹áÌäì¤)
½¹Ñɽ±M¹ ÌäíU¹¹¹¹Ð´¥Ñ½ÈÌäì°ÌäìÌäì°Ìäí¥ÐÄÌäì°Ìäí!±±¼Ìäì¤((ìMÙÌÀÌØí¥±¹µÁÑ )]¥¹5¹ÕM±Ñ%Ñ´ ÌäíU¹¹¹¹Ð´¥Ñ½ÈÌäì°ÌäìÌäì°ÌäìµÀíѤÌäì°ÌäíMÁ¥¡É¸µÀíÕ¹Ñȸ¸¸Ìäì¤)]¥¹]¥Ð ÌäíMÁ¥¡É¸Õ¹ÑÈÌäì°ÌäìÌäì¤)
½¹Ñɽ±MÑQáÐ ÌäíMÁ¥¡É¸Õ¹ÑÈÌäì°ÌäìÌäì°Ìäí¥ÐÄÌäì°ÀÌØí¥±¹µÁÑ ¤)
½¹Ñɽ±
±¥¬ ÌäíMÁ¥¡É¸Õ¹ÑÈÌäì°ÌäìÌäì°Ìäí    ÕÑѽ¸ÈÌäì¤((ìM¡½ÜÑ¡Ý¥¹½ÜÑÈÉ¥±ä)M±À ÔÀÀÀ¤)]¥¹MÑMÑÑ Ìäí¥Ñ½ÈÌäì°ÌäìÌäì°M]}M!=

EDIT: @SmOke_N,

sorry I didn't see your post before. I think it's not a cheat. It's an easier way to write something.

If you want to write a file have a look at 'User Defined Function Reference - File Management'.

Edited by Briegel
Link to comment
Share on other sites

  • Moderators

EDIT: @SmOke_N,

sorry I didn't see your post before. I think it's not a cheat. It's an easier way to write something.

:D ... I've been finding alot of shortcuts lately because I ALWAYS tend to take the long way around everything to get the SAME result.

Edit:

My ebonics is acting up.

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.

Link to comment
Share on other sites

  • 1 year later...

Hello...

can anyone help me for solve this problem...

i has make my own makro programs, and i want the makro programs is runing in backround proccess, so i can still open a web browser or chat in MSN. anyone know about rhe code ? tq

Link to comment
Share on other sites

  • Developers

Hello...

can anyone help me for solve this problem...

i has make my own makro programs, and i want the makro programs is runing in backround proccess, so i can still open a web browser or chat in MSN. anyone know about rhe code ? tq

hmm, 3 posts and 3 times questionable.

Why are you resurrecting an 2 years old thread that doesn't seem to have much to do with your question.

As to your question: Explain what it is you really want here, because all autoit3 script run independently.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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