Jump to content
Sign in to follow this  
sbrady

help searching a folder

Recommended Posts

sbrady

OK let me explain what is going on here. I have been away for 1 whole year. I am a Mac user. I am an audio post engineer. I use Applescript. My workplace transitioned from Mac back to PC over the last year. I need to create many scripts to perform tasks I do multiple times a day. I was successful with many of my efforts. But I coded on an XP machine, all the edit suites that would use the script are now on new WIndows 7 computers and nothing works. Here is the goal of this script.  Type the project code i.e. "AK98" into the message box and have the script look in 4 different servers, and when it finds a folder with AK98 in the name, open up the folder.

If anyone could be so kind as to try and help me I would be greatly thankful.

shawn

;apace


#include <File.au3>
#include <Array.au3>






local $apace1_array = "abcd"
local $apace2_array = "efghijk"
local $apace3_array = "lmno"
local $apace4_array = "pqrstuvwxyz"
local $interactive = "i"

local $apace1_featuresAD = "\\active_projects_a-d\ Features\"   ;"\\Apacefeatures1\active_projects_a-d\ Features\"
local $apace1_Feat_arrayAD = _FileListToArray("\\active_projects_a-d\ Features\")   ;"\\Apacefeatures1\active_projects_a-d\ Features\"
local $apace1_telethonAD = "\\Apacefeatures1\active_projects_a-d\ TELETHON\"     
local $apace1_tele_arrayAD = _FileListToArray("\\Apacefeatures1\active_projects_a-d\ TELETHON\")


local $apace1_featuresPZ = "\\Apacefeatures1\active_projects_p-z\ Features\"
local $apace1_feat_arrayPZ = _FileListToArray("\\Apacefeatures1\active_projects_p-z\ Features\")
local $apace1_TELETHONPZ = "\\Apacefeatures1\active_projects_p-z\ TELETHON\"
local $apace1_tele_arrayPZ = _FileListToArray("\\Apacefeatures1\active_projects_p-z\ Features\")



local $apace2_7Ci = "\\Apacefeatures2\active_projects_e-k\7Ci\"
local $apace2_7Ci_array = _FileListToArray("\\Apacefeatures2\active_projects_e-k\7Ci\")
local $apace2_featuresEK = "\\Apacefeatures2\active_projects_e-k\ Features\"
local $apace2_feat_arrayEK = _FileListToArray("\\Apacefeatures2\active_projects_e-k\ Features\")
local $apace2_telethonEK = "\\Apacefeatures2\active_projects_e-k\ TELETHON\"
local $apace2_tele_arrayEK = _FileListToArray("\\Apacefeatures2\active_projects_e-k\ TELETHON\")

local $apace2_featuresLO = "\\Apacefeatures2\active_projects_l-o\ Features\"
local $apace2_feat_arrayLO = _FileListToArray("\\Apacefeatures2\active_projects_l-o\ Features\")


Local $apace2_apace_AD = "\\active_projects_a-d\ Features\"   ;"\\Apacefeatures1\active_projects_a-d\ Features\"
Local $apace2_apace_AD2 = _FileListToArray("\\active_projects_a-d\ Features\")     ;"\\Apacefeatures1\active_projects_a-d\ Features\"


Local $apace2_apace_PZ = "\\Apacefeatures1\active_projects_p-z\ Features\"
Local $apace2_apace_PZ2 = _FileListToArray("\\Apacefeatures1\active_projects_p-z\ Features\")

Local $apace2_apace_AD_tele = "\\Apacefeatures1\active_projects_a-d\ Telethon\"
Local $apace2_apace_AD_tele2 = _FileListToArray("\\Apacefeatures1\active_projects_a-d\ Telethon\")


Local $apace2_apace_LO_tele = "\\Apacefeatures2\active_projects_l-o\ Telethon\"
Local $apace2_apace_LO_tele2 = _FileListToArray("\\Apacefeatures2\active_projects_l-o\ Telethon\")
Local $apace2_apace_PZ_tele = "\\Apacefeatures1\active_projects_p-z\ Telethon\"
Local $apace2_apace_PZ_tele2 = _FileListToArray("\\Apacefeatures1\active_projects_p-z\ Telethon\")

; ask for project code
Local $project_code = InputBox("Question", "Enter just the Project Code", "OP589", "", - 1, -1, 400, 200)




; =============== OPEN INTERACTIVE
Local $is_interactive = StringLeft ( $project_code, 1 );i
If $is_interactive = "i" Then
   For $i = 1 To $apace2_7Ci_array[0]
   If StringInStr($apace2_7Ci_array[$i], $project_code) Then
   ;MsgBox(4096,"project code only",$apace2_interactive2[$i]);iAA22
   ShellExecute($apace2_7Ci & $apace2_7Ci_array[$i])
   $hHandle = WinWait("", $apace2_7Ci & $apace2_7Ci_array[$i]);
   WinMove($hHandle, "", 50, 100, 400, 500)  ; use the handle here
   Exit
   EndIf
   Next
EndIf




;==============OPEN APACE A-D Features
Local $is_apace_AD = StringLeft ( $project_code, 1 );g
;MsgBox(4096,"A-D",$is_apace_EK);g
If $is_apace_AD = "G" Then
   For $i = 1 To $apace2_apace_AD2[0] 
   If StringInStr($apace2_apace_AD2[$i], $project_code) Then
   MsgBox(4096,"file path",$apace2_apace_AD2 & $apace2_apace_AD2[$i]);iAA22
   ShellExecute($apace2_apace_AD & $apace2_apace_AD2[$i])
   $hHandle = WinWait("", $apace2_apace_AD & $apace2_apace_AD2[$i]);
   WinMove($hHandle, "", 50, 100, 400, 500)  ; use the handle here
   EndIf
   Next
EndIf





;==============OPEN APACE E-K  Features    KW110 
Local $is_apace_EK = StringLeft ( $project_code, 1 );g
;MsgBox(4096,"222",$is_apace_EK);k
If $is_apace_EK = "k" Then
   For $i = 1 To $apace2_apace_EK2[0] 
   If StringInStr($apace2_feat_arrayEK[$i], $project_code) Then
   ;MsgBox(4096,"E-K2",$apace2_apace_EK2 & $apace2_apace_EK2[$i])
   ShellExecute($apace2_featuresEK & $apace2_feat_arrayEK[$i])
   $hHandle = WinWait("", $apace2_featuresEK & $apace2_feat_arrayEK[$i]);
   WinMove($hHandle, "", 50, 100, 400, 500)  ; use the handle here
   Exit
   EndIf
   Next
EndIf





;==============OPEN APACE L-O   Features    OB1548 
Local $is_apace_LO = StringLeft ( $project_code, 1 );g
;MsgBox(4096,"L-O",$is_apace_LO);g
If $is_apace_LO = "o" Then
   For $i = 1 To $apace2_feat_arrayLO[0] 
   If StringInStr($apace2_feat_arrayLO[$i], $project_code) Then
   ;MsgBox(4096,"O",$apace2_apace_LO2 & $apace2_apace_LO2[$i]);iAA22
   ShellExecute($apace2_featuresLO & $apace2_feat_arrayLO[$i])
   $hHandle = WinWait("", $apace2_featuresLO & $apace2_feat_arrayLO[$i]);
   WinMove($hHandle, "", 50, 100, 400, 500)  ; use the handle here
   Exit
   EndIf
Next
EndIf






;==============OPEN APACE P-Z  Features
Local $is_apace_PZ = StringLeft ( $project_code, 1 );g
;MsgBox(4096,"555",$is_apace_PZ);g
If $is_apace_PZ = "G" Then
   For $i = 1 To $apace2_apace_PZ2[0] 
   If StringInStr($apace2_apace_PZ2[$i], $project_code) Then
   ;MsgBox(4096,"file path",$apace2_apace_PZ2 & $apace2_apace_PZ2[$ii]);iAA22
   ShellExecute($apace2_apace_PZ & $apace2_apace_PZ2[$i])
   $hHandle = WinWait("", $apace2_apace_PZ & $apace2_apace_PZ2[$i]);
   WinMove($hHandle, "", 50, 100, 400, 500)  ; use the handle here
   Exit
EndIf
Next
EndIf



;==============OPEN APACE A_D  Telethon



;==============OPEN APACE E-K  Telethon   ISR5
Local $is_apace_EK_tele = StringLeft ( $project_code, 1 );g
;MsgBox(4096,"777",$is_apace_EK_tele);g
If $is_apace_EK_tele = "i" Then
   For $i = 1 To $apace2_tele_arrayEK[0] 
   If StringInStr($apace2_tele_arrayEK[$i], $project_code) Then
   ;MsgBox(4096,"file path",$apace2_telethonEK & $apace2_tele_arrayEK[$i])
   ShellExecute($apace2_telethonEK & $apace2_tele_arrayEK[$i])
   $hHandle = WinWait("", $apace2_telethonEK & $apace2_tele_arrayEK[$i])
   WinMove($hHandle, "", 50, 100, 400, 500)  ; use the handle here
   Exit
EndIf
Next
EndIf



;==============OPEN APACE L-O  Telethon
Local $is_apace_LO_tele = StringLeft ( $project_code, 1 );g
;MsgBox(4096,"777",$is_apace_EK_tele);g
If $is_apace_LO_tele = "o" Then
   For $i = 1 To $apace2_apace_LO_tele2[0] 
   If StringInStr($apace2_apace_LO_tele2[$i], $project_code) Then
   ;MsgBox(4096,"888",$apace2_apace_PZ2 & $apace2_apace_PZ2[$i]);iAA22
   ShellExecute($apace2_apace_LO_tele & $apace2_apace_LO_tele2[$i])
   $hHandle = WinWait("", $apace2_apace_LO_tele & $apace2_apace_LO_tele2[$i]);
   WinMove($hHandle, "", 50, 100, 400, 500)  ; use the handle here
   Exit
EndIf
Next
EndIf





;==============OPEN APACE P-Z  Telethon








;$filename2 = StringInStr ( $project_code, " " , 0 , -1) ;18 (iAA22) + " " (last " " is x chars in from right)
;Local $is_interactive = StringTrimRight ( $project_code, $filename2 ) ; trim from right back 18 chars
;MsgBox(4096,"project code only",$is_interactive);iAA22
;MsgBox(4096,"project code only",$project_code);iAA22

Share this post


Link to post
Share on other sites
lordofthestrings

so inputbox instead of messagebox might be easier to accomplish what you want.

$projectcode=inputbox(....)

shellexecute("serversharefolderfile" & $projectcode & ".txt")

or

run(@comspec & " /c dir serversharefolderfile" & $projectcode & ".txt")

runwait, ...

all the possibilities.. does that help you out or am I thinking in the wrong direction?

Kind regards,

Dimitri


Share this post


Link to post
Share on other sites
sbrady

Dimitri, I wish I knew what you were talking about. Thanks for the tip. All I can do is start from scratch and use inputbox to get the project name and cycle through folders. thanks. shawn

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  

×