LarsBNygaard
Members-
Posts
18 -
Joined
-
Last visited
LarsBNygaard's Achievements
Seeker (1/7)
0
Reputation
-
Hello all, I should like to send the hotkey combination [Ctrl] + [Win] + [R] to my desktop. When I press this key combination on my keyboard, it does exactly what it is supposed to do; which is to select the next random image, as wallpaper. I have tried to make the same function in AutoIt, " Send("^#R") ", but here it does not work. Am I missing something important here? NextDesktopImage.au3
-
Count number of files in folder..?
LarsBNygaard replied to LarsBNygaard's topic in AutoIt General Help and Support
OK, I've gotten this far: #include <File.au3> #include <Array.au3> Local $FileList = _FileListToArray("C:UsersMigPicturesLotteriet") If @error = 1 Then MsgBox(0, "", "No Folders Found.") Exit EndIf If @error = 4 Then MsgBox(0, "", "No Files Found.") Exit EndIf _ArrayDisplay($FileList, "$FileList") Here I get a nice messagebox, telling me which files are in the selected folder, but I need a number of files (and I cannot find anything resembling "FileCount".. -
Count number of files in folder..?
LarsBNygaard replied to LarsBNygaard's topic in AutoIt General Help and Support
@ eXceLlence OK, this function count the number of files in the temporary dir, if I'm not much mistaken. How do I set it to count the files in i.e. C:UsersMigDesktop ? Is this possible..? @ digiworks I do not seem to find any refrence to "_FileListToArray" anywhere in the help system. I search for "_" I get results, but if I search for as much as "_F" there is no results found... *puzzled* -
Count number of files in folder..?
LarsBNygaard replied to LarsBNygaard's topic in AutoIt General Help and Support
Thanks a zillion! ;oD -
Is there a command in AutoIt, which will let a script count the number of files in a specific folder, and return a result, which can be used in other functions? I.e. something like: $Number = FileCount ("C:\windows\fonts") MsgBox(0,"Number of fonts", $Number) Any help will be greatly appreciated!
-
LarsBNygaard reacted to a post in a topic:
WinSetState and identifying the window to set..?
-
I've written a little experimental program, using 2 shortcuts, to manage a relay. The shortcuts are: C:\USB-relæ\USBRelay\USBRelay.exe -c:8 -r:1#1 ( = 'ON') C:\USB-relæ\USBRelay\USBRelay.exe -c:8 -r:1#0 ( = 'OFF') The script (the compiled .exe) is doing what it is supposed to do, using the Run ("C:\USB-relæ\USBRelay\USBRelay.exe -c:8 -r:1#1")to turn the relay on - but I keep getting a window, which I cannot "get a grip on", almost all over my monitor, which I find absolutely annoying..! What can I do, in order to force this window to "disappear"..? Any help will be greatly appreciated!
-
Thanks a zillion, I'll wait in great excitement to see the solution.!
-
LarsBNygaard reacted to a post in a topic:
Chr(#) to COM8 ?
-
Thanks a zillion to John and Martin, I've downloaded and looked at the example script, and I must say, that here I'm overchallenged... Would it be possible to talk one of you into writing two sniplets of code for me, one "turn it on" sending Chr(255) + Chr(1) + Chr(1) to COM8 and one "turn it off", sending Chr(255) + Chr(1) + Chr(0) to COM8 in such a manner, that I can set the trigger myself, i.e. #include <Date.au3> $Dato=( _NowDate()) -and then set the date as trigger, for sending the chr¤'s to COM8..?
-
LarsBNygaard reacted to a post in a topic:
Chr(#) to COM8 ?
-
How do I set a script to send i.e. Chr(255) + Chr(1) + Chr(0) to the COM8 port? I need this, in order to turn a relay connected to CON8 on/off. Any help will be appreciated! ---------------------------------------------------------------------- Sample VB6 code : Private Sub cmdOff_Click() With MSComm8 'make sure the serial port is open If .PortOpen = False Then .PortOpen = True 'send the data .Output = Chr$(255) .Output = Chr$(1) .Output = Chr$(0) End With 'MSComm1 End Sub Private Sub cmdOn_Click() With MSComm8 'make sure the serial port is open If .PortOpen = False Then .PortOpen = True 'send the data .Output = Chr$(255) .Output = Chr$(1) .Output = Chr$(1) End With 'MSComm1 End Sub
-
What am I missing..?
LarsBNygaard replied to LarsBNygaard's topic in AutoIt General Help and Support
And now I got thinking... Would it be possible, to get the 'time' as a number, instead of as a $tring value? The reason for asking this is, that I'd like to lengthen the 'Sleep' i.e. to app. 10 minutes, but in order to make sure, that the script will start Picasa (when the clock pass 18:00), I guess I'll have to be able to make a comparison, between "desired time for start" and "real time"; in a manner somewhat like this: IF realtime > 18:00 THEN start program AND terminate script ELSE wait for [some-time] AND start all over again... If I start the script at EXACTLY 10:00, the sleep for 10 minutes, WILL (later this day) get the time, to be EXACTLY 18:00 - but if the script is initiated at i.e. 10:03, I'll not get the time to be exactly 18:00... -
What am I missing..?
LarsBNygaard replied to LarsBNygaard's topic in AutoIt General Help and Support
Hi JLogan3o13 Thankyou a zillion, I ended up with this - which seem to be working (haven't passed 1800 hours yet today)... ; Script Start #include <Date.au3> $var = _NowTime(4) If $var ="18:00" Then run("C:Program FilesGooglePicasa3Picasa3.exe") EndIf Sleep(60000) $PID = ProcessExists("Picasa3.exe") If $PID Then ProcessClose("Start-picasa-kl1800.exe") Else Run("D:Start-picasa-kl1800.exe") EndIf -
I'm trying to start "picasa" at 1800 hours local time, but I get "$ID=(_NowTime) Start-picasa-kl1800.au3$ID=(_NowTime^ ERROR Error: Missing seperator character after keyword" The code I attempt is looking like this <code>-------------------------------------------------------------------------------------- #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.6.1 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <Date.au3> _NowTime([$sType = 4]) $ID =(_NowTime) If $ID =="18:00" Then run("C:\Program Files\Google\Picasa3\Picasa3.exe") Else Sleep(60000) EndIf Run("Start-picasa-kl1800.exe") </code>--------------------------------------------------------------------------------------
-
How do I terminate a running program with AI?
LarsBNygaard replied to LarsBNygaard's topic in AutoIt General Help and Support
Well, I guess that I cracked the nut (in a manner of speaking). Apparently bittorent has a rather timeconsuming 'shut-down-procedure' - at least on my PC, from the "exit-click" is done, until the process is actually disappearing from Windows joblist, app. 12½-13½ seconds pass. In order to overcome this, I've added the 'wait' command, in order to pause the script for 15 seconds - after starting firefox - before checking if firefox is still running; and have subsequently adapted the "RunWait", in order to have the script restart bittorrent after Firefox has been closed. In effect this works like a dream for me ;oD I'm very grateful for all your help, and post the code for anyone to use! CODE-START--------------------------- #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.6.1 Author: Lars Bech Nygaard with kind help from BrewManNH and Zulqarnain Script Function: Terminate Bittorrent, Run Firefox and restart Bittorent on exit from Firefox #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here ;WinClose(" ;Get PIDs Local $FirefoxPID = ProcessExists("firefox.exe") Local $bittorrentPID = ProcessExists("bittorrent.exe") ;If bittorrent Exists, kill it and start firefox If $bittorrentPID <> 0 Then ProcessClose($bittorrentPID) ;If bittorrent.exe exists, kill it. Run("C:\Program Files\Mozilla Firefox\firefox.exe") ;run firefox after killing bittorrent.exe EndIf ; Wait 15 seconds Opt("WinWaitDelay", 15000) ;If firefox does not exist, start bittorrent If $FirefoxPID == 0 Then RunWait("C:\Program Files\BitTorrent\bittorrent.exe") EndIf CODE-END--------------------------- Yours most grateful Lars Bech Nygaard -
How do I terminate a running program with AI?
LarsBNygaard replied to LarsBNygaard's topic in AutoIt General Help and Support
Well, here we are at the limits f my understanding, but I guess that I've got the point.. Would it be possible to implement a 'wait' command, somewhat like this: ----------------------------- ;WinClose(" ;Get PIDs Local $FirefoxPID = ProcessExists("firefox.exe") Local $bittorrentPID = ProcessExists("bittorrent.exe") ;If bittorrent Exists, kill it and start firefox If $bittorrentPID <> 0 Then ProcessClose($bittorrentPID) ;If bittorrent.exe exists, kill it. Run("C:\Program Files\Mozilla Firefox\firefox.exe") ;run firefox after killing bittorrent.exe EndIf ; Wait 10 seconds Opt("WinWaitDelay", 10000) ;If firefox does not exist, start bittorrent If $FirefoxPID == 0 Then RunWait("C:\Program Files\BitTorrent\bittorrent.exe") EndIf